Making a (repop) timer

Posted by Renny on Thu 04 Jun 2015 05:01 AM — 5 posts, 18,759 views.

Canada #0
I'm having trouble implementing a timer. I'll give context.

For Aardwolf mud I want to make a plugin that creates timers for the repop of areas.

I want to be able to call the timers to see how much time is left, and when they fire I want them to report that the area it was timing has repopped.

If possible I would also like them to alert when they have X number of seconds remaining.

------------------------------------------------------------

So far I've been able to use Addtimer() to create them, and I use GetTimerInfo() to retrieve the time remaining on them.

What I'm stuck on is storing the name of the areas they are tracking and then calling that information when they fire.

So yeah, my main problem is implementation and how to go about doing this.
Australia Forum Administrator #1
Timers can have names (first argument to AddTimer). Make the timer name the area name (you might have to replace spaces by underscores). Then you can tell from its name what area it refers to.
Canada #2
Nick Gammon said:

Timers can have names (first argument to AddTimer). Make the timer name the area name (you might have to replace spaces by underscores). Then you can tell from its name what area it refers to.


Hmm how would i retrieve that info when the timer fires?
Australia Forum Administrator #3
If you make a script function the timer name is the first (and only) argument to the script.

eg.


function OnTimer (strTimerName)
  Note ("Timer " .. strTimerName .. " has fired!")
end	-- of OnTimer 
Canada #4
Thanks!