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

/command problem!
Author: Message:
drizzdk
New Member
*


Posts: 3
Joined: Oct 2007
O.P. /command problem!
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 'donothing':
                // <- Lets tell the function we handled the command. But nothing needs to e passed back to the conversation; keep the command showing.
                ChatWnd.SendMessage("DDDDOOOHHH");
                Debug.Trace("command reconized: " + command + ", parameter: " + parameter);
                return "LOL!";
        }
    }
}

Why cant i do that ?
And how can i do it otherwise?
10-20-2007 04:40 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: /command problem!
What shows up in the Debug window?
<Eljay> "Problems encountered: shit blew up" :zippy:
10-20-2007 06:03 PM
Profile PM Find Quote Report
drizzdk
New Member
*


Posts: 3
Joined: Oct 2007
O.P. RE: /command problem!
Funktion kaldt: OnEvent_ChatWndSendMessage
Fejl: Et objekt var ventet (kode: -2146823281)
       Fil: MSN Booter.js. Linie: 94.
Funktion OnEvent_ChatWndSendMessage gav en fejl. Kode: -2147352567
10-20-2007 06:27 PM
Profile E-Mail PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: /command problem!
quote:
Originally posted by drizzdk
ChatWnd.SendMessage("DDDDOOOHHH");
Shouldn't that be oChatWnd? :)
10-20-2007 06:31 PM
Profile PM Web Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: RE: /command problem!
quote:
Originally posted by Mnjul
quote:
Originally posted by drizzdk
ChatWnd.SendMessage("DDDDOOOHHH");
Shouldn't that be oChatWnd? :)


code:
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
    if (/^\/([^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) != null) {
       var command = RegExp.$1.toLowerCase();
       var parameter = RegExp.$2;
       oChatWnd.SendMessage("DDDDOOOHHH");
       Debug.Trace("command reconized: " + command + ", parameter: " + parameter);
       return "LOL!";
    }
}
Your code had some errors in it. !== should be !=, ChatWnd should be oChatWnd, otherwise it works fine.
10-20-2007 06:33 PM
Profile E-Mail PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: /command problem!
quote:
Originally posted by vikke
!== should be !=
!== operator in Jscript means "nonidentity". It not only compares the value of the two operands but also compares their type.

!== is favored when needing to ensure strong-typing and to avoid type-conversion when comparing two variables.

http://msdn2.microsoft.com/en-us/library/ky6fyhws.aspx

This post was edited on 10-20-2007 at 06:57 PM by Mnjul.
10-20-2007 06:55 PM
Profile PM Web Find Quote Report
drizzdk
New Member
*


Posts: 3
Joined: Oct 2007
O.P. RE: /command problem!
Fejl: Et objekt var ventet (kode: -2146823281)
       Fil: MSN Booter.js. Linie: 94.
Funktion OnEvent_ChatWndSendMessage gav en fejl. Kode: -2147352567

Translated (the best i could):
Error: A object was expected (code: -2146823281)
        File: MSN Booter.js. Line: 94
Function OnEvent_ChatWndSendMessage gave an error. Code: -2147352567
fixed, forgot "." lol
10-20-2007 07:06 PM
Profile E-Mail 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