Timer v3.01Due to
a recent suggestion by Snarky, I decided to go ahead and update this module, for the first time in six years! Also, the old download links are all dead anyway. So what's new in v3.0? The timers are now completely OO, which means no more mucking about with everything being called on the Timer class.
// room script
Timer tBomb;
function oFuse_Useinv()
{
if (player.ActiveInventory == iMatch) tBomb.Set(5.0, eTimerSeconds);
}
function room_RepExec()
{
if (tBomb.IsExpired())
{
oBomb.Animate(10, 5); // bomb explosion animation
}
}
How does it work? Magic, that's how!
Download v3.0109 August 2013 I've updated this to v3.01, which changes a few things. The first parameter to Timer.Set is now a float to allow setting partial seconds, and there is an optional RoundDirection parameter (following the optional TimerUnit parameter). To pass an integer you can now call Timer.SetInt, or just use IntToFloat. I've added methods Timer.Pause and Timer.UnPause to allow temporarily pausing a timer, and the property Timer.IsPaused to check the current pause state. I've added properties Timer.RunWhileGamePaused and Timer.RunWhileBlocking to give greater control over when the timers are updated (set per instance, defaults are false and true respectively). Finally, Timer.Count was returning the wrong value, so I fixed that bug.
v3.0 DownloadTimer v2.01In making the demo for my Flashlight module, I realized that the way I was storing the timer names was highly susceptible to collision, and that these collisions would result in crashes. This version is merely a fix for this issue.
I've also included a Timer.IsNameValid function for checking timer names for validity. Timer names cannot contain the strings "//TimerStart", "//TimerEnd", nor can they be null or empty Strings. Timer.Set will reject invalid names.
Download Timer v2.01Read the Timer manual onlineTimer v2.0
Now you can create as many timers as you want (

)! I could have worked this out before, but I was just being lazy, and thinking it through the wrong way. I've rethought this entire module, and I've even completely rewritten it from scratch.
As always, feel free to let me know if you find any issues, or just if you have any comments or questions!
~monkey~
Timer v1.0
I wrote another module. This one basically just gives the user more timers to work with (100 by default). Except that the user can also control whether the timer is updated only while rep_ex is running or while rep_ex_always is running, the timers can be temporarily paused, and you can give the timers names. My original idea was way cooler but it would never work. So...
Mirror v1.0 Thanks Neole!