mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
OP Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Code:
//var %i = 1 | while ( %i <= 5 ) { .timer -h 1 $calc(%i * 1000) echo -a Timer %i finished at $!asctime(HH:nn:ss) | inc %i }

The above code starts 5 timers, each with a delay one second longer than the last. The first four timers trigger as expected (one second after each other), but the final timer takes an extra 5 seconds to complete.

Timer 1 finished at 05:06:35
Timer 2 finished at 05:06:36
Timer 3 finished at 05:06:37
Timer 4 finished at 05:06:38
Timer 5 finished at 05:06:43

Reproduced on 6.35/7.06, Vista/XP.

Joined: Aug 2006
Posts: 183
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2006
Posts: 183
Confirmed on 6.35.

Interestingly, if you change the number of iterations, it changes how much the timer is off by.

For instance at 5 we get:
Timer 1 finished at 00:21:27
Timer 2 finished at 00:21:28
Timer 3 finished at 00:21:29
Timer 4 finished at 00:21:30
Timer 5 finished at 00:21:35

And at 3 we get:
Timer 1 finished at 00:22:25
Timer 2 finished at 00:22:26
Timer 3 finished at 00:22:29

It seems the last timer is always off by X seconds where X is the number of loops you use. The pattern continues all the way up to at least 10. It didn't text any higher.

Edit: Also, -m may have the same bug. I did a bit of testing an 9 out of ten tries it functioned as expected. However, one one of them it had the exact same error as we're getting with -h. This is very odd behavior, as one would expect them either all to work or all to fail.

Edit2: Upon further testing another odd thing occurs using the following code.

Code:
//var %i = 1 | while ( %i <= 3 ) { .timer -h 1 $calc( %i * 1000 ) echo -a Timer %i finished at $!ticks | var %i = $calc(%i + .5) }


We get this (which is the same bug as above):

Timer 1 finished at 63625187
Timer 1.5 finished at 63625687
Timer 2 finished at 63626187
Timer 2.5 finished at 63626687
Timer 3 finished at 63629687

However, if we adjust the 3 loops to 5 loops, we get this:

Timer 1 finished at 63713281
Timer 1.5 finished at 63713781
Timer 2 finished at 63714281
Timer 2.5 finished at 63714781
Timer 3 finished at 63715281
Timer 3.5 finished at 63715781
Timer 4 finished at 63716281
Timer 4.5 finished at 63716781
Timer 5 finished at 63716781

The above error goes away but there is a new one. The boldest numbers should be 500 ms apart, but mirc reports them as the exact same. Interestingly, they appear on my screen about 500 ms apart (which is what should happen).

Last edited by Thrull; 01/07/10 04:49 AM.

Yar
Joined: Apr 2003
Posts: 342
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
Try this...
Code:
//var %i = 1 | while ( %i <= 5 ) { .timer -m 1 $calc(%i * 1000) echo -a Timer %i $!calc( $!ticks - $ticks ) | inc %i }


You'll get 1000, 2000, 3000 etc...

Replace -m with -h and you'll get 900,1800,etc.... Not exactly these but it will execute early. Which is it's intent. It preempts events. You would only use a high resolution timer to be called many more times than it needs to.

There aren't many needs for such a timer. I've never used one. It will lock mIRC up like a loop with no way to break out of it.


Beware of MeStinkBAD! He knows more than he actually does!
Joined: Dec 2002
Posts: 5,420
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,420
Thanks this should be fixed in the next version.


Link Copied to Clipboard