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.