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.
Entire forum
➜ MUSHclient
➜ Jscript
➜ JScript Enable Trigger after Speedwalk
JScript Enable Trigger after Speedwalk
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Mat
(14 posts) Bio
|
Date
| Sat 17 May 2014 12:57 PM (UTC) |
Message
| Is there any way to enable a trigger after the speedwalk completes? It's as if you'd be putting it into the queue so that when the command goes through the trigger is added, instead of immediately when you do enableTrigger.
I tried world.send(aliasname) which would put it in the queue, but the aliasname isn't recognized. It only works when I do world.execute(aliasname), yet that's done immediately.
To explain further, I have a trigger which detects exits. I want to disable this trigger, speedwalk somewhere, and enable the trigger after the speedwalk is complete. I can't use a timer or doafter because I'm not sure how long it will take.
Any help is appreciated :) | Top |
|
Posted by
| Nick Gammon
Australia (23,121 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 17 May 2014 08:49 PM (UTC) |
Message
| There doesn't seem to be a way to queue commands, which would help, because commands can be caught by aliases, which can then call a script. This plugin would add that ability:
|
To save and install the SpeedwalkCompleted plugin do this:
- Copy between the lines below (to the Clipboard)
- Open a text editor (such as Notepad) and paste the plugin into it
- Save to disk on your PC, preferably in your plugins directory, as SpeedwalkCompleted.xml
- Go to the MUSHclient File menu -> Plugins
- Click "Add"
- Choose the file SpeedwalkCompleted.xml (which you just saved in step 3) as a plugin
- Click "Close"
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="SpeedwalkCompleted"
author="Nick Gammon"
id="7aad77576345785635c646fe"
language="Lua"
purpose="Shows when a speedwalk completes"
date_written="2014-05-18 07:35:24"
requires="4.90"
version="1.0"
>
</plugin>
<!-- Script -->
<script>
<![CDATA[
function OnPluginSend (sText)
if sText == "SpeedwalkCompleted" then
Execute ("TellPlayerSpeedwalkCompleted")
return false -- do not send to the MUD
end -- if
return true -- process other commands
end -- function
]]>
</script>
</muclient>
If you install that, then whenever the client tries to send "SpeedwalkCompleted" to the MUD, it catches it and replaces it with executing "TellPlayerSpeedwalkCompleted".
Now make an alias to respond to that:
<aliases>
<alias
match="TellPlayerSpeedwalkCompleted"
enabled="y"
send_to="12"
omit_from_output="y"
sequence="100"
>
<send>
Note ("Execute some script here ...");
</send>
</alias>
</aliases>
|
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
That alias could re-enable your trigger (and send a message, or whatever).
Now to put it all together, make the speedwalk send the special word, eg.
#4n e s (SpeedwalkCompleted)
A word in brackets in a speedwalk is sent verbatim to the MUD. However in our case the plugin will catch that word, and it ends up calling the script as described above. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Mat
(14 posts) Bio
|
Date
| Reply #2 on Sun 18 May 2014 07:37 PM (UTC) |
Message
| Thanks for responding in such detail Nick.
I tried getting everything going on Mushclient, but whenever I do the speedwalk it executes the alias immediately. I left the TellPlayerSpeedwalkCompleted alias with the Note command and it sends the note right as I press enter, not after the speedwalk has completed. I'd imagine it would do the same with adding/enabling triggers.
I did have to change the minimum Mushclient version to 4.84 since I didn't have 4.90 and I couldn't find it on your downloads page, could that have affected it? | Top |
|
Posted by
| Nick Gammon
Australia (23,121 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 18 May 2014 09:00 PM (UTC) |
Message
| Later versions are here:
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=1
Do you have a speedwalk delay set up? If not, speedwalking is the same as sending (ie. there is no delay).
Note that the speedwalk commands might be sent faster than the MUD executes them. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Mat
(14 posts) Bio
|
Date
| Reply #4 on Tue 20 May 2014 07:58 PM (UTC) |
Message
| I see, that does work with the speedwalk delay.
I just have to make sure there isn't anything executed before the speedwalk that would delay the speedwalk from beginning as well as figuring out the correct ms for delay.
Thanks for your help Nick! | 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