Shoutbox

/commands - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: /commands (/showthread.php?tid=90694)

/commands by sadfib on 05-19-2009 at 11:09 AM

I know how to make the / command with xml formatting but how do I actually use it?

for example

code:
function OnGetScriptCommands() {
    var ScriptCommands = "<ScriptCommands>";
    ScriptCommands      +=    "<Command>";
    ScriptCommands      +=        "<Name>Test</Name>";
    ScriptCommands      +=        "<Description>More Test</Description>";
    ScriptCommands      +=    "</Command>";
    ScriptCommands      += "</ScriptCommands>";

    return ScriptCommands;
}


But how do I use ScriptCommands to do something? I only know how to code Gamemaker which Isn't at all like this.
RE: /commands by matty on 05-19-2009 at 01:03 PM

js code:
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage){
    if (/^\/([^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) !== null) {
       
        var _command = RegExp.$1.toLowerCase();
        var _param = RegExp.$2;
        switch (_command) {
            case 'test':
                // do something here
                break;
            case 'test1':
                // do something here
                break;
        }
    }   
    return sMessage;
}