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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Make it compatible with zmud / cmud dirs

Make it compatible with zmud / cmud dirs

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


Posted by Foldar   (5 posts)  [Biography] bio
Date Sun 23 Jan 2022 12:41 AM (UTC)

Amended on Sun 23 Jan 2022 01:07 AM (UTC) by Foldar

Message
zMUD: #9 w;sw;#4 w;s;sw;w;w;open s;s;s;sw;s;window
MUSHClient: #9w (sw) 4w s (sw) 2w (open s) 2s (sw) s (window)

Many people use zmud if they give me dirs it is mostly in zmud format. would be nice if i could paste it in mushclient
It is a whole lot of typing to adjust it.
[Go to top] top

Posted by Nick Gammon   Australia  (23,002 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 23 Jan 2022 06:25 AM (UTC)
Message
Is there really a # in the middle like that? As in #4?

You can make an alias with a bit of scripting to convert them. For example:


<aliases>
  <alias
   match="#*"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>

-- extract out each direction
local directions = utils.split ("%1", ";")

local t = { } -- for converted results

for k, v in ipairs (directions) do

  count, remainder = string.match (Trim (v), "^(%d+)%s*(.+)$")

  if count then
    directions = remainder
  else
    count = ""
    remainder = v
  end -- if

  remainder = Trim (remainder) -- remove spaces

  if #remainder &gt; 1 then
    remainder = "(" .. remainder .. ")"
  end -- if more than one letter


  table.insert (t, count .. remainder)

end -- for each direction

Send (EvaluateSpeedwalk (table.concat (t, "")))

</send>
  </alias>
</aliases>


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


Turn off speedwalking in the Input configuration -> Commands, and let the alias do it instead. I haven't allowed for the "#" in the middle as I thought that might just be a typo.

If it isn't you can get rid of it, eg.


remainder = string.gsub (remainder, "#", '')


After the line with "remove spaces" on it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


5,739 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 HostDash]