[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Making a (repop) timer

Making a (repop) timer

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Renny   Canada  (26 posts)  [Biography] bio
Date Thu 04 Jun 2015 05:01 AM (UTC)
Message
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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 04 Jun 2015 05:39 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Renny   Canada  (26 posts)  [Biography] bio
Date Reply #2 on Fri 05 Jun 2015 03:53 AM (UTC)
Message
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?
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Fri 05 Jun 2015 08:25 AM (UTC)
Message
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 

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Renny   Canada  (26 posts)  [Biography] bio
Date Reply #4 on Mon 08 Jun 2015 08:38 PM (UTC)

Amended on Mon 08 Jun 2015 10:14 PM (UTC) by Renny

Message
Thanks!
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,617 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]