/command problem! - 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: /command problem! (/showthread.php?tid=78333)
/command problem! by drizzdk on 10-20-2007 at 04:40 PM
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?
RE: /command problem! by Spunky on 10-20-2007 at 06:03 PM
What shows up in the Debug window?
RE: /command problem! by drizzdk on 10-20-2007 at 06:27 PM
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
RE: /command problem! by Mnjul on 10-20-2007 at 06:31 PM
quote: Originally posted by drizzdk
ChatWnd.SendMessage("DDDDOOOHHH");
Shouldn't that be oChatWnd?
RE: RE: /command problem! by vikke on 10-20-2007 at 06:33 PM
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.
RE: /command problem! by Mnjul on 10-20-2007 at 06:55 PM
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
RE: /command problem! by drizzdk on 10-20-2007 at 07:06 PM
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
|