<?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>
