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

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Jscript
. . -> [Subject]  JScript Enable Trigger after Speedwalk
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

JScript Enable Trigger after Speedwalk

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Mat   (14 posts)  [Biography] 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 :)
[Go to top] top

Posted by Nick Gammon   Australia  (21,323 posts)  [Biography] 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:

Template:saveplugin=SpeedwalkCompleted To save and install the SpeedwalkCompleted plugin do this:
  1. Copy between the lines below (to the Clipboard)
  2. Open a text editor (such as Notepad) and paste the plugin into it
  3. Save to disk on your PC, preferably in your plugins directory, as SpeedwalkCompleted.xml
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file SpeedwalkCompleted.xml (which you just saved in step 3) as a plugin
  7. 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>


Template:pasting 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
[Go to top] top

Posted by Mat   (14 posts)  [Biography] 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?
[Go to top] top

Posted by Nick Gammon   Australia  (21,323 posts)  [Biography] 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
[Go to top] top

Posted by Mat   (14 posts)  [Biography] 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!
[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.


3,236 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 FutureQuest]