quote:
Originally posted by foaly
something like this works:
code:
function OnEvent_ChatWndSendMessage(ChatWnd, sMessage){
if(sMessage == "^^CurrentMedia"){
var Message = "/me is now playing "+ Messenger.CurrentMedia ;
ChatWnd.SendMessage(Message);
sMessage="";
return sMessage;
}
}
Why do you use the SendMessage and return an empty string and not just return the new string?
Also the script doesn't return anything if the if statement is false
code:
function OnEvent_ChatWndSendMessage(ChatWnd, sMessage)
{
if (sMessage.match(/^\^currentmedia(\s+|$)/i) != null)
{
return "/me is now playing " + Messenger.CurrentMedia;
}
else
{
return sMessage;
}
}