js code:function OnEvent_ChatWndSendMessage( ChatWnd, Message )
{
// Check if it is not an automessage and if we're not busy yet
if (!/^AutoMessage :/.test(Message) && Messenger.MyStatus !== 4 ) {
// Set to busy
Messenger.MyStatus = 4;
}
// Return the unmodified message
// Never forget to return something for ChatWndSendMessage!
return Message;
}
! means NOT (The boolean True becomes False, and False becomes True)
/blahblah/ is a special syntax used for regular expressions
^ at the beginning of a regular expression means start comparing it from the beginning (aka: don't do a (slower) search).
test(blahblah) is a method of the regular expression object which test the occurance of the regular expression (in the above case '^AutoMessage :') in the string (in the above case the Message variable)
&& performs a logical conjunction (=AND) on two expressions (both expressions must be True for the result to be True)
If Message begins with the string 'AutoMessage :' then /^AutoMessage :/.test(Message) will return True. Otherwise it will return False. Hence the use of ! (=NOT) to change the result of the test to the opposite...
This post was edited on 01-19-2010 at 08:45 PM by CookieRevised.