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.
Old posts that have not been replied to for several years.
ProXy
Op
Posts: 126 Joined: Sun Aug 11, 2002 3:09 pm
Post
by ProXy » Tue Feb 18, 2003 11:23 am
Hello,
I wrote a script that checks the channelpeak every minute. Everytime I rehash my eggdrop, another timer starts. So I should kill all other timer, that were set by my script. I found the function "killtimer" but I don`t know how to check the exisiting timers, and how to kill all of them...
Could anyone please give me an example of a source that will kill all existing timers?
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Tue Feb 18, 2003 12:18 pm
Code: Select all
foreach t [timers] {
killtimer [lindex [split $t] end]
}
timers
Returns: a list of active minutely timers. Each entry in the list contains
the number of minutes left till activation, the command that will be
executed, and the timerID.
^^
Elen sila lúmenn' omentielvo
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Tue Feb 18, 2003 1:38 pm
There is a 1 issue with the code above. It kills all timers.
Each script should only take care of it's own timers, as removing them all, may cause other scripts to fail.
There are 2 alternatives.
1: Check to see if it's calling the command for this script before killing it.
2: (recomended), rather than kill the timer, simply don't spawn a new one. This prevents a needless remove and replace system, with a test and leave.
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Tue Feb 18, 2003 1:41 pm
he asked how to kill all existing timers
.. so I gave him a solution .. but I agree with you, if it's not needed then don't spawn a new one
Elen sila lúmenn' omentielvo
egghead
Master
Posts: 481 Joined: Mon Oct 29, 2001 8:00 pm
Contact:
Post
by egghead » Tue Feb 18, 2003 1:57 pm
ProXy wrote: I wrote a script that checks the channelpeak every minute. [snip]
Another alternative is not to use a timer, but to use a "bind time".
ProXy
Op
Posts: 126 Joined: Sun Aug 11, 2002 3:09 pm
Post
by ProXy » Tue Feb 18, 2003 2:34 pm
K, thx a lot I now got a solution. I check if there is a timer or not. If not, I start another...else do nothing