What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Help - /commands!

Help - /commands!
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. Huh?  Help - /commands!
Okay, here goes...

I'm making an Instant Response script, which is currently controlled entirely from the script menu, but I'm now adding /commands, which are as follows:
Javascript code:
function OnGetScriptCommands()
{
    var ScriptCommands = "<ScriptCommands>";
 
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>ir.enable</Name>";
    ScriptCommands    +=         "<Description>Turn Instant Response on.</Description>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>ir.disable</Name>";
    ScriptCommands    +=         "<Description>Turn Instant Response off.</Description>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>ir.message</Name>";
    ScriptCommands    +=         "<Description>Change the Instant Response message.</Description>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>ir.timer</Name>";
    ScriptCommands    +=         "<Description>Change the Instant Response timer.</Description>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>ir.pluson</Name>";
    ScriptCommands    +=         "<Description>Turn the Instant Response Plus! Style on.</Description>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>ir.plusoff</Name>";
    ScriptCommands    +=         "<Description>Turn the Instant Response Plus! Style off.</Description>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>ir.alerton</Name>";
    ScriptCommands    +=         "<Description>Turn the Instant Response sign-in alert on.</Description>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>ir.alertoff</Name>";
    ScriptCommands    +=         "<Description>Turn the Instant Response sign-in alert off.</Description>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>ir.status</Name>";
    ScriptCommands    +=         "<Description>Check the status of Instant Response.</Description>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    += "</ScriptCommands>";
 
    return ScriptCommands;
}

That bit works fine, but it's the programming bit that's causing trouble...
Javascript code:
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage)
{
    if (/^\/([^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) !== null)
    {
        var command = RegExp.$1.toLowerCase();
        var parameter = RegExp.$2;
        switch (command)
        {
            case 'ir.enable':
                if(settingEnable)
                {
                }
                else
                {
                    settingEnable = true;
                    var Message = "Activation: enabled";
                    Message = MsgPlus.RemoveFormatCodes(Message);
                    MsgPlus.DisplayToast("Instant Response", Message);
                    Debug.Trace("Instant Response  |  Activation: enabled");
                }
            return "";
            case 'ir.disable':
                if(settingEnable)
                {
                    settingEnable = false;
                    var Message = "Activation: disabled";
                    Message = MsgPlus.RemoveFormatCodes(Message);
                    MsgPlus.DisplayToast("Instant Response", Message);
                    Debug.Trace("Instant Response  |  Activation: disabled");
                }
                return "";
            case 'ir.message':
 
                return "";
            case 'ir.timer':
 
                return "";
            case 'ir.pluson':
                if(setMsgPlusAM)
                {
                }
                else
                {
                    setMsgPlusAM = true;
                    var Message = "Plus! Style: on";
                    Message = MsgPlus.RemoveFormatCodes(Message);
                    MsgPlus.DisplayToast("Instant Response", Message);
                    Debug.Trace("Instant Response  |  Plus! Style: on");
                }
                return "";
            case 'ir.plusoff':
                if(setMsgPlusAM)
                {
                    setMsgPlusAM = false;
                    var Message = "Plus! Style: off";
                    Message = MsgPlus.RemoveFormatCodes(Message);
                    MsgPlus.DisplayToast("Instant Response", Message);
                    Debug.Trace("Instant Response  |  Plus! Style: off");
                }
                return "";
            case 'ir.alerton':
                if(setSignInAlert)
                {
                }
                else
                {
                    setSignInAlert = true;
                    var Message = "Sign-in Alert: enabled";
                    Message = MsgPlus.RemoveFormatCodes(Message);
                    MsgPlus.DisplayToast("Instant Response", Message);
                    Debug.Trace("Instant Response  |  Sign-in Alert: on");
                }
                return "";
            case 'ir.alertoff':
                if(setSignInAlert)
                {
                    setSignInAlert = false;
                    var Message = "Sign-in Alert: disabled";
                    Message = MsgPlus.RemoveFormatCodes(Message);
                    MsgPlus.DisplayToast("Instant Response", Message);
                    Debug.Trace("Instant Response  |  Sign-in Alert: off");
                }
                return "";
            case 'ir.status':
                if (settingEnable)
                {
                    var Message1 = "Message: " + settingMessage + "\nTimer: " + settingTimer + " milliseconds" + "\nPlus! Style: "
                    if (setMsgPlusAM) { var PMessage = "on" } else { var PMessage = "off" }
                    var Message2 = "\nSign-in Alert: "
                    if (setSignInAlert) { var SMessage = "on" } else { var SMessage = "off" }
                    Message = MsgPlus.RemoveFormatCodes(Message);
                    MsgPlus.DisplayToast("Instant Response", Message1 + PMessage + Message2 + SMessage);
                    Debug.Trace("Instant Response  |  Message: " + settingMessage);
                    Debug.Trace("Instant Response  |  Timer: " + settingTimer + " milliseconds");
                    if (setMsgPlusAM) { Debug.Trace("Instant Response  |  Plus! Style: on"); }
                    else { Debug.Trace("Instant Response  |  Plus! Style: off"); }
                    if (setSignInAlert) { Debug.Trace("Instant Response  |  Sign-in Alert: on"); }
                    else { Debug.Trace("Instant Response  |  Sign-in Alert: off"); }
                }
                else
                {
                    var Message = "Unable to show the status.  You need to enable the script first!";
                    Message = MsgPlus.RemoveFormatCodes(Message);
                    MsgPlus.DisplayToast("Instant Response", Message);
                    Debug.Trace("Instant Response  |  Status check error.");
                }
                return "";
            default:
                return 0;
        }
    }
}


What I need, for the message and timer, is that the user types in the command, followed by the message/timer, and the script will set it.
code:
Example: /ir.message Hello there.  -->  (sets message to "Hello there.")
Example: /ir.timer 1000  -->  (sets timer to "1000")

How do I do this?  :S  (edit: codes in JavaScript now)

This post was edited on 02-15-2009 at 11:45 AM by whiz.
02-01-2009 12:38 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Help - /commands! - by whiz on 02-01-2009 at 12:38 PM
RE: Help - /commands! - by matty on 02-01-2009 at 05:53 PM
RE: Help - /commands! - by whiz on 02-02-2009 at 10:59 AM
RE: Help - /commands! - by Matti on 02-02-2009 at 03:30 PM
RE: Help - /commands! [NEW QUESTION!] - by Jesus on 02-07-2009 at 01:15 PM
RE: Help - /commands! - by whiz on 02-15-2009 at 11:45 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On