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

Script Command
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: RE: Script Command
The reason why you got that error is because you try to use a child function of an undefined variable "ChatWnd". A fix would be to send the ChatWnd object as a parameter to your foo function, like so:

code:
var test1 = 'Hello World!';

function OnGetScriptCommands()
{
var ScriptCommands = "<ScriptCommands>";
ScriptCommands    +=     "<Command>";
ScriptCommands    +=         "<Name>test</Name>";
ScriptCommands    +=         "<Description>testing</Description>";
ScriptCommands    +=     "</Command>";
ScriptCommands    += "</ScriptCommands>";

return ScriptCommands;
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
switch (Message) {
case "/test":
foo(ChatWnd);
break;
}
}
function foo(ChatWnd) {
ChatWnd.SendMessage(test1);
}
Or, you could use a return to replace the sent message:
code:
...
switch (Message) {
case "/test":
return foo(ChatWnd);
break; //not really necessary, it simply makes it look more common.
}
...
function foo(ChatWnd) {
return test1;
}
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
03-12-2007 05:18 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Script Command - by Bewwen on 03-11-2007 at 08:35 PM
RE: Script Command - by effection on 03-11-2007 at 08:41 PM
RE: Script Command - by NanaFreak on 03-11-2007 at 08:45 PM
RE: RE: Script Command - by Matti on 03-12-2007 at 05:18 PM
RE: Script Command - by Bewwen on 03-11-2007 at 09:07 PM
RE: Script Command - by effection on 03-11-2007 at 09:12 PM
RE: Script Command - by Bewwen on 03-11-2007 at 09:14 PM
RE: Script Command - by NanaFreak on 03-11-2007 at 09:14 PM
RE: Script Command - by markee on 03-11-2007 at 10:06 PM
RE: Script Command - by effection on 03-11-2007 at 10:24 PM
RE: Script Command - by Felu on 03-12-2007 at 08:42 AM
RE: Script Command - by Spunky on 03-12-2007 at 03:44 PM
RE: Script Command - by markee on 03-12-2007 at 03:58 PM
RE: Script Command - by Spunky on 03-12-2007 at 04:09 PM


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