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:
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: Problem with Script - ; required? Where?
I think this will work even better

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');
var re = RegExp("\b"+receivedWordArray.join("\b|\b")+"\b","i");

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)];
        if (re.test(Message)){
          ChatWnd.SendMessage(randomMsg);
        }
    }
}

Credits to markee for the regex

This post was edited on 08-02-2007 at 01:06 PM by Ezra.
[Image: 1-0.png]
             
08-02-2007 01:03 PM
Profile PM Web 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