This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

[HELP] if {![isop $powerfull $chan]} { ???????

Help for those learning Tcl or writing their own scripts.
Post Reply
r
ruizit0
Voice
Posts: 6
Joined: Mon Nov 14, 2005 5:18 am

[HELP] if {![isop $powerfull $chan]} { ???????

Post by ruizit0 »

hi all!
annyone can tell me why i cant put this if to work ? ... i tryed a few examples and no one works :|

Code: Select all

proc pub:voice {nick uhost hand chan text} {
 global Otrigger
 set newvc [lindex $text 0]
 if {$newvc==""} { putserv "MODE $chan +v $nick" }
 if {[botisop $chan]=="0"} { putserv "NOTICE $nick :ERROR! i dont have ${Otrigger}voice to do it" ; return 0 }
 putserv "MODE $chan +v $newvc"
}
why when bot isnt oppen he doesnt output the error notice??
if is oped he complete the operation and gives the voice...
but if isnt opped he doenst output the notice to user.. and doesnt report any error to partyline to... O.o
i tryied several ways like:

Code: Select all

set powerfull [string tolower [lindex $botnick 0]]
set newdp [string tolower [lindex $text 0]]
if {![isop $powerfull $chan]} {
and

Code: Select all

if {![botisop $chan]} ... bla bla bla
none of this examples work. . all night to try to do this work . .
eggdrops is v1.6.17+SSL

:\
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

It seems like your bot doesn't recognize that it's deoped, are you sure you have the right net-type setting?

Try this code:

Code: Select all

bind pub - ${Otrigger}voice pub:voice

proc pub:voice {nick uhost hand chan arg} {
 set newvc [lindex [split $arg] 0]
 if {[botisop $chan]} {
  if {$newvc==""} {
   putserv "MODE $chan +v $nick"
  } elseif {[onchan $newvc $chan]} {
   putserv "MODE $chan +v $newvc"
  } {
   puthelp "NOTICE $nick :$newvc is not on $chan."
  }
 } {
  puthelp "NOTICE $nick :ERROR! I'm not oped on $chan."
 }
}
r
ruizit0
Voice
Posts: 6
Joined: Mon Nov 14, 2005 5:18 am

Post by ruizit0 »

yap :) it works perfectly . . but now i have one problem . .
sorry my "n00b'ness" but that piece of code a little bit complicated that im accustomed..

now i want to add some "if's" but i tryed and the only worked was the
if {$newvc == $botnick} {
the other ones i cant make it work with your type of code :(

Code: Select all

if {$newvc == ""} {
if {[isvoice $newvc $chan]} {
putserv "NOTICE $nick :you have already voice"
}

Code: Select all

if {[isvoice $newvc $chan]} {
putserv "NOTICE $nick :look to chan... $newvc is already voiced!"
}

Code: Select all

if {$newvc == $botnick} {
puthelp "NOTICE $nick :dont touch me!"
can you help me on that please ? :(
thanks :)
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pub - ${Otrigger}voice pub:voice

proc pub:voice {nick uhost hand chan arg} {
 set newvc [lindex [split $arg] 0]
 if {[botisop $chan]} {
  if {$newvc==""} {
   if {![isvoice $nick $chan]} {
    putserv "MODE $chan +v $nick"
   } {
    puthelp "NOTICE $nick :you're already voiced on $chan."
   }
  } elseif {[onchan $newvc $chan]} {
   if {[isbotnick $newvc]} {
    puthelp "NOTICE $nick :don't touch me!"
   } elseif {![isvoice $newvc $chan]} {
    putserv "MODE $chan +v $newvc"
   } {
    puthelp "NOTICE $nick :$newvc is already voiced on $chan."
   }
  } {
   puthelp "NOTICE $nick :$newvc is not on $chan."
  }
 } {
  puthelp "NOTICE $nick :ERROR! I'm not oped on $chan."
 }
}
r
ruizit0
Voice
Posts: 6
Joined: Mon Nov 14, 2005 5:18 am

Post by ruizit0 »

thanks Sir_FZ its working perfectly . .
but now i have another problem (n00b stuff) :\

im trying to set some flags to binds like:

Code: Select all

#flag setup
set normal_flag "m"

#bind setup
set bind_op "!op"

bind $normal_flag ${bind_op} pub:op

proc pub:op {....} {
when i use this set's (flags and binds) the if {[botisop $chan]} { stops working :\

i tryed some diferent code situations and i cant figure why and how to solve it :\

then i thinked on something like this:

Code: Select all

 if ![matchattr $hand $normal_flag $chan] {
puthelp "NOTICE $nick :you dont have permission"
but doesnt worked to...
i tryed diferente ways to put that if but with no sucess :\ i even dont figure how and the order of the code .. the order how it calls the processes .. so is a little dificult to me to make it right before to gain practice to this new order :\

my last proc code is this

Code: Select all

#flag setup
set normal_flags "o"

#bind setup
set bind_voice "!voice"


#script
bind pub - ${bind_voice} pub:voice

proc pub:voice {nick uhost hand chan arg} {
global normal_flags
 set newvc [lindex [split $arg] 0]
 if {[botisop $chan]} {
if {$newvc==""} {
   if {![isvoice $nick $chan]} { 
 if ![matchattr $hand $normal_flags $chan] {
putserv "NOTICE $nick :not allowed to use command"
}
putserv "MODE $chan +v $nick"
   } {
    puthelp "NOTICE $nick :you're already voiced on $chan."
   }
  } elseif {[onchan $newvc $chan]} {
   if {[isbotnick $newvc]} {
    puthelp "NOTICE $nick :don't touch me!"
   } elseif {![isvoice $newvc $chan]} {
    putserv "MODE $chan +v $newvc"
   } {
    puthelp "NOTICE $nick :$newvc is already voiced on $chan."
   }
  } {
   puthelp "NOTICE $nick :$newvc is not on $chan."
  }
 } {
  puthelp "NOTICE $nick :not voiced on $chan"
 }
}
i moved that new if up and down in the code and i cant make it work lol :\
sorry for taking your time.. but can you give me a light ?
thanks
(sorry my english)
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

If the user doesn't have the +m flag, then ofcourse the whole proc will not be called and not just [botisop].
r
ruizit0
Voice
Posts: 6
Joined: Mon Nov 14, 2005 5:18 am

Post by ruizit0 »

but the user is me... i have all flags .. . and the bot doesnt respond to nothing .. .
but if a normal user tryes the bot responds to te flag check if...
when is me.. with all the flags. . he doesnt do nothing
wierd
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

matchattr $hand o $chan
will check if $hand has global +o only and not $chan specific +o. So instead use o|o. Also a little tip would be to add

Code: Select all

if {![matchattr $hand o|o $chan]} {
 # not allowed notice
 return 0
}
before the main ifs start, i.e. after the global line or something like that.
Post Reply