[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]  Python
. . -> [Subject]  Zmud <-> MC speedwalk converter.
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Zmud <-> MC speedwalk converter.

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

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Mon 18 Apr 2005 11:27 PM (UTC)

Amended on Tue 19 Apr 2005 12:45 AM (UTC) by Poromenos

This poorly commented piece of code will convert a MC speedwalk string to Zmud stacked dirs and vice-versa:

def fnConvertDirs(strDirs, strFormat = 0):
    """0: Zmud to MUSHclient
       1: MUSHclient to Zmud"""

    lstNewDirs = []
    if strFormat == 0:
        # Strip list items.
        lstDirs = map(string.strip, strDirs.split(";"))
        strRepeat = ""

        # Repeat commands as many times as required.
        for strCommand in lstDirs:
            if strCommand[0] == "#":
                for strLetter in strCommand[1:]:
                    if strLetter.isdigit():
                        strRepeat += strLetter
                        for intCounter in range(int(strRepeat)):
                        strRepeat = ""

        # Enclose long commands in parentheses.
        lstNewDirs = map(lambda x: len(x) > 1 and "(" + x + ")" or x, lstNewDirs)

        intOccurrenceCounter = 1
        lstDirs = []
        # Append an empty element so the following algorithm works.

        # Join adjacent same dirs in one ("n n" -> "2n").
        for intCounter in range(1, len(lstNewDirs)):
            if lstNewDirs[intCounter - 1] == lstNewDirs[intCounter]:
                intOccurrenceCounter += 1
                if intOccurrenceCounter > 1:
                    lstDirs.append(str(intOccurrenceCounter) + lstNewDirs[intCounter - 1])
                    lstDirs.append(lstNewDirs[intCounter - 1])
                intOccurrenceCounter = 1

        strTemp = ""
        strTimes = ""
        blnInCommand = False
        blnEvaluate = True
        for strLetter in strDirs:
            if strLetter == "(":
                blnInCommand = True
            elif strLetter == "/" and blnInCommand:
                blnEvaluate = False
            elif strLetter == ")" and blnInCommand:
                blnInCommand = False
                if strTimes != "":
                    lstNewDirs.append("#" + strTimes + " " + strTemp + ";")
                    lstNewDirs.append(strTemp  + ";")
                blnEvaluate = True
                strTimes = ""
                strTemp = ""
            elif strLetter.isdigit() and not blnInCommand:
                strTimes += strLetter
            elif strLetter.isspace() and not blnInCommand:
            elif blnInCommand:
                if blnEvaluate:
                    strTemp += strLetter
                if strTimes != "":
                    lstNewDirs.append("#" + strTimes + " " + strLetter + ";")
                    lstNewDirs.append(strLetter + ";")
                strTimes = ""
                strTemp = ""

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Nemix   (12 posts)  [Biography] bio
Date Reply #1 on Fri 30 Nov 2007 08:43 PM (UTC)
I'm more of a vbscript person, would anyone be willing to take the time to convert this to a plugin?, perhaps to send the speedwalk on an alias.
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Reply #2 on Mon 10 Dec 2007 09:25 PM (UTC)
I was making a Lua plugin for this a while ago. I gave up when I was getting odd errors with parsing the zMUD sws into MUSHclient sws. Works great going from a stored alias to a zMUD alias though. I do not normally use the speedwalk function for MUSHclient though, since the mud I play supports a faster "run" command, where you can just spit out "run 3n5w2s" and it will just show room names while zipping along faster than a normal walk delay.

I'll see if I can scrounge up the script and fix it up again.

It is much easier to fight for one's ideals than to live up to them.
[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.


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.


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]