first: my englisch is not very good, because I'm from Germany.
second: the request,
I'm looking for a script that the Bot leaves the channel if triggert for a few minutes.
i.e. i've trigger with ~shutup and the Bot parts and returnes after xx minutes.
bind pub n !stfu takeAbreak
proc takeAbreak {n u h c a} {
expr {[scan $a %d a]>0||[set a 1]}
putquick "PRIVMSG $c :I'll be back in $a minute[expr {$a==1?"":"s"}]"
channel set $c +inactive
utimer [expr {$a*60}] [list channel set $c -inactive]
}
Then do "!stfu 2" and see if it leaves for 2 minutes (the default is 1)
EDIT: That was close Fz
EDIT2: added a message
EDIT3: you didn't find the bug? (messed up scan when $a was empty)
Last edited by user on Wed Jan 17, 2007 8:54 pm, edited 3 times in total.
user wrote:EDIT3: you didn't find the bug? (messed up scan when $a was empty)
Ok, this Bug is now fixed, but a have found another one, I have changed the level to o|o, and someone types a negative number like -1 the Bot dont came back to the channel -.-
bind pub n !stfu takeAbreak
proc takeAbreak {n u h c a} {
expr {[scan $a %d a]>0||[set a 1]}
putquick "PRIVMSG $c :I'll be back in $a minute[expr {$a==1?"":"s"}]"
channel set $c +inactive
utimer [expr {abs($a)*60}] [list channel set $c -inactive]
}
This will make it take the absolute value of $a so -1 will be taken as 1 for example.