Ah! Thank you!! Now the script is actually attempting a return instead of just displaying the raw !command. I'm glad I don't have to go searching other chunks of the code for the problem.
However, it seems there's still something wrong here... D:
As you suggested, I changed it to
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,Kind){
if(Message.substr(0,8).toLowerCase()=="!petrafi"){
nbrPet++;
var h = Math.floor((Math.random()*(dArray.length-1)));
return "*" + Messenger.MyName + " pets Rafeal* \n" +dArray[h];
}
But now it attempts to shave the response to 8 characters, I guess because of "(Message.substr(0,8)"... This is the return I'm getting in the conversation window (My name right now being Kao):
quote:
Kao says:
*Kao pet
It didn't have that problem when I was using "function OnEvent_ChatWndSendMessage." The Message.substr(0,8) is just supposed to apply to the raw !command, not the return, so that's weird...
Also, for my contact, when they say !petrafi, it executes the script in my view of the conversation, but in theirs, it still just says !petrafi. I hope there's a way around that! =/
Thanks for the continuing help! :3