Shoutbox

OnEvent_ChatWndSendMessage help - 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: OnEvent_ChatWndSendMessage help (/showthread.php?tid=64493)

OnEvent_ChatWndSendMessage help by Rmstn1580 on 08-05-2006 at 08:31 AM

I'm trying to make a command what you type "!say hello" in the chat window and it will say "hello" or whatever you put after "!say" in a toast window. It isn't working :(. I've tried everything I can think of. Please help.

code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
    var e = Message;
    if(e.substring(0,4) == '!say')
    {
        var x = Message.splice(5);
        MsgPlus.DisplayToast("",x);
    }
       
}

HELP!!!!!!!!!!!!!! :'(:'(:'(:'(:'(
RE: OnEvent_ChatWndSendMessage help by Felu on 08-05-2006 at 08:38 AM

Your error

code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
    {
    var e = Message;
    if(e.substring(0,4) == '!say')
    {
    var x = Message.splice(5);
    MsgPlus.DisplayToast("",x);
    }

    }



Solution
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
var e = Message;
if(e.substring(0,4) == '!say');
{
var x = Message.substring(5);
MsgPlus.DisplayToast("",x);
}
}



My way of doing it
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
if (Message.substr(0,4) == '!say');
    {
        var m = Message.substr(5);
    MsgPlus.DisplayToast('Test', m);
    }
}

RE: OnEvent_ChatWndSendMessage help by Rmstn1580 on 08-05-2006 at 08:41 AM

That got me on the right path. One problem. It's mocking everything I say regardless whether I typed "!say" :| I'm tryin to fix it but I just started WLM Scripting today and before that I wasn't that good with JavaScript :$

Edit: Ahh, I fixed it. You had a semicolon after the if statement. Thanks for the code :)