An alternative to Spunky's code is to use a regular expression, which would make the code look something like this.
code:
var keywords= new Array("Spunky","SLM","Shane");
var re = new RegExp("\\b("+keywords.join("|")+")\\b","ig");
function OnEvent_ChatWndReceiveMessage(ChatWnd, Message){
if(Origin!==Messenger.MyName){
var arr;
while((arr = re.exec(Message))!==null){
MsgPlus.DisplayToastContact("Nick Highlighter", "[c=#3682B4][b]Highlight[/b][/c]",RegExp.$1 + " has been mentioned by " + MsgPlus.RemoveFormatCodes(Origin);
}
}
}
Or if you didn't want it to list every word that is matched, which was sent in a single message (something like "Spunky SLM" would generate 2 toasts). then you could use the following.
code:
var keywords= new Array("Spunky","SLM","Shane");
var re = new RegExp("\\b("+keywords.join("|")+")\\b","i");
function OnEvent_ChatWndReceiveMessage(ChatWnd, Message){
if(Origin!==Messenger.MyName && re.exec(Message)!==null) MsgPlus.DisplayToastContact("Nick Highlighter", "[c=#3682B4][b]Highlight[/b][/c]",RegExp.$1 + " has been mentioned by " + MsgPlus.RemoveFormatCodes(Origin);
}
Also, I should note that the \\b used in the regex means that it must be the whole word (unlike spunky's which will match even "ASLMNDER" or something similar if it were ever to occur). The i modifier allows for the letters to be in upper or lower case, just so that it doesn't matter if your friend types your name in caps for some unknown reason.
Obviously you could make the code smaller by writing straight into the regex, however I would recommend keeping the regex as a global variable unless it became contact dependant as this means it only needs to loaded the once.