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

MUSHclient FAQ

Frequently Asked Questions (FAQ) about MUSHclient.

Summary How can I build in a delay into a trigger, macro or alias?
Question I want to send commands to the MUD with a delay of a few seconds between them. How do I do that?
Answer You cannot build a delay directly into a script, because if you did, all of MUSHclient would "hang" while the delay was happening. However there are a few ways of achieving delays ... 1. You can use a "speedwalk" delay to slowly send commands to the MUD. Set up the "speedwalk delay" in the Commands configuration tab (in milliseconds, eg. 5000 is 5 seconds), and then every command sent at the speedwalk delay will be sent at that interval. 2. For triggers, you can choose "Send to world (speedwalk delay)" to make a trigger reply slowly. 3. For aliases, you can check "queue command" which will make the alias output be sent at the speedwalk delay. 4. For macros, make the macro send a word that is matched by an alias, and then use the technique in step 3 above. 5. For scripts, you can use "world.addtimer" to make a timer which will do something (eg. send something to the MUD, or call another script) after a nominated number of hours, minutes and seconds. 6. The simplest method is to use "world.DoAfter" in a script, if you simply want to do something in 2 seconds (or so). eg. world.DoAfter 2, "north" world.DoAfter 4, "enter shop" world.DoAfter 5, "buy chicken" In each case the number is the number of seconds from when the script executes, so in the above example there will be delays of 2 seconds, then another 2 seconds, then 1 second. 7. See the forum posting: http://www.gammon.com.au/forum/?id=4956 This describes how you can use Lua coroutines to build delays into scripts. For more examples, search the forum for "delay", "doafter", "addtimer".

Search for word or phrase

Enter a word or phrase in the box below to narrow the list down to those that match.

Search for:   

Leave blank to show all FAQs.

View all MUSHclient FAQ


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.


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 FutureQuest]