Shoutbox

"/script" command - 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: "/script" command (/showthread.php?tid=78202)

"/script" command by general sirhc on 10-14-2007 at 03:41 PM

Could someone please tell me how to use the /script command apparently i can run a script when i have personalized status auto reply and just in the normal chat but i dont understand how it works. all it says is <function> <parameters>

EDIT: Thanks for the help i just thought it would be neat to have a script in my auto reply for personalized status but yeah its easier just to make a proper script

Thanks for future notice :D


RE: "/script" command by Matti on 10-14-2007 at 03:52 PM

If you want to make a Plus! Live command (like "/me" or "/prefs"), you'll need to use OnEvent_ChatWndSendMessage to look for the command and parse it. The best way to do it is to use CookieRevised's excellent command parsing regular expression, which is explained in CookieRevised's reply to Gettin data from "/" commands.

If you really want to be able to use something like "/script MyFunction 123", the Plus! Live scripting documentation has a template for that:

quote:
Originally posted by Scripting Documentation > Events Reference > Messenger Plus! Events > Events Templates > ScriptsCommandTemplate

Example
The user sends the following message in a chat window:
code:
/script TestCommand "first text" text2
The script handles the event with the following function, displays the parameters in the debugging window and returns an empty string to prevent any message to be sent in the chat.
code:
function TestCommand(Wnd, Params)
{
    Debug.Trace("TestCommand has been called");

    var array = VBArray(Params).toArray();
    for(i = 0; i < array.length; i++)
        Debug.Trace(" Parameter: " + array[i]);

    return "";
}

However, it's more recommended to make a "real" command like "/me" than using "/script <function> <parameters>". And honestly, the first method is much faster to type, no? :)