Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Lua
➜ Making a (repop) timer
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Renny
Canada (26 posts) 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) 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 | Top |
|
Posted by
| Renny
Canada (26 posts) 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? | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) 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 | Top |
|
Posted by
| Renny
Canada (26 posts) 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
| |
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.
14,888 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top