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
➜ Delay Trigger until Action
|
Delay Trigger until Action
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Traz
(31 posts) Bio
|
| Date
| Tue 16 Jan 2018 09:24 PM (UTC) Amended on Tue 16 Jan 2018 11:33 PM (UTC) by Nick Gammon
|
| Message
|
<triggers>
<trigger
enabled="y"
group="Fried"
match="* opens his mouth and fires a powerful blast at * that causes * to fall in pain!"
send_to="12"
sequence="100"
>
<send>if lastTriggerTime == nil or os.time () - lastTriggerTime >= 5 then
Send ("--")
Send ("assist caldar")
--insert delay here--
Send ("shoge")
Send ("rune")
Send ("shoge")
Send ("shoge")
lastTriggerTime = os.time ()
end</send>
</trigger>
</triggers>
I'm trying to delay the above trigger to delay the four Sends after "assist caldar".
If possible, I would like to delay it until the mud sees the output "* flies down and lands on the ground." otherwise a 2 second delay would be enough. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Tue 16 Jan 2018 11:01 PM (UTC) |
| Message
| |
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Tue 16 Jan 2018 11:30 PM (UTC) Amended on Tue 16 Jan 2018 11:32 PM (UTC) by Nick Gammon
|
| Message
| Basically it would look like this:
<triggers>
<trigger
enabled="y"
group="Fried"
match="* opens his mouth and fires a powerful blast at * that causes * to fall in pain!"
send_to="12"
sequence="100"
>
<send>
require "wait"
wait.make (function ()
if lastTriggerTime == nil or os.time () - lastTriggerTime >= 5 then
Send ("--")
Send ("assist caldar")
wait.regexp ("^.* flies down and lands on the ground\.$", 3) -- wait for message or 3 second timeout
Send ("shoge")
Send ("rune")
Send ("shoge")
Send ("shoge")
lastTriggerTime = os.time ()
end
end) -- end of wait.make
</send>
</trigger>
</triggers>
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Traz
(31 posts) Bio
|
| Date
| Reply #3 on Tue 16 Jan 2018 11:45 PM (UTC) Amended on Tue 16 Jan 2018 11:52 PM (UTC) by Traz
|
| Message
| Not sure what I'm not understanding but I keep getting some pretty lengthy compile errors. This is what I came up with.
<triggers>
<trigger
group="FriedTest"
match="* opens his mouth and fires a powerful blast at * that causes * to fall in pain!"
send_to="12"
sequence="100"
>
<send>require "wait"
if lastTriggerTime == nil or os.time () - lastTriggerTime >= 5 then
Send ("--")
Send ("assist caldar")
wait.make (function ()
Send ("shoge")
Send ("rune")
Send ("shoge")
Send ("shoge")
wait.regexp ("* flies down and lands on the ground.")
end)
lastTriggerTime = os.time ()
end</send>
</trigger>
</triggers>
edit: Just saw the reply above. Was testing it before I refreshed the page and saw that.
For clarification sake, what is the purpose of the symbols in the regexp? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Wed 17 Jan 2018 02:07 AM (UTC) |
| Message
| See the documentation about regular expressions: http://www.gammon.com.au/regexp
Basically:
^ <-- asserts (matches) start of line
.* <-- matches zero or more of any character
flies down and lands on the ground <-- matches itself literally
\. <-- matches a period
$ <-- asserts (matches) end of line
|
- 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.
19,344 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top