123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|225|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Off Topic -> PMC onExpire

Sat, 22 Oct 2011, 13:49
JL235
I’m currently adding an ’onexpire’ method to the timer, so can automatically run code when it expires. But you can also ’reset’ a timer, so it counts down again. Should ’reset’ wipe the ’on expire’ event or not?
Sat, 22 Oct 2011, 13:49
Jayenkai
Yeah.. Reset should stop, clean, RedoFromStart.. If I add a new timer, that'd leave the old one there, but reusing the same timer should stop/clean.. (oldskool opinion)

-=-=-
''Load, Next List!''
Sat, 22 Oct 2011, 15:04
9572AD
I would think just like any loop if you change the counter value explicitly the loop continues as it normally would with the new counter value. If you reset the countdown, the "explosion" doesn't trigger until it ends.

-=-=-
All the raw, animal magnetism of a rutabaga.
Sat, 22 Oct 2011, 21:06
CodersRule
I actually had a problem with a timer['s onExpire event] _not_ resetting earlier when I was writing a plugin for something. It's much better, in my opinion, for the timer onExpire event to be cancelled.

My main problem, however, was that I didn't know in my code whether the timer was running or not. If it wasn't running, it'd throw an exception when I tried to cancel the timer before nullifying it.

If you can cancel the onExpire event of a timer without getting an error if it was never set, perhaps resetting the timer shouldn't get rid of the event. An extra line of code to reset the onExpire event as well isn't a horrible thing to have to use.

(I ended up just shoving the timer cancellation in a try...catch block xD)