How can I change the default behavior for speedwalking?

Posted by Yanwuhuan on Wed 22 Oct 2008 06:42 AM — 3 posts, 14,462 views.

#0
In my game, server accepts 'n' as 'go north', and 's' as 'go south'.
In some rooms which no special direction, like 'north' will not be recognized, but 'n'.
So game return: "What? unknown command" for "north", not "there is no this direct." which I want, "n" can get this prompt.

For examplem: #2s3n
Mushclient will execute them as "south;south;north;north;north".
I want change them to "n;n;s;s;s".

Any way to do this?

Thanks in advance!
Australia Forum Administrator #1
The simplest thing is to install the plugin below. This looks for the problem words as a single command being sent to the MUD, and substitutes the correct one instead. Other text is left alone.

Template:saveplugin=Speedwalk_Fixer
To save and install the Speedwalk_Fixer plugin do this:
  1. Copy the code below (in the code box) to the Clipboard
  2. Open a text editor (such as Notepad) and paste the plugin code into it
  3. Save to disk on your PC, preferably in your plugins directory, as Speedwalk_Fixer.xml
    • The "plugins" directory is usually under the "worlds" directory inside where you installed MUSHclient.
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file Speedwalk_Fixer.xml (which you just saved in step 3) as a plugin
  7. Click "Close"
  8. Save your world file, so that the plugin loads next time you open it.



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, October 23, 2008, 7:48 AM -->
<!-- MuClient version 4.37 -->

<!-- Plugin "Speedwalk_Fixer" generated by Plugin Wizard -->

<muclient>
<plugin
   name="Speedwalk_Fixer"
   author="Nick Gammon"
   id="2fa39133624dd86581e3b846"
   language="Lua"
   purpose="Modifies 'north' to be 'n' and so on"
   date_written="2008-10-23 07:44:13"
   requires="4.00"
   version="1.0"
   >
<description trim="y">
<![CDATA[
This modifies any directions like "north", "south" sent to the MUD
and replaces then with "n", "s" and so on.
]]>
</description>

</plugin>


<!--  Script  -->


<script>
<![CDATA[
local conversions = {
  north = "n",
  south = "s",
  east  = "e",
  west  = "w",
  up    = "u",
  down  = "d",
  }

function OnPluginSend (sText)

  -- lookup conversion
  local fixed = conversions [sText]

  if fixed then  -- if found use that
    Send (fixed)
    return false -- do not send original text
  end -- if

  return true  -- send original

end -- function


]]>
</script>


</muclient>
Amended on Mon 09 Aug 2010 10:18 PM by Nick Gammon
#2

It works.
Yes, it's what I want.
Thanks a million.