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.

what am i doing wrong

Help for those learning Tcl or writing their own scripts.
Post Reply
B
BhasIRC
Voice
Posts: 27
Joined: Sat Jan 02, 2010 7:05 am
Location: south africa
Contact:

what am i doing wrong

Post by BhasIRC »

Hi..

ok i need the following code to kick users who slap the bot with a slap msg maybe if it can be done were the slap msg is diff for each kick

here is my code

Code: Select all

bind ctcp - ACTION slap:back 

proc slap:back {nick uhost hand chan kw arg} { 
 if {![validchan $chan]} {return 0} 
 if {[string match "*slap* $botnick *" $arg]} { 
  puthelp "KICK $chan $nick :test" 
 } 
} 
Thanks in advance
Zainul
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

First off, you are accessing $botnick as a local variable (which does not exist at that point of execution), rather than access the global $::botnick.
Secondly, you probably intended the match to be case insensitive. String match cares 'bout case by default, but you can use the -nocase option to instruct it to not care for case:

Code: Select all

bind ctcp - ACTION slap:back

proc slap:back {nick uhost hand chan kw arg} {
 if {![validchan $chan]} {return 0}
 if {[string match -nocase "*slap* $::botnick *" $arg]} {
  puthelp "KICK $chan $nick :test"
 }
}
NML_375
B
BhasIRC
Voice
Posts: 27
Joined: Sat Jan 02, 2010 7:05 am
Location: south africa
Contact:

Post by BhasIRC »

thank alot works great
Post Reply