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
➜ General
➜ execute in script with delay
execute in script with delay
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Gronka
(4 posts) Bio
|
Date
| Thu 02 Aug 2018 12:44 PM (UTC) |
Message
| Mushclient version 5.06-pre
Lua scripting language
I am trying to fire a script off a trigger.
The intention is to get an execute command sent after the trigger event happens. A delay of a couple seconds works. HEck even .5 seconds would do the trick.
I complete the quest!
trigger event now
script delay
execute xcp
I have tried a few things and this is the latest after researching the forums.
I also added a second to world command of 'cheer' just for giggles and to make sure there is a delay since I don't know how to delay an execute. Here is my trigger:
<triggers>
<trigger
enabled="y"
match="You have completed your quest."
send_to="12"
sequence="100"
>
<send>world.DoAfter 2, "cheer" world
world.execute xcp</send>
</trigger>
</triggers>
Here is my error:
Compile error
World: redacted
Immediate execution
[string "Trigger: "]:1: '=' expected near '2' | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 02 Aug 2018 07:36 PM (UTC) Amended on Thu 02 Aug 2018 07:37 PM (UTC) by Nick Gammon
|
Message
| Functions in Lua require their arguments to be in brackets, with a minor exception of taking a single string argument, eg.
You don't need to use "world", so your first line should look like:
See here for how to introduce delays into a script:
http://www.gammon.com.au/forum/?id=4956
Also the "wait" module mentioned here:
http://www.gammon.com.au/modules
For example:
require "wait"
wait.make (function () --- coroutine below here
Send ("foo")
wait.time (1) -- wait a second
Send ("bar")
end) -- end of coroutine
Lua is case-sensitive so the "execute" call should be:
|
- 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.
9,690 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top