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
➜ Suggestions
➜ Add a Sleep() method to the World object?
|
Add a Sleep() method to the World object?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| WillFa
USA (525 posts) Bio
|
| Date
| Sat 02 Mar 2002 01:25 AM (UTC) |
| Message
| I've seen the suggestion asking for a wait command to use in triggers and aliases, what I was hoping to ask for is a method added to the World object that basically encapsulates the Sleep() API. In other scripting engines I can utilize the WScript object's Sleep method. Unfortunately I can't instance just the WScript object itself through CreateObject().
I'd hate to dig out my copy of VB just to make a dll with this one function. :)
Have I missed something? :)
Thank you for a great product. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sat 02 Mar 2002 03:16 AM (UTC) |
| Message
| The problem with just adding sleep to the scripting engine is that it probably won't have the effect you want. Basically the sleep API makes the process that calls it stop doing anything for the nominated interval.
However, if you had two worlds open, for instance, then you probably don't want the second one to freeze while the first one sleeps.
Also, you really want to keep processing incoming input from the MUD, even if you are not wanting to send anything for a few seconds.
Thus, rather than sleeping, I recommend using timers instead. You can script a "one-shot" timer (one that does something once), to fire after a nominated time. There are various examples on the forum, and I think someone did a small script function to simplify doing this.
Thus, rather than doing this:
world.send "north"
world.sleep (5) // sleep for 5 seconds (not implemented!)
world.send "east"
You would do instead:
world.send "north"
// add a timer here with world.addtimer
// whent the timer fires it does a world.send "east".
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
8,629 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top