Here is the code to Add Timers :
code:
function OnEvent_Initialize(MessengerStart) {
AddTimers(1);
}
function AddTimers(Mult) {
var Elapse, TimerId;
for (var i = 1 ; i <= 10 ; i++) {
Elapse = 100 + (i * Mult);
TimerId = 'Timer_Mult:' + Mult + '_' + i + '_Elapse:' + Elapse;
MsgPlus.AddTimer(TimerId, Elapse);
Debug.Trace('<-- Timer added : ' + TimerId);
}
}
function OnEvent_Timer(TimerId) {
Debug.Trace('--> Timer catched : ' + TimerId);
}
Tested on my computer, with AddTimers() argument lower than 20 (in most cases) (works for > 20).
This should give (notice the catch order) :
code:
<-- Timer added : Timer_Mult:1_1_Elapse:101
<-- Timer added : Timer_Mult:1_2_Elapse:102
<-- Timer added : Timer_Mult:1_3_Elapse:103
<-- Timer added : Timer_Mult:1_4_Elapse:104
<-- Timer added : Timer_Mult:1_5_Elapse:105
<-- Timer added : Timer_Mult:1_6_Elapse:106
<-- Timer added : Timer_Mult:1_7_Elapse:107
<-- Timer added : Timer_Mult:1_8_Elapse:108
<-- Timer added : Timer_Mult:1_9_Elapse:109
<-- Timer added : Timer_Mult:1_10_Elapse:110
--> Timer catched : Timer_Mult:1_1_Elapse:101
--> Timer catched : Timer_Mult:1_2_Elapse:102
--> Timer catched : Timer_Mult:1_3_Elapse:103
--> Timer catched : Timer_Mult:1_4_Elapse:104
--> Timer catched : Timer_Mult:1_5_Elapse:105
--> Timer catched : Timer_Mult:1_6_Elapse:106
--> Timer catched : Timer_Mult:1_7_Elapse:107
--> Timer catched : Timer_Mult:1_8_Elapse:108
--> Timer catched : Timer_Mult:1_9_Elapse:109
--> Timer catched : Timer_Mult:1_10_Elapse:110
but it give :
code:
<-- Timer added : Timer_Mult:1_1_Elapse:101
<-- Timer added : Timer_Mult:1_2_Elapse:102
<-- Timer added : Timer_Mult:1_3_Elapse:103
<-- Timer added : Timer_Mult:1_4_Elapse:104
<-- Timer added : Timer_Mult:1_5_Elapse:105
<-- Timer added : Timer_Mult:1_6_Elapse:106
<-- Timer added : Timer_Mult:1_7_Elapse:107
<-- Timer added : Timer_Mult:1_8_Elapse:108
<-- Timer added : Timer_Mult:1_9_Elapse:109
<-- Timer added : Timer_Mult:1_10_Elapse:110
--> Timer catched : Timer_Mult:1_9_Elapse:109
--> Timer catched : Timer_Mult:1_8_Elapse:108
--> Timer catched : Timer_Mult:1_7_Elapse:107
--> Timer catched : Timer_Mult:1_6_Elapse:106
--> Timer catched : Timer_Mult:1_5_Elapse:105
--> Timer catched : Timer_Mult:1_4_Elapse:104
--> Timer catched : Timer_Mult:1_3_Elapse:103
--> Timer catched : Timer_Mult:1_2_Elapse:102
--> Timer catched : Timer_Mult:1_1_Elapse:101
--> Timer catched : Timer_Mult:1_10_Elapse:110
They appeared in a random order...