I am on a learning phase of scripting, so I figured that i should try making a Delay command.
This is what i got
code:
function OnEvent_ChatWndSendMessage(ChatWnd, sMessage)
{
var stringMessage = sMessage;
var arrayMessage = stringMessage.split(";");
var stringCommand = arrayMessage[0];
var variableDelay = arrayMessage[1];
var stringSendMessage = arrayMessage[2];
if (stringCommand == "#Delay")
{
MsgPlus.AddTimer("timerDelay",variableDelay);
OnEvent_Timer("timerDelay")
{
return stringSendMessage;
}
}
else return sMessage
}
Something is wrong since all that happens when i type "#Delay;1000;1 second delay" is that i just send excactly that message. The outcome i want is that only the last part, "1 second delay" should be sent, and 1 second after i type the delay command.
So... What is wrong? How to correct it?
Help me please.