Repeatable Timer Loop System

Submitted by elraver on Tue, 2008-01-22 21:18

The object of this challenge is to create a function system that uses a stopwatch style timer similar to standard wait() command.

However, it should be universal (Accepting any input for either of the styles of running the system shown below), cleanly repeatable in a looping fashion, and finish cleanly.

Thus, you should be able to do either:
Repeat '[pemit(%#,[time()])]' every 15 minutes for the next 2 hours, then stopping the loop cleanly.
After running '@eval [setq(1,0)]'

Repeat '[setq(1,[add(%q1,1)])]' every 5 minutes until %q1 = 10, then stopping the loop cleanly.

Both of these things should be able to be done by the user, utilizing your system.

Potentially useful commands/functions you may or may not wish to consider: @wait, @notify, @drain, @trigger, @halt, until(), while(), secs(), time(), convsecs(), convtime(), timefmt(), @function (wizhelp for that one)

Extra Challenge: Create the system to only need one function for either of the styles of use.

Extra Challenge: Allow the system to work either as a function or added @command.

Extra Challenge: Perform the challenge without use of @halt.