MSP_lua.xml issue

Posted by Llarn on Thu 15 Mar 2018 01:31 AM — 6 posts, 23,935 views.

#0
Hi there,

This might be in wrong spot, sorry if that is the case, but am pulling my hair out trying to get msp_lua.xml plug-in to work.

I have set_msp_path correct.

ERROR: Cannot open the specified file playing C:/Mush-z/worlds/6dragons/sounds/sound/player.wav

That is actually where the player files are. But it won't play.

Any idea what I'm doing wrong?

Llarn
#1
Well this is the plug-in I got. Problem probably is I'm using really old stuff, cause haven't mudded in many years, than come back and I'm shocked I can't get crap to work. I'd appreciate any help to get it to work though. Really path is exactly dead on and that is the only error I get.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="MSP_Lua"
   author="Nick Gammon"
   id="7da63d78d9f91bebb5285127"
   language="Lua"
   purpose="Emulates MSP (MUD Sound Protocol)"
   save_state="y"
   date_written="2014-08-10 15:43"
   requires="4.54"
   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 the "sounds" directory of the MUSHclient installation,
but you can change that by typing:

  set_msp_path new_path

eg.

  set_msp_path d:\muds\mushclient\msp

]]>

</description>

</plugin>


<!--  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>
  
  <alias
   script="OnHelp"
   match="msp:help"
   enabled="y"
  >
  </alias>

</aliases>

<!--  Script  -->

<script>
<![CDATA[

function fSound (filename)
  local result = PlaySound (0, GetVariable ("msp_path") .. filename)
  if result ~= error_code.eOK then
    ColourNote ("red", "", "ERROR: " .. error_desc [result] .. " playing " .. GetVariable ("msp_path") .. filename)
  end -- if
  return "" -- omit MSP stuff from output
end -- function fSound

-- handle a line with !!SOUND in it
function OnSound (name, line, wildcards, styles) 

	-- echo existing line with colours, sending !!SOUND part to a function
  for _, v in ipairs (styles) do
    local text = string.gsub (v.text, "!!SOUND%(([%a%d./]+).-%)", fSound)
    ColourTell (RGBColourToName (v.textcolour), 
                  RGBColourToName (v.backcolour), 
                  text)  
  end -- for each style run

  Note ("") -- finish the line
end -- function OnSound

-- change desired sound file path
function On_set_MSP_path (name, line, wildcards) 
  local path =  wildcards [1]
  
  --  ensure trailing backslash
  if string.sub (path, -1) ~= "" then
     path = path .. "/"
  end -- if

  SetVariable ("msp_path", path) 
  print ("MSP sound files will be obtained from " .. path)
end -- function On_set_MSP_path

-- do telnet negotiation
function OnPluginTelnetRequest (type, data)
  if type == 90 and data == "WILL" then
    return true -- IAC DO MSP
  else
    return false
  end -- if
end -- function OnPluginTelnetRequest

-- show help
function OnHelp ()
  print (GetPluginInfo (GetPluginID (), 3))
end -- function OnHelp

-- use supplied path or default
msp_path = GetVariable ("msp_path") or GetInfo (74)

]]>
</script> 

</muclient>
Amended on Thu 15 Mar 2018 03:25 AM by Nick Gammon
Australia Forum Administrator #2
Can you please use a "command" window to prove the files are where you think they are? Navigate to the directory where you put them and type DIR, for example:


C:\Program Files\MUSHclient\sounds>dir
 Volume in drive C has no label.
 Volume Serial Number is 44D9-94D6

 Directory of C:\Program Files\MUSHclient\sounds

11/08/2014  08:39 PM    <DIR>          .
11/08/2014  08:39 PM    <DIR>          ..
27/07/2009  04:44 PM           136,192 backstab1.wav
24/05/2010  08:22 AM           140,364 Cartoon Timpani.wav
28/02/2006  11:00 PM           171,100 tada.wav

C:\Program Files\MUSHclient\sounds>


Then copy the results and paste them here.
#3
Unfortunately, the forums won't let me do any attachments on forums. Guess I don't have permission?

I was going to screen shot it for you.

/Mush-z/worlds/6dragons/sounds/sound
#4
Nick,

Figured it out.

I was using playaswindows wine software for linux. It was showing me as C:/ for running mush, however set_msp_path would not be fooled it still demanded home/Mush-z/sound

Thanks for the great software!

Llarn
Australia Forum Administrator #5
I don't let anyone attach files to the forum, except for administrators. That keeps out spam, porn, and other crap.

Glad you figured it out. It usually works quite well under Linux.