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
➜ Tips and tricks
➜ How to remove all timers, or remove one timer.
|
How to remove all timers, or remove one timer.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Jlake
(4 posts) Bio
|
| Date
| Mon 01 Apr 2002 11:54 AM (UTC) |
| Message
| After addtimer,I want to remove it after some time.
How to do this? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Mon 01 Apr 2002 10:20 PM (UTC) |
| Message
| There are a few ways you can do this. You haven't said how you would define "after some time" but I'll give various methods ...
- The simplest is to make a one-shot timer. This will fire once and then delete itself. This is handy if you only want to do something once, but in the future (eg. in 5 minutes).
- Next, you could make two timers, one which deletes the second one, like this:
World.addtimer "my_timer", 0, 0, 20, "drink water", 1, ""
World.addtimer "delete_my_timer", 0, 5, 0, "", 5, "delete_timer"
The first timer (my_timer) fires every 20 seconds, and sends "drink water" to the MUD.
The second timer (delete_my_timer) fires after 5 minutes, and is a one-shot timer (hence the flag of 5). It calls a script delete_timer.
The script delete_timer would look like this:
sub delete_timer (timer_name)
world.deletetimer "my_timer"
end sub
- You could use a trigger or alias to delete the timer. A trigger might be used if you wanted to do it automatically when something happened, an alias if you wanted to do it yourself.
In each case they would call a script like this:
sub OnDeleteTimer (strName, strLine, aryWildcards)
world.deletetimer "my_timer"
end sub
- If you have lots of such timers it gets slightly more complicated because then you need a way of knowing which timer to delete. I would then use a variable to remember which timer to delete.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Jlake
(4 posts) Bio
|
| Date
| Reply #2 on Tue 02 Apr 2002 12:18 AM (UTC) |
| 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,394 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top