What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Problem with Script - ; required? Where?

Problem with Script - ; required? Where?
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Problem with Script - ; required? Where?
Untested but should work

code:
var wordArray = new Array ('Hello!', 'Hi!', 'Yo', 'Allo', 'Hiya', 'Why, Hello!');
var receivedWordArray = new Array ('HI', 'HI!', 'LO', '\'LO', 'HIYA', 'HELLO!', 'HELLO', 'YO.', 'YO!', 'YO', 'ALLO!', 'ALLO');

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageType) {
    if (Origin != Messenger.MyName) {
        if (Messenger.MyStatus != 3) {
            ChatWnd.SendMessage('AutoMessage: I\'m busy right now.');
            return false;
        }
        var randomMsg = wordArray[Math.floor(Math.rand() * wordArray.length)];
        for (var i in receivedWordArray) {
            if (Message.toUperCase() === receivedWordArray[i]) {
                ChatWnd.SendMessage(randomMsg);
            }
        }
    }
}

Also please note that this can cause infinite loops and you should take precautions when sending messages.

Best way is to store the Message you send in an object then compare the message if it is the same then disregard it.

This post was edited on 08-02-2007 at 12:46 PM by matty.
08-02-2007 12:40 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Problem with Script - ; required? Where? - by Toneo on 08-01-2007 at 07:22 PM
RE: Problem with Script - ; required? Where? - by Mnjul on 08-01-2007 at 08:02 PM
RE: Problem with Script - ; required? Where? - by matty on 08-01-2007 at 08:10 PM
RE: Problem with Script - ; required? Where? - by markee on 08-01-2007 at 11:45 PM
RE: Problem with Script - ; required? Where? - by Toneo on 08-02-2007 at 08:41 AM
RE: Problem with Script - ; required? Where? - by LifelesS on 08-02-2007 at 12:00 PM
RE: Problem with Script - ; required? Where? - by matty on 08-02-2007 at 12:40 PM
RE: RE: Problem with Script - ; required? Where? - by LifelesS on 08-02-2007 at 01:15 PM
RE: Problem with Script - ; required? Where? - by LifelesS on 08-02-2007 at 12:43 PM
RE: Problem with Script - ; required? Where? - by Ezra on 08-02-2007 at 01:03 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