quote:
Originally posted by Jumpfreakske
if(Message == "Razzia")
{
ChatWnd.SendMessage("/sound Dj Zany - Razzia");
MsgPlus.AddTimer("Delay", 12000);
ChatWnd.SendMessage("/sound Dj Zany - Razzia 2");
MsgPlus.AddTimer("Delay", 12000);
ChatWnd.SendMessage("/sound Dj Zany - Razzia 3");
}
The reason why this isn't working is because MsgPlus.AddTimer only adds a timer. It's not like the Sleep function that it'll make the script pauze for a certain period. Therefore, the right way of thinking here is:
- Play the first sound.
- Create the first timer, called "Delay1".
- Make a timer event.
- In the event, if the "Delay1" timer ends, play the second sound and create the second timer, "Delay2".
- Still in the event, if the "Delay2" timer ends, play the last sound.
And that's what NanaFreak's code does.
Just a note: the whole cyclus should be executed before a new "Razzia" message is received. Otherwise, the first cyclus will be stopped and the new one will play. This could lead to complications when this happens in two chat windows.
EDIT: Yes Felu, that's what I wanted to explain but you've beaten me.
When the first message arrives, the first sound will play. When another contact sends the message, the first sound will play in the new window but the other contact won't hear the other two. Also, when you close the window before all sounds are sent you get an error because the ChatWindow is invalid.