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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  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] Refresh page


Posted by WillFa   USA  (525 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] 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
[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.


6,459 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]