| View previous topic :: View next topic |
| Author |
Message |
area57 Voice
Joined: 17 Jan 2007 Posts: 7
|
Posted: Wed Jan 17, 2007 5:35 pm Post subject: Bot leave for xx minutes |
|
|
Hi,
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.
I hope you unterstand my request  |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Wed Jan 17, 2007 6:18 pm Post subject: |
|
|
Try this: | Code: | 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) _________________ Have you ever read "The Manual"?
Last edited by user on Wed Jan 17, 2007 8:54 pm; edited 3 times in total |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Jan 17, 2007 6:18 pm Post subject: |
|
|
| Code: | bind pub n ~shutup part:join
proc part:join {nick uhost hand chan arg} {
channel set $chan +inactive
timer 5 [list channel set $chan -inactive]
} |
This will make the bot part and rejoin after 5 minutes.
Edit: user beat me to it  _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
area57 Voice
Joined: 17 Jan 2007 Posts: 7
|
Posted: Wed Jan 17, 2007 6:29 pm Post subject: |
|
|
Hi,
thank you very much.
but I have one more question,
is it possible that the Bot send a message in the chan before it performe the part ?
EDIT: Thanks for the Edit user  |
|
| Back to top |
|
 |
area57 Voice
Joined: 17 Jan 2007 Posts: 7
|
Posted: Sun Jan 21, 2007 3:03 pm Post subject: |
|
|
| 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 -.- |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Jan 21, 2007 8:00 pm Post subject: |
|
|
| Code: | 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. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|