<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, November 06, 2002, 9:25 AM -->
<!-- MuClient version 3.30 -->

<!-- Plugin "TargetSwitch" generated by Plugin Wizard -->

<!--


See: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1947
-->

<muclient>
<plugin
   name="TargetSwitch"
   author="Nick Gammon"
   id="2adec0ac37689537f9e3daf2"
   language="VBscript"
   purpose="Demonstrates switching targets"
   save_state="y"
   date_written="2002-11-06 09:20:06"
   requires="3.23"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Demonstrates how you can switch targets with a couple of aliases.

Usage
-----

t1 = person   (set target 1)
t2 = person   (set target 2)
t3 = person   (set target 3)  ... and so on up to 9 ...

t1            (choose target 1)
t2            (choose target 2)
t3            (choose target 3) ... and so on up to 9 ...

punch         (punch target)
kick          (kick target)

eg.

t1=Bill        (target 1 is Bill)
t2=Benjamin    (target 2 is Benjamin)
t1             (choose Bill)
kick           (kick Bill)
t2             (choose Benjamin)
kick           (kick Benjamin)
t1             (choose Bill again)
punch          (punch Bill)
kick           (kick Bill)
t2             (choose Benjamin again)
punch          (punch Benjamin)
kick           (kick Benjamin)


TargetSwitch:help  <-- this help
]]>
</description>

</plugin>


<!--  Aliases  -->

<aliases>
  <alias
   script="SetTarget"
   match="^t([1-9])\s*\=\s*(.+)$"
   enabled="y"
   regexp="y"
  >
  </alias>
  <alias
   script="ChooseTarget"
   match="^t([1-9])$"
   enabled="y"
   regexp="y"
  >
  </alias>
  <alias
   match="^(kick|punch|stab)"
   enabled="y"
   expand_variables="y"
   regexp="y"
  >
  <send>%1 @target</send>
  </alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[
sub SetTarget (sName, sLine, wildcards)
dim which, to_whom
  which = wildcards (1)
  to_whom = wildcards (2)
  world.SetVariable "target" & which, to_whom
  world.ColourNote "moccasin", "darkgreen", _
                   "Target " & CStr (which) & " now '" & to_whom & "'"
end sub

sub ChooseTarget (sName, sLine, wildcards)
  world.SetVariable "target", _
                    world.GetVariable ("target" & wildcards (1))
  world.ColourNote "moccasin", "darkgreen", _
                   "Target now '" & _
                   world.GetVariable ("target") & "'"  
end sub


]]>
</script>


<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="TargetSwitch:help"
   enabled="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[
Sub OnHelp (sName, sLine, wildcards)
  World.Note World.GetPluginInfo (World.GetPluginID, 3)
End Sub
]]>
</script> 

</muclient>
