Register forum user name Search FAQ

Gammon Forum

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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ Simple speedwalk reverse

Simple speedwalk reverse

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


Posted by Bradley   (7 posts)  Bio
Date Sat 10 Aug 2002 09:45 AM (UTC)
Message
I've looked about the help files to see if there is a way of simply reversing speedwalking. There is in the mapper but one that could be easily used within on the command line would be nice.

eg the following speedwalk
#n4wes
could be reversed by
##n4wes

the ## simply tells mushclient to reverse the speedwalk so n4wes becoems s4ewn
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 10 Aug 2002 10:40 AM (UTC)
Message
You can do it with some command-line scripting, like this:


/world.send world.ReverseSpeedwalk ("#n4wes")


However if that seems a bit tedious, you could make a simple alias (eg. "## *") that did exactly that in a script.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Sat 10 Aug 2002 11:06 AM (UTC)

Amended on Sat 10 Aug 2002 10:48 PM (UTC) by Nick Gammon

Message
My earlier answer is a bit incorrect, you need to evaluate the speedwalk as well as reversing it, that would just send the reversed speedwalk to the MUD.

However to make a more general reply, here is a small plugin which will do the trick, with a bit of error detection (it won't send a bad speedwalk string). Just copy everything below the line and paste it into a text file, save it as "reverse_speedwalk.xml" and put into your plugins directory.

Alternatively, download it from:


http://www.mushclient.com/plugins/reverse_speedwalk.xml


(Amended - version 2 - below)




<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient 
  [
  <!ENTITY speedwalk_alias "#" > 
  <!ENTITY reverse_speedwalk_alias "##" >   
  <!ENTITY echo_speedwalk "-1" >   
  ]>
<!-- Saved on Saturday, August 10, 2002, 9:00 PM -->
<!-- MuClient version 3.25 -->

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

<!--
Written for forum posting "Simple speedwalk reverse", see:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1617

Customise by changing the ENTITY definitions above.

Default is:

#  <speedwalk>   <- do a speedwalk
## <speedwalk>   <- do a reverse speedwalk

You could change that, say if you wanted /w to be a speedwalk, and /r
to be a reverse speedwalk, change the entity above (in the DOCTYPE header)
to:

  <!ENTITY speedwalk_alias "/w" > 
  <!ENTITY reverse_speedwalk_alias "/r" >   

If you do not want the actual speedwalk command echoed in the output window,
change the entity above (in the DOCTYPE header) to:

  <!ENTITY echo_speedwalk "0" >   

-->

<muclient>
<plugin
   name="Reverse_Speedwalk"
   author="Nick Gammon"
   id="bc3d7990489bf6e3fa6d847e"
   language="VBscript"
   purpose="Takes a speedwalk string and sends it, reversed"
   date_written="2002-08-10 20:56:54"
   requires="3.24"
   version="2.0"
   >
<description trim="y">
This provides a simple alias &quot;&reverse_speedwalk_alias;&quot; that sends a reversed
speedwalk to the MUD.

eg.

&reverse_speedwalk_alias; 2s 3e

Would send:
 w
 w
 w
 n
 n

Usage:

&speedwalk_alias; &lt;speedwalk string&gt;     &lt;-- normal speedwalk
&reverse_speedwalk_alias; &lt;speedwalk string&gt;    &lt;-- reverse speedwalk
reverse_speedwalk:help   &lt;-- this help screen

</description>

</plugin>


<!--  Aliases  -->

<aliases>
  <alias
   script="On_Normal_Speedwalk"
   match="&speedwalk_alias; *"
   enabled="y"
  >
  </alias>
  <alias
   script="On_Reverse_Speedwalk"
   match="&reverse_speedwalk_alias; *"
   enabled="y"
  >
  </alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[

' -----------------------------------
' Normal Speedwalk 
' -----------------------------------

Sub On_Normal_Speedwalk (aliasname, full_line, wildcards)

dim speedwalk
'
'  echo speedwalk on screen
'
]]>
  If &echo_speedwalk; Then
<![CDATA[
  world.ColourNote _
   World.RGBColourToName (World.CustomColourText(World.GetOption("echo_colour"))), _
   World.RGBColourToName (World.CustomColourBackground(World.GetOption("echo_colour"))), _
   wildcards (10)
  End If
'
'  Evaluate it  
'
  
  speedwalk = world.EvaluateSpeedwalk (wildcards (1))
'
'  If first character is an asterisk, there was an error in the speedwalk string
'

  if Left (speedwalk, 1) = "*" then
     world.ColourNote "red", "lightblue", speedwalk
     exit sub
  end if
'
'  Otherwise, send it
'
  world.Send speedwalk

End Sub

' -----------------------------------
' Reverse Speedwalk 
' -----------------------------------

Sub On_Reverse_Speedwalk (aliasname, full_line, wildcards)

dim speedwalk
'
'  echo speedwalk on screen 
'
]]>
  If &echo_speedwalk; Then
<![CDATA[
  world.ColourNote _
   World.RGBColourToName (World.CustomColourText(World.GetOption("echo_colour"))), _
   World.RGBColourToName (World.CustomColourBackground(World.GetOption("echo_colour"))), _
   wildcards (10)
  End If
'
'  Reverse it  
'
  
  speedwalk = world.ReverseSpeedwalk (wildcards (1))
'
'  If first character is an asterisk, there was an error in the speedwalk string
'

  if Left (speedwalk, 1) = "*" then
     world.ColourNote "red", "lightblue", speedwalk
     exit sub
  end if
'
'  Otherwise, evaluate and send it
'
  world.Send world.EvaluateSpeedwalk (speedwalk)

End Sub

' -----------------------------------
' On installation, disable built-in speedwalk 
' -----------------------------------

dim Original_Enable_Speedwalk_Option

Sub OnPluginInstall
   Original_Enable_Speedwalk_Option = _
       world.GetCurrentValue ("enable_speed_walk")
   world.SetOption "enable_speed_walk", 0
   world.DoAfterNote 1, "Plugin " & world.getpluginname & " installed."
   world.DoAfterNote 1, "Version number " & _
       world.getplugininfo (world.getpluginid, 19)
End Sub

' -----------------------------------
' On exit, re-enable built-in speedwalk (if originally enabled)
' -----------------------------------

Sub OnPluginClose
   world.SetOption "enable_speed_walk", Original_Enable_Speedwalk_Option
End Sub

]]>
</script>


<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="reverse_speedwalk:help"
   enabled="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[
Sub OnHelp (sName, sLine, wildcards)
  World.Note World.GetPluginInfo (World.GetPluginID, 3)
End Sub
]]>
</script> 

</muclient>

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 10 Aug 2002 10:48 PM (UTC)
Message
My earlier plugin would not work properly as I realised afterwards. The problem is that if you had 'normal' speedwalking enabled, and set to "#" then the 'normal' speedwalk would intercept '##' which would not reach the plugin.

Thus, the solution is to disable built-in speedwalking, and handle both the normal and reverse case in the plugin.

The new version (above) now does that. It has two aliases, "#" and "##" for normal and reverse, respectively.

Also, it is more customisable, by changing the lines


<!ENTITY speedwalk_alias "#" >
<!ENTITY reverse_speedwalk_alias "##" >


(right near the start) you can alter the speedwalk match string to be something else (eg. /w and /r).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Bradley   (7 posts)  Bio
Date Reply #4 on Sun 11 Aug 2002 05:07 PM (UTC)
Message
Hey thanks for that. Prompt reply too =)
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.


21,209 views.

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

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.