<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, August 09, 2002, 1:00 PM -->
<!-- MuClient version 3.25 -->

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

<muclient>
<plugin
   name="msp"
   author="Nick Gammon"
   id="7da63d78d9f91bebb5285127"
   language="VBscript"
   purpose="Emulates MSP (MUD Sound Protocol)"
   save_state="y"
   date_written="2002-08-09 12:58:11"
   requires="3.24"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Type: "msp:help" to see this help.

See: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=783 for a more complete description.

You will need to get the sound files manually (ie. from the MUD) and install them before using this. The plugin is configured to look for them in c:\mushclient\msp, but you can change that by typing:

  set_msp_path new_path

eg.

  set_msp_path d:\muds\mushclient\msp

You may need to enable MSP manually, as this plugin does not do telnet negotiation. eg. On Dawn Of Time MUDs, type:

msp on

]]>
</description>

</plugin>


<!--  Get our standard constants -->

<include name="constants.vbs"/>

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   match="^(.*)\!\!SOUND\(([A-Za-z0-9./]+).*\)(.*)$"
   name="sound"
   omit_from_output="y"
   regexp="y"
   script="OnSound"
   sequence="100"
  >
  </trigger>
</triggers>

<!--  Aliases  -->

<aliases>
  <alias
   script="On_set_MSP_path"
   match="set_msp_path *"
   enabled="y"
  >
  </alias>
</aliases>

<!--  Variables  -->

<variables>
  <variable name="msp_path">c:\mushclient\msp\</variable>
</variables>

<!--  Script  -->


<script>
<![CDATA[
'
' Trigger script to simulate MSP (MUD Sound Protocol)
'

sub OnSound (strName, strLine, aryWildcards) 
dim sBefore, sSound, sAfter, iColourFore, iColourBack

' extract text from wildcards
' wildcard 1 is the text before the sound
' wildcard 2 is the sound file name
' wildcard 3 is the text after the sound

 sBefore = aryWildcards (1) ' what arrived before the !!SOUND directive
 sSound = replace (aryWildcards (2), "/", "\") ' sound file to play
 sAfter = aryWildcards (3) ' what arrived after the !!SOUND directive

' play sound - directory in variable
 
 world.Sound (world.getvariable ("msp_path") & sSound)

' remember current world.note colours

 iColourFore = world.notecolourfore 
 iColourBack = world.notecolourback 

' set note colour to default text colour

 world.NoteColourRGB world.NormalColour (8), world.NormalColour (1)

' display the text surrounding the sound

 world.note sBefore & sAfter

' set note colour back to what it was

 world.NoteColourRGB iColourFore, iColourBack

end sub

sub On_set_MSP_path (strName, strLine, aryWildcards) 

dim sPath

  sPath =  aryWildcards (1)

'
'  ensure trailing backslash
'
  
  if right (sPath, 1) <> "\" then
     sPath = sPath & "\"
  end if

  world.setvariable "msp_path", sPath 
  world.note "MSP sound files will be obtained from " & _
             sPath 
end sub


]]>
</script>


<!--  Plugin help  -->

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

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

</muclient>
