 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Thu Nov 29, 2007 10:58 pm
cMUD and XML for Remote Control of WinAMP |
Ok, I'm not sure what all XML support cMUD incorporates, but I found this:
http://www.winamp.com/plugins/details/171312
So, if XML-rpc support is something that cMUD is capable of.. then I would
like to possibly write up the control script for WinAMP (as seen in the zMUD
Finished Scripts using the WinAMP COM Server - but better) in cMUD to be
able to control music play without ever leaving the MUD window.
If not, does anyone have any ideas on how to do this otherwise? |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Nov 29, 2007 11:17 pm |
XML-RPC has precious little to do with vanilla XML. At the risk of over-explaining, XML is basically just HTML where you make up your own tags, so it's suited to many applications. CMUD and XML-RPC both use XML, but so does the World of Warcraft user interface, and the three have very little to do with one another. CMUD can't send customised HTTP data, so you won't be able to construct an XML-RPC file to send to the XML-RPC server you'd be using to control Winamp.
With that said, however, it looks like that plugin also supports COM, and CMUD does indeed support COM. You should be able to use that (or another Winamp plugin that adds COM - there are a few if I recall) to control Winamp from CMUD in much the same way that the zMUD version does. |
|
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Thu Nov 29, 2007 11:39 pm |
I just dislike COM ;)
And yes I know about the differences, thats why I asked if cMUD COULD or not :)
Couldn't we use the #FILE/#WRITE to write a custom XML-rpc file? |
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Nov 29, 2007 11:58 pm |
You could, yes, but again, CMUD has no way of sending that customised HTTP data. Apart from (presumably) things like updating the mud list and package libraries, CMUD's incapable of sending HTTP data.
I personally don't really have a preference about COM, but I'm perplexed why people have this fixation with controlling apps from within other apps. Someone previously asked for a dockable web-browser in CMUD, which I thought was a little bizarre. Similarly, to control Winamp while also playing MUDs you can move it so it takes up the top part of the screen (so you don't miss any action on the MUD as it comes in) and alt-tab or start bar to Winamp. Or use winamp's rolled-up mode and put it in the title bar, which CMUD doesn't do anything with anyway. Or use Winamp's built in global hotkeys, which is what I do for my mp3 player of choice when alt-tabbing isn't an option, like while playing full-screen games.
Remote access I can understand a bit better - being able to control what my speakers in my bedroom are playing through my laptop while in the kitchen cooking would be awesome. But while I'm at the computer, it's cake to alt-tab. |
|
|
|
 |
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Thu Nov 29, 2007 11:58 pm |
Sure you can write an XML file with CMUD using #FILE or #WRITE. What are you going to use to do the http transfer afterwards?
[EDIT:] Ninja'd by Fang, we posted in the same minute though  |
|
_________________ Taz :) |
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Fri Nov 30, 2007 2:41 am |
Well... see Fang thats exactly it. I want to control the WinAMP on my desktop which outputs to my STEREO from my laptop which I MUD from anywhere in the house.
As for sending it, I have another program that I can configure to check for the file every so often (30 seconds is what I'm thinking, a small delay is fine) that will http the file for me.
IF that is how the XML-rpc sends its commands to its server... I haven't actually researched the protocol :) |
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Nov 30, 2007 2:54 am |
I didn't have much more than a glance at it and seems like that's how it works. Though it seems more sensible to me to find or build a proper client for XML-RPC than to jimmy one together using CMUD and another program.
|
|
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sat Dec 01, 2007 5:31 am |
This is true. The same plugin does also support COM via Network.. but as I said I don't like COM. Just personal taste, but if I could do the XML-RPC it could be used for other things.
For cross platform things. Such as controlling stuff on my Linux Boxen. Which I'm porting EVERYTHING except a few things (like MUDDING since I prefer zMUD/CMUD to ANY linux client) over to Linux. My music is already all ported, but its also on my last WinXP desktop. So for now I could COM to that and control. But I'd prefer doing something that my Linux machine can understand, and Linux+COM isn't a good proposition :) |
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Dec 10, 2007 7:00 pm |
Nah, would be easier for Zugg to simply include an #httpsend command since he already HAS the code for it (the error report send code is http from what I've read) and then it would be natively supported.
|
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Dec 10, 2007 8:27 pm |
Hmm, except that the crash reporter is a third-party component called MadExcept, and so the methods that it uses for its exception reporting might not be available to CMUD in general. This is a pretty niche use, but I guess it's something to think about.
|
|
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Mon Dec 10, 2007 10:07 pm |
I guess you can wait for zugg to impl something that you want.
Or if you want it enough use the tools he's already given you, I'm just supplying options. |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Tue Dec 11, 2007 1:51 am |
If you are using CMUD 2.++ and would use a XML-RPC client but just don't want to do most of the legwork..
I would be willing upgrade to 2.++ and give a go at creating a script that should do most of what you want.
XML-RPC clients are pretty easy using Python and a quick glance at that luaxmlrpc site indicates it wouldn't be too complicated in Lua either.
It'll give me a reason to learn Lua.
Your original post indicated you were looking for suggestions on how go about doing it, and this seems like a pretty good way to get it done.
Let me know! no point in writing it if nobody is gonna use it:) |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Tue Dec 11, 2007 2:45 am |
I finally bothered to read some of the documentation on this and it actually looks rather simple. I think Dharkael is right the best way to go for putting this into CMud is by way of the Lua interface. Zugg still has to document everything he did with connecting Lua in, but I understand it has more support for plugin ability then the COM API ever offered.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Dec 11, 2007 3:53 am |
I haven't actually tested plugins with CMUD. Hopefully it'll be as simple as dropping the dll in the CMUD folder and require()ing it in an OnConnect event. I'll be interested to know how this works out for anyone who tries.
|
|
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Tue Dec 11, 2007 5:13 am |
Well... I just didn't want to learn Lua lol, I've enough on my platter atm. But sure Dharkael if you want to try I'd love to TEST for you as much as possible :)
|
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Sun Dec 16, 2007 10:58 am |
Okay I got a basic XML-RPC remote control module working.
Unfortunately I had to jump through a few hoops to get everything to work.
I have a pageful of instructions needed to get the enviroment ready to run the CMUD module.
Also what's the best way for me to make the module avail?
Should I just paste the intructions and the XML code for the module? |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Dec 16, 2007 2:22 pm |
Or add it to the package library with instructions...
Either is fine for me. |
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Sun Dec 16, 2007 7:02 pm Play by Play of how I got the winamp xmlrpc to work |
Installed CMUD 2.18
Created 2 subfolders in the CMUD Dir "lua" and "lua_c"
created 3 enviroment variables
CMUD_PATH:<Path to wherever you have CMUD installed>
LUA_CPATH: ?;?.dll;%CMUD_PATH%\lua_c\?.dll;
LUA_PATH: ?;?.lua;%CMUD_PATH%\lua\?.lua;%CMUD_PATH%\lua\?\?.lua
downloaded luasocket-2.0.1-win32.zip from http://luaforge.net/frs/?group_id=23
as per install instructions on luasocket homepage @ http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/installation.html
emptied contents of hte zipfile's lib folder into my lua_c folder and of the zipfile's lua folder into my lua folder
[easy so far here's where the problems start"]
in CMUD command line with lua interpretor tried
require("socket.http")
"error loading module 'socket.core' from file 'E:\Program Files\CMUD\lua_c\socket\core.dll': The specified module could not be found. (line 0).
After doing some research I discovered that this problem has to do with the luasocket dll's not being trying to do stuff with with the lua dll and looking for 1 named lua5.1.dll (if I changed the name of the DLL then CMUD would not be able to find the dll, I also discovered this was a common thing with some dll's looking for lua51.dll and others lua5.1.dll
- Searched and found a more permanent solution(google "lua forwarding")
using info from this site:> http://lua-users.org/wiki/LuaProxyDllThree
I created a forwarding DLL named lua5.1.dll that forwarding all calls to lua5.1.dll to our dll lua.dll this dll. the dll can be created without writing a single line of c or c++ code :)
You do however need to have a compiler installed to make the dll the script uses GCC or Visual C++
you can find a free VC++ compiler here http://www.microsoft.com/express/vc/Default.aspx
Instead of running os.execute I just printed out the string being passed to it and and created a batchfile name makeforwardlib.bat and used that.
to get it to work
[This last part seems like a great deal of trouble but if you're going to be requiring another libraries in your CMUD lua scripts or just your general lua code
you'll probably find you need to do this sooner rather than late and it only needs to be done once.]
verify that there is a dll in your cmud folder now called lua5.1.dll [it also makes lua5.1.lib and lua5.1.exp, but we dont need those]
open cmud and using the lua interpreter
try require("socket.http") no errors this time socket.http is in and this alone is worth the effort the luasocket library will no doubt prove to be quite useful in the future.
Okay luasockets is in.
Next we need luaexpat its homepage is here http://www.keplerproject.org/luaexpat/index.html
and the files to download can be found here http://luaforge.net/frs/?group_id=13
I downloaded luaexpat-1.1.win32-lua51.zip
put lxp.dll into your LUA_CPATH folder
put libexpat.dll into the CMUD install folder, the one with CMUD.exe and lua.dll
put the contents of lua folder into your LUA_PATH folder
now we need to install xmlrpc its homepage is here http://www.keplerproject.org/luaxmlrpc/
the files can be found here http://luaforge.net/frs/?group_id=16
download luaxmlrpc-1.0a.zip
in your LUA_PATH folder create a folder named xmlrpc
and put the files xmlrpc.lua http.lua and cgi.lua into this folder.
unfortunately the xmlrpc library doesn't work out of the box, I had to modify it a little.
In the xmlrpc.lua file, near the beginning, about 18 or so lines in make the following changes>
Find the line with the following: module (arg and arg[1])
Comment out this line by putting two successive hyphens at the beginning. The line should now look like:
-- module (arg and arg[1])
then just below enter the following line:
xmlrpc = {}
okay now save the file.
Okay now we're ready to actually writing some code to take advantage of all this work. |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Last edited by Dharkael on Sun Dec 16, 2007 10:52 pm; edited 1 time in total |
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Sun Dec 16, 2007 7:09 pm Use makeforwardlib.bat to create a forwarding DLL |
Okay this little BATCH script creates a DLL that forwards calls to lua5.1.dll to zmuds lua.dll.
It works with Visual C++ a free version can be downloaded from
http://www.microsoft.com/express/vc/Default.aspx
after installing it make sure that there exist an enviroment variable called VCPATH that points to the bin directory that contains link.exe
if one doesn't exist create it.
On my system %VCPATH% evals to E:\Program Files\Microsoft Visual Studio 8\VC\bin
Okay here's the contents of makeforwardlib.bat:
| Code: |
call "%VCPATH%\vcvars32.bat"
"%VCPATH%\link.exe" -dll -nologo -noentry -machine:X86 -incremental:no -nodefaultlib -out:"%CMUD_PATH%\lua5.1.dll" -implib:"%CMUD_PATH%\lua5.1.lib" /export:luaL_addlstring=lua.luaL_addlstring /export:luaL_addstring=lua.luaL_addstring /export:luaL_addvalue=lua.luaL_addvalue /export:luaL_argerror=lua.luaL_argerror /export:luaL_buffinit=lua.luaL_buffinit /export:luaL_callmeta=lua.luaL_callmeta /export:luaL_checkany=lua.luaL_checkany /export:luaL_checkinteger=lua.luaL_checkinteger /export:luaL_checklstring=lua.luaL_checklstring /export:luaL_checknumber=lua.luaL_checknumber /export:luaL_checkoption=lua.luaL_checkoption /export:luaL_checkstack=lua.luaL_checkstack /export:luaL_checktype=lua.luaL_checktype /export:luaL_checkudata=lua.luaL_checkudata /export:luaL_error=lua.luaL_error /export:luaL_findtable=lua.luaL_findtable /export:luaL_getmetafield=lua.luaL_getmetafield /export:luaL_gsub=lua.luaL_gsub /export:luaL_loadbuffer=lua.luaL_loadbuffer /export:luaL_loadfile=lua.luaL_loadfile /export:luaL_loadstring=lua.luaL_loadstring /export:luaL_newmetatable=lua.luaL_newmetatable /export:luaL_newstate=lua.luaL_newstate /export:luaL_openlib=lua.luaL_openlib /export:luaL_openlibs=lua.luaL_openlibs /export:luaL_optinteger=lua.luaL_optinteger /export:luaL_optlstring=lua.luaL_optlstring /export:luaL_optnumber=lua.luaL_optnumber /export:luaL_prepbuffer=lua.luaL_prepbuffer /export:luaL_pushresult=lua.luaL_pushresult /export:luaL_ref=lua.luaL_ref /export:luaL_register=lua.luaL_register /export:luaL_typerror=lua.luaL_typerror /export:luaL_unref=lua.luaL_unref /export:luaL_where=lua.luaL_where /export:lua_atpanic=lua.lua_atpanic /export:lua_call=lua.lua_call /export:lua_checkstack=lua.lua_checkstack /export:lua_close=lua.lua_close /export:lua_concat=lua.lua_concat /export:lua_cpcall=lua.lua_cpcall /export:lua_createtable=lua.lua_createtable /export:lua_dump=lua.lua_dump /export:lua_equal=lua.lua_equal /export:lua_error=lua.lua_error /export:lua_gc=lua.lua_gc /export:lua_getallocf=lua.lua_getallocf /export:lua_getfenv=lua.lua_getfenv /export:lua_getfield=lua.lua_getfield /export:lua_gethook=lua.lua_gethook /export:lua_gethookcount=lua.lua_gethookcount /export:lua_gethookmask=lua.lua_gethookmask /export:lua_getinfo=lua.lua_getinfo /export:lua_getlocal=lua.lua_getlocal /export:lua_getmetatable=lua.lua_getmetatable /export:lua_getstack=lua.lua_getstack /export:lua_gettable=lua.lua_gettable /export:lua_gettop=lua.lua_gettop /export:lua_getupvalue=lua.lua_getupvalue /export:lua_insert=lua.lua_insert /export:lua_iscfunction=lua.lua_iscfunction /export:lua_isnumber=lua.lua_isnumber /export:lua_isstring=lua.lua_isstring /export:lua_isuserdata=lua.lua_isuserdata /export:lua_lessthan=lua.lua_lessthan /export:lua_load=lua.lua_load /export:lua_newstate=lua.lua_newstate /export:lua_newthread=lua.lua_newthread /export:lua_newuserdata=lua.lua_newuserdata /export:lua_next=lua.lua_next /export:lua_objlen=lua.lua_objlen /export:lua_pcall=lua.lua_pcall /export:lua_pushboolean=lua.lua_pushboolean /export:lua_pushcclosure=lua.lua_pushcclosure /export:lua_pushfstring=lua.lua_pushfstring /export:lua_pushinteger=lua.lua_pushinteger /export:lua_pushlightuserdata=lua.lua_pushlightuserdata /export:lua_pushlstring=lua.lua_pushlstring /export:lua_pushnil=lua.lua_pushnil /export:lua_pushnumber=lua.lua_pushnumber /export:lua_pushstring=lua.lua_pushstring /export:lua_pushthread=lua.lua_pushthread /export:lua_pushvalue=lua.lua_pushvalue /export:lua_pushvfstring=lua.lua_pushvfstring /export:lua_rawequal=lua.lua_rawequal /export:lua_rawget=lua.lua_rawget /export:lua_rawgeti=lua.lua_rawgeti /export:lua_rawset=lua.lua_rawset /export:lua_rawseti=lua.lua_rawseti /export:lua_remove=lua.lua_remove /export:lua_replace=lua.lua_replace /export:lua_resume=lua.lua_resume /export:lua_setallocf=lua.lua_setallocf /export:lua_setfenv=lua.lua_setfenv /export:lua_setfield=lua.lua_setfield /export:lua_sethook=lua.lua_sethook /export:lua_setlocal=lua.lua_setlocal /export:lua_setmetatable=lua.lua_setmetatable /export:lua_settable=lua.lua_settable /export:lua_settop=lua.lua_settop /export:lua_setupvalue=lua.lua_setupvalue /export:lua_status=lua.lua_status /export:lua_toboolean=lua.lua_toboolean /export:lua_tocfunction=lua.lua_tocfunction /export:lua_tointeger=lua.lua_tointeger /export:lua_tolstring=lua.lua_tolstring /export:lua_tonumber=lua.lua_tonumber /export:lua_topointer=lua.lua_topointer /export:lua_tothread=lua.lua_tothread /export:lua_touserdata=lua.lua_touserdata /export:lua_type=lua.lua_type /export:lua_typename=lua.lua_typename /export:lua_xmove=lua.lua_xmove /export:lua_yield=lua.lua_yield |
after running that there should be a lua.5.1.dll in your CMUD folder. |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Sun Dec 16, 2007 7:11 pm CMUD module to control winampremote |
<module name="WA">
<uid>{9E82DA1B-018B-4C65-A2FD-3149353BB579}</uid>
<func name="play" language="Lua" id="1">
<value>-- Hit the play button on the controlled Winamp instance.
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"play")
return ({bSuccess,result})</value>
</func>
<event event="onLoad" priority="20" language="Lua" id="2">
<value><![CDATA[require"socket.http"
require"xmlrpc"
require("ltn12")
winampremote = {}
---------------------------------------------------------------------
-- This method is almost a straight rip of xmlrpc.http.call from xmlrpc/http.lua
-- There was no socket.http.post which the orginal method in xmlrpc.http.call required
-- So I modified it to work with socket.http.request instead
-- Dharkael
-- ---------------------------------------------
-- Call a remote method.
-- @param url String with the location of the server.
-- @param meth String with the name of the method to be called.
-- @return Boolean indicating whether the call was successful or not;
-- and a Lua object with the converted response element.
---------------------------------------------------------------------
function winampremote.call (url, meth, ...)
local sinkt = {}
local body = xmlrpc.clEncode (meth, unpack (arg))
local reqt = {
url = url,
method = "POST",
source = ltn12.source.string(body),
sink = ltn12.sink.table(sinkt),
headers = {
["User-agent"] = "cMUD-XMLRPC",
["Content-type"] = "text/xml",
["content-length"] = string.len(body),
},
}
local result,code,headers,status = socket.http.request(reqt)
if tonumber (code) == 200 then
return xmlrpc.clDecode(table.concat(sinkt))
else
error (err or code)
end
end
]]></value>
</event>
<var name="URL" id="3">http://localhost:8011</var>
<func name="pause" language="Lua" id="4">
<value>-- Hit the pause button on the controlled Winamp instance.
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"pause")
return ({bSuccess,result})</value>
</func>
<func name="stop" language="Lua" id="6">
<value>-- Hit the stop button on the controlled Winamp instance.
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"stop")
return ({bSuccess,result})</value>
</func>
<func name="previous" language="Lua" id="7">
<value>-- Hit the previous button on the controlled Winamp instance.
-- The first param backtracks the current track that many times.
-- Negative arguments move the current track forward. An argument of zero is
-- or no argument is interpreted in the same way as an argument of 1."
local par = tonumber(zs.param(1))
par = (par==0) and 1 or par
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"previous",par)
return ({bSuccess,result})</value>
</func>
<func name="next" language="Lua" id="8">
<value>-- Hit the next button on the controlled Winamp instance.
-- The first param advances the current track that many times.
-- Negative arguments move the current track backward. An argument of zero is
-- or no argument is interpreted in the same way as an argument of 1."
local par = tonumber(zs.param(1))
par = (par==0) and 1 or par
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"next",par)
return ({bSuccess,result})</value>
</func>
<func name="get_volume" language="Lua" id="9">
<value>--Retrieve the current volume.
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"get_volume")
return ({bSuccess,result})</value>
</func>
<func name="set_volume" language="Lua" id="10">
<value>-- Set the volume
-- First param be a number between in the range [0..255]
-- If first param does not eval to a number this is the same as entering 0
-- If param is less than 0 it becomes 0
-- If param is greater than 255 it becomes 255
local par = tonumber(zs.param(1))
par = (par==nil) and 0 or par
par = (par <0 ) and 0 or par
par = (par>255) and 255 or par
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"set_volume",par)
return ({bSuccess,result})</value>
</func>
<func name="get_title" language="Lua" id="11">
<value>--Display the title of the current track.
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"get_title")
return ({bSuccess,result})</value>
</func>
<func name="ratecurrent" language="Lua" id="12">
<value>-- Rate the current track.
-- Ratings may be from 1 to 5 (poor to good), or zero to indicate unrated.
-- If first param is does not eval to a number it is interpreted as zero.
-- a number outside of the range [0..5] will fail
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"ratecurrent", tonumber(zs.param(1)))
return ({bSuccess,result})</value>
</func>
<func name="deletecurrent" language="Lua" id="13">
<value>-- Delete the current track from the playlist.
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"deletecurrent")
return ({bSuccess,result})</value>
</func>
<func name="get_tag" language="Lua" id="14">
<value>-- Retrieve an ID3 tag for the current track.
-- first param should be a string naming the ID3 tag to retrieve
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"get_tag")
return ({bSuccess,result})</value>
</func>
<func name="set_tag" language="Lua" id="15">
<value>-- Set an ID3 tag for the current track.
-- First param should be a string naming the ID3 tag to set
-- Second param should be the value to which it should be set.
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"set_tag",zs.param(1),zs.param(2))
return ({bSuccess,result})</value>
</func>
<func name="set_repeat" language="Lua" id="16">
<value>-- Set the Repeat switch
-- With no params or if first param evals to 0 turn it OFF
-- Everything else including an empty string "" turns it ON
local par = tonumber(zs.param(1))
par = (par==nil) and 1 or par
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"set_repeat",par)
return ({bSuccess,result})</value>
</func>
<func name="get_repeat" language="Lua" id="17">
<value>local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"get_repeat")
return ({bSuccess,result})</value>
</func>
<func name="get_shuffle" language="Lua" id="18">
<value>local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"get_shuffle")
return ({bSuccess,result})</value>
</func>
<func name="set_shuffle" language="Lua" id="19">
<value>-- Set the Shuffle switch.
-- With no params or if first param evals to 0 turn it OFF
-- Everything else including an empty string "" turns it ON
local par = tonumber(zs.param(1))
par = (par==nil) and 1 or par
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"set_shuffle",par)
return ({bSuccess,result})</value>
</func>
<func name="delete_and_skip" language="Lua" id="20">
<value>local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"delete_and_skip")
return ({bSuccess,result})</value>
</func>
<func name="current2mlpl" language="Lua" id="21">
<value>--Send the current track to a Media Library Playlist.
-- param should be a prefix of the target Playlist's title.
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"current2mlpl",zs.param(1))
return ({bSuccess,result})</value>
</func>
<func name="get_track_info" language="Lua" id="22">
<value>-- Retrieves assorted information about the current track.
local bSuccess,result = winampremote.call(zs.var["//WA/URL"],"get_track_info")
return ({bSuccess,result})</value>
</func>
</module> |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
Dharkael Enchanter

Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Sun Dec 16, 2007 7:34 pm |
Sorry about the format of the makeforwardlib.bat but it does have to be an interrupted string, no spaces.
Anyways the final module is fairly simple.
The URL variable in the WA module should be the EXACT url needed to connect to the wimpamp plugin including the http:// and the port ala http://localhost:8011
The Onload Event requires in everything external we need from lua and our external libraries.
Everything else in the module is a CMUD function in Lua dialect.
Call the function using something like #ECHO #echo @WA/play() or #echo @WA/set_volume(25)
So that's what I have so far lemme know what problems crop up, and I leave it to someone else to put the polish on it, buttons keyboard commands whatever. |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
 |
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Dec 16, 2007 11:17 pm |
Thanks mate! Thats frelling AWESOME! ;)
I'll play with it this week while my kid is in school and add the fun little buttons and things :D |
|
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
 |
|
|
|