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
➜ Issue with enable/disable timers
|
Issue with enable/disable timers
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Stoned00d
(14 posts) Bio
|
| Date
| Wed 24 Apr 2002 08:36 PM (UTC) |
| Message
| | Whenever you use a script to disable a trigger and then enable the same one again, the trigger goes off right away instead of waiting the timer time. I believe I tried including an offset and getting the same results. Is there anyway to make it wait a full cycle? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Wed 24 Apr 2002 11:44 PM (UTC) Amended on Sun 24 Nov 2002 07:29 PM (UTC) by Nick Gammon
|
| Message
| Your problem is that the timer has elapsed, however it is disabled. When you enable it, it fires soon after. What you need to do is also "reset" it, which makes it start counting again.
eg.
World.EnableTimer "mytimer", vbTrue
World.ResetTimer "mytimer"
Post amended on 25/Nov/2002 to reverse the order of the above two statements. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Stoned00d
(14 posts) Bio
|
| Date
| Reply #2 on Thu 25 Apr 2002 09:43 PM (UTC) |
| Message
| | Just a general question: is there a website that has a list of all the commands that are included in VBscript? Microsoft has a very nice page expalaining all the built in functions, but MUSH also includes a lot of world.(something) commands that aren't included. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Thu 25 Apr 2002 10:01 PM (UTC) |
| Message
| | They are all documented at MUSHclient scripting functions - complete with examples in VBscript, Jscript and Perlscript. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Neurowiz
(17 posts) Bio
|
| Date
| Reply #4 on Sun 24 Nov 2002 01:43 PM (UTC) |
| Message
| Either I am doing something wrong with resetting timers or something is broke in 3.32 with the following:
Timer set up to fire every 10 seconds. Here's the XML from the world file.
<timer name="tmrTest" script="TestTimer" second="10" >
</timer>
Here's the underlying code:
Sub timerTest
World.note "--- Setting timer --- (" & Now & ")"
World.ResetTimer "tmrTest"
World.EnableTimer "tmrTest", TRUE
End Sub
Sub TestTimer(a)
World.Note "Test timer fired. (" & Now & ")"
World.EnableTimer "tmrTest", FALSE
End Sub
If I call timerTest from the command ("/timerTest") or from a script, the Timer still fires off immediately. If I just enable it from the GUI, it takes 10 seconds.
Thanks!
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Sun 24 Nov 2002 07:31 PM (UTC) |
| Message
| It seems my earlier post was wrong. Looking at the code MUSHclient does not reset timers that are disabled. Thus you need to enable it first, and then immediately reset it.
I have corrected the earlier post in case people read that and don't read on to the correction. The correct way is:
World.EnableTimer "mytimer", vbTrue
World.ResetTimer "mytimer"
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Neurowiz
(17 posts) Bio
|
| Date
| Reply #6 on Sun 24 Nov 2002 08:54 PM (UTC) |
| Message
| Thanks Nick! This is why I was happy to register, you are always very responsive and supportive.
As you noted, doing a TimerEnable and then immediately doing a TimerReset does the trick. My thanks!
Regards,
Neurowiz | | 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.
26,239 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top