| View previous topic :: View next topic |
| Author |
Message |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Wed Dec 19, 2007 10:18 am Post subject: Question regarding timers |
|
|
| Code: | timer 58 topic:reset
proc topic:reset {} {
putserv "TOPIC #Islamabad :Resynching ..."
putserv "TOPIC #Islamabad :Welcome to #islamabad the capital city of PAKISTAN \00303,15 \00315,3 (* \003 , Live Cricket Commentary is in #Cricket"
timer 58 topic:reset
} |
If i am using a timer in one of my tcl and i dont kill the timer by the end of the code what are the disadvantages of it? what problems can it generate? and can I use multiple timers? if yes then please explain how.
Thanks
iamdeath _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Wed Dec 19, 2007 12:49 pm Post subject: |
|
|
That piece of code looks just fine. There is no need to try and terminate the timer that triggered the proc, as it is/will be terminated anyway as part of the execution.
The only thing worth noting, is that if you load this script multiple times, you'll end up with multiple timers (might be a good idea to check wether there is a timer running before starting a new one from outside the proc). _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Thu Dec 20, 2007 3:13 am Post subject: |
|
|
Exactly, the timer mismatch at times.. could you tell me how do I find out whether it's running multiple times or not.. _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Fri Dec 21, 2007 9:01 am Post subject: |
|
|
Thanks FZ for the reply but I could not find anything like that, anyway I am using TimerToolz from Archive and I kill timers from DCC.
1 more question is
| Code: | bind time - "* 00 * * *" test:1
bind time - "* 02 * * *" test:1
bind time - "* 04 * * *" test:1
bind time - "* 06 * * *" test:1
bind time - "* 08 * * *" test:1
bind time - "* 10 * * *" test:1
bind time - "* 12 * * *" test:1
bind time - "* 14 * * *" test:1
bind time - "* 16 * * *" test:1
bind time - "* 18 * * *" test:1
bind time - "* 20 * * *" test:1
bind time - "* 22 * * *" test:1
proc test:1 {min hour day month year} {
putserv "PART #Islamabad :Checking Spam."
putserv "JOIN #Islamabad"
} |
Ok does that mean the bot will part/join the channel every 2 hours?.. please tell me about that.
Thanks _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Fri Dec 21, 2007 9:09 am Post subject: |
|
|
| iamdeath wrote: | | Code: | | bind time - "* 00 * * *" test:1 |
Ok does that mean the bot will part/join the channel every 2 hours?.. |
Your first * means your masks will match EVERY minute when the hours match, which is pretty far from what you want Here's a way to execute stuff every 2 hours with a single bind: | Code: | bind time - "00 *" every_hour
proc every_hour {m h args} {
if {([scan $h %d]%2)==0} {
# every 2 hours
}
} |
_________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Fri Dec 21, 2007 9:21 am Post subject: |
|
|
Thanks alot that was way too easy and usefull thanks alot user  _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
|