quote:
Originally posted by The-Phantom
Yeah, I know about that error of mine. But can't it be like this?js code:
function OnEvent_ChatWndSendMessage(Wnd, Message)
{
if(Message.substr(0, 10) != "/ajax-test")
return Message;
// handling for /ajax-test
}
No...
1) nothing will be executed after the
return statement
2) when you return the same message, the command will be send to your contact too (as text).
3) in that code you check if the message is _not_ "/ajax-test", it should be the opposite. You should never ever do != or !== to check for a command!! Again, this will cripple the proper workings of command handling... Always do a positive test, never a negative, for this.
See the code in my previous post for the proper way.
quote:
Originally posted by The-Phantom
Also, I know that I can do the same with an asynchronous request and sending another message, but what about receiving messages, where I need to change the text I receive? There's no function to "receive" another command, as far as I am aware…
There are some things you need to know whenyou want to change recieved text.
Biggest thing is that you can never change recieved text to text which is longer than the original.
Second, text you receive also includes your own send messages.
See OnEvent_ChatWndReceiveMessage event.
All this is also explained in the
Plus! Scripting documents.