What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » problem with invalid command

problem with invalid command
Author: Message:
Zeelia
New Member
*


Posts: 11
– / Male / Flag
Joined: Dec 2007
O.P. problem with invalid command
<For moderators: please move this thread to the appropriate forum if it is not on the appropriate forum>

Hi!
I have made an command and an action for the command but when i try the command in an chat window the action works and all, i get an Messenger Plus toast but i also get the invalid command prompt which tells me something about "invalid command... if you weren't intending on writing an command start with double-slash '//"
so i need help to get rid of that invalid command prompt, here is my code:

code:
//vars
var appenable = "no";

function OnEvent_ChatWndSendMessage(ChatWnd, sMessage)
{
    if(sMessage=="/shortopener enable") {
        appenable = "yes";
        return(MsgPlus.DisplayToast("Shortopener :: Enable", "Shortopener enabled!"));
    }
}

function OnGetScriptCommands()
{
    var Commands = "<ScriptCommands>";
    Commands += "<Command>";
    Commands += "<Name>shortopener enable</Name>";
            Commands += "<Description>Shortopener \n Enables the shortopener, must be written before starting to use Shortopener</Description>";
    Commands += "</Command>";
    Commands += "</ScriptCommands>";
    return Commands;
}


its not a really big thing but its really irritating when you want to type in the command and get the unnecessary prompt when the command does its work so please help me

This post was edited on 05-06-2008 at 11:10 PM by Zeelia.
05-06-2008 11:08 PM
Profile PM Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
RE: problem with invalid command
code:
var appenable = false;

function OnEvent_ChatWndSendMessage(ChatWnd, sMessage){
if(sMessage.substr(0,12)=="/shortopener") {
switch(sMessage.substr(13)){
case "enable":
appenable = true;
break;
case "disable":
appenable = false;
break;
default:
appenable = !appenable;
}
MsgPlus.DisplayToast("appenable: " + appenable, "shortopener");
return "";
}
}

function OnGetScriptCommands(){
var Commands = "<ScriptCommands>";
Commands += "<Command>";
Commands += "<Name>shortopener</Name>";
Commands += "<Description>Shortopener \n Enables the shortopener, must be written before starting to use Shortopener</Description>";
Commands += "<Parameters>&lt;enable or disable&gt;</Parameters>";
Commands += "</Command>";
Commands += "</ScriptCommands>";
return Commands;
}


i would use booleans ;)
and you have to return nothing otherwise it will show that error

This post was edited on 05-06-2008 at 11:50 PM by roflmao456.
[quote]
Ultimatess6
: What a noob mod
05-06-2008 11:46 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: problem with invalid command
For more details and a working example of how the return value works and what effects it will give, see:
CookieRevised's reply to Gettin data from "/" commands

Which also includes a far better method of handling parameters, using regular expressions

This post was edited on 05-07-2008 at 01:06 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-07-2008 01:04 AM
Profile PM Find Quote Report
Zeelia
New Member
*


Posts: 11
– / Male / Flag
Joined: Dec 2007
O.P. RE: problem with invalid command
Ok, thanks to both of you, you fixed my problem but did also give me ideas on how to improve my code, thanks!
//Zeelia
05-07-2008 05:13 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


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