mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 64
M
Babel fish
OP Offline
Babel fish
M
Joined: Jan 2003
Posts: 64
When dealing with milliseconds, /timer functions seem to be executing out of order. This deals with version 6.03.

This error doesn't occur when we're dealing with timers running on "full" seconds.

Testing this isn't too hard. Just pop this into your aliases:

TestALPHATWO {
If ($window(@TESTALPHATWO) = $null) Window @TESTALPHATWO 50 60 150 200
Var %Start = $window(@TESTALPHATWO).w
If (%Start > 150) {
Var %Count = %Start
Var %Cycle = 0
While (%Count >= 150) {
Timer -m 1 %Cycle Window @TESTALPHATWO 50 60 %Count 200
Var %Count = $calc(%Count - 30)
Var %Cycle = $calc(%Cycle + 25)
}
}
Else {
Var %Count = %Start
Var %Cycle = 0
While (%Count <= 600) {
Timer -m 1 %Cycle Window @TESTALPHATWO 50 60 %Count 200
Var %Count = $calc(%Count + 30)
Var %Cycle = $calc(%Cycle + 25)
}
}
}

Then we go to command line and type "//testalphatwo | timers"

* Timer 1 activated
* Timer 2 activated
* Timer 3 activated
* Timer 4 activated
* Timer 5 activated
* Timer 6 activated
* Timer 7 activated
* Timer 8 activated
* Timer 9 activated
* Timer 10 activated

Since you included /timers on the command line, here's what should pop up next:

* Active timers:
* Timer 1 1 time(s) 1ms delay Window @TESTALPHATWO 50 60 420 200
* Timer 2 1 time(s) 25ms delay Window @TESTALPHATWO 50 60 390 200
* Timer 3 1 time(s) 50ms delay Window @TESTALPHATWO 50 60 360 200
* Timer 4 1 time(s) 75ms delay Window @TESTALPHATWO 50 60 330 200
* Timer 5 1 time(s) 100ms delay Window @TESTALPHATWO 50 60 300 200
* Timer 6 1 time(s) 125ms delay Window @TESTALPHATWO 50 60 270 200
* Timer 7 1 time(s) 150ms delay Window @TESTALPHATWO 50 60 240 200
* Timer 8 1 time(s) 175ms delay Window @TESTALPHATWO 50 60 210 200
* Timer 9 1 time(s) 200ms delay Window @TESTALPHATWO 50 60 180 200
* Timer 10 1 time(s) 225ms delay Window @TESTALPHATWO 50 60 150 200

And now we get the problem:

* Timer 10 halted
* Timer 9 halted
* Timer 8 halted
* Timer 7 halted
* Timer 6 halted
* Timer 5 halted
* Timer 4 halted
* Timer 3 halted
* Timer 2 halted
* Timer 1 halted

The timers are executing in literally the opposite order that they should be...

I'm probably not doing something wrong... at least I think.

Lastly, to show that this error doesn't happen with normal, non-millisecond timers, we use a slightly-altered alias:

TestALPHATWO {
If ($window(@TESTALPHATWO) = $null) Window @TESTALPHATWO 50 60 150 200
Var %Start = $window(@TESTALPHATWO).w
If (%Start > 150) {
Var %Count = %Start
Var %Cycle = 0
While (%Count >= 150) {
Timer 1 %Cycle Window @TESTALPHATWO 50 60 %Count 200
Var %Count = $calc(%Count - 30)
Var %Cycle = $calc(%Cycle + 1)
}
}
Else {
Var %Count = %Start
Var %Cycle = 0
While (%Count <= 600) {
Timer 1 %Cycle Window @TESTALPHATWO 50 60 %Count 200
Var %Count = $calc(%Count + 30)
Var %Cycle = $calc(%Cycle + 1)
}
}
}

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
I don't believe it's a bug, as much as it is a "feature." From what I know about multimedia timers, I believe Windows executes them in the reverse order that they were created, so it's not a mIRC problem, it's just how Windows does it.

Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
sounds like a stack calle-- FILO kinda thing (First in, last out) grin


-KingTomato

Link Copied to Clipboard