This is just a simple script that allows users to thank op's and other users who help them out in a channel or what not. It doesn't have any importance or anything like that just helps the channel owner keep track of who is helping out. I know some things could be added to help it out but this was a quick and easy write. All you have to do is load into your remotes. I also came across the idea of how to write this script when I seen DaDealer's point script: http://www.hawkee.com/snippet/5241/ that is a very useful script. Thanks DaDealer.
on *:text:!thankyou*:#: {
if ($2 == $nick) {
msg $chan Pat yourself on the back, but I am not adding a thanks to your record.
halt
}
else {
set %a $address($2,2)
set %c $chan
inc %thanks. [ $+ [ %a ] ] [ $+ [ %c ] ]
notice $2 you currently have %thanks. [ $+ [ %a ] ] [ $+ [ %c ] ]
}
msg $chan A thank you has been added to $2 's record.
}
on *:text:!checkthanks:#: {
set %d $address($nick,2)
set %c3 $chan
notice $nick you currently have %thanks. [ $+ [ %d ] ] [ $+ [ %c3 ] ]
unset -s %d
}
on *:text:!checkthanks*:#:{
set %d3 $address($2,2)
notice $nick $2- currently has %thanks. [ $+ [ %d3 ] ] [ $+ [ %c3 ] ]
unset -s %d3
}
@Oddball You forgot to unset %a,%c and %c3.
For temporary variables like this, it is much better to use /var than /set.
This way you don't have to unset them.
You also didn't set a channel variable in the last On Text event so it just uses %c3 from the last match to the second On Text event. You should really combine those two events.
But don't you think that is rather odd. Let's say I place this script into a bot called Ghost-writer, and then I have to enter: !thankyou Jethro_ for Ghost-writer to thank me for it? Should it make more sense if I thank Ghost-writer instead of me? Or what about:
on *:text:!thankyou*:#: {
if ($2 == $nick) { msg # $1 $2 }
elseif ($2 == $me) { msg # $1 $2 }
}
Now you can either thank both of us. But it's still odd, thanks to you, Oddball...
Hash table could be used, would be much cleaner than these variables. But after making this i think a $readini could be used more efficiently :P.
on $*:TEXT:/^[.!@]ThankYou/Si:#: {
if ($2 == $nick) { msg $chan Pat yourself on the back $nick $+ , but i am not adding a thanks to your record. }
else {
hinc -m Thanks $+ $chan $address($2,2)
notice $2 Your thanks has been increased by $nick $+ . You now has $hget(Thanks $+ $chan,$address($2,2))
msg $chan A thank you has been added to $2 $+ 's record.
}
}
on $*:TEXT:/^[.!@]CheckThank/Si:#: {
if (!$timer(floodthank $+ $nick)) {
.timerfloodthank $+ $nick 1 6 noop
notice $nick You currently have $hget(Thanks $+ $chan,$iif($2,$v1,$nick))
}
}
Actually, GrimReaper, $+ isn't needed for that, because you can attach characters to the end of $N identifiers (eg. $1... $2, $3abcdefg) (this excludes hyphens unless you do something like "$1-1-" or "$1--")
It doesn't work like that for any other identifier though. (that I know of...)
Edit... Didn't realize there was a space between those until just now...
Oddball, in this line: "msg $chan A thank you has been added to $2 's record."
You should be able to attach the 's to the $2 to make it $2's, and it should work.
I think you mistook $2 == $me for $nick. Your current code will result in someone says his or her own nick for the running client to be able to say thanks to themselves instead of the "op." You should also make your text match for some other possibilities of sending their thankfulness by using regex:> on $*:TEXT:/!(thanx|thx|thanks?( |you|u))/iS:#: {
if ($2 == $me) {
.msg $chan Pat yourself on the back, but I am not adding a thanks to your record.
}The halt is not needed, and your other two text events can be combined into one.