mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2006
Posts: 167
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Aug 2006
Posts: 167
It seems that other -h timers can corrupt a pre-existing -h timer's interval.

With a fresh mIRC installation (or just with mirc.exe 7.19 copied to a temp directory and run -portable):

1. Add this to your remote script:

Code:
alias test {
  var %temp = $ticks
  if (%lastTicks != $null) echo -s interval (ms): $+ $calc($ticks - %lastTicks)
  set %lastTicks %temp
}

2. Type this command in your status window, and you should see a (fairly) accurate timer begin firing every 1 second:
/.timertest1 -ioh 0 1000 /test

3. Now copy all four commands below to your clipboard, and paste them into your status window, hitting enter to run all 4 at once:
/.timertest2 -ioh 1 0 .timerblah1 -iom 0 3000 /noop
/.timertest3 -ioh 1 100 .timerblah2 -iom 0 3000 /noop
/.timertest4 -ioh 1 200 .timerblah3 -iom 0 3000 /noop
/.timertest5 -ioh 1 300 .timerblah4 -iom 0 3000 /noop

Your original timer's high resolution will now be history. Example:

(I run the /timertest1 command here)
interval (ms):1002
interval (ms):1001
interval (ms):1002
interval (ms):1001
interval (ms):1002
interval (ms):1001
interval (ms):992
interval (ms):1001
interval (ms):1001
interval (ms):1002
interval (ms):1001
interval (ms):1002
interval (ms):1001
interval (ms):992
interval (ms):1001
interval (ms):1001
interval (ms):1002
interval (ms):1001
interval (ms):1002
interval (ms):1001
interval (ms):992
interval (ms):1001
interval (ms):1002
interval (ms):1001
(I paste and run the /timertest2-5 commands here)
interval (ms):1593
interval (ms):1602
interval (ms):1602
interval (ms):1602
interval (ms):1593
interval (ms):1602
interval (ms):1602
interval (ms):1603
interval (ms):1592
interval (ms):1602
interval (ms):1603
interval (ms):1602
interval (ms):1602
interval (ms):1592
interval (ms):1603

The number of miliseconds by which timer 'test1' speeds up or slows down seems random. Sometimes, pasting and executing the other timers causes 'test1' to speed up (e.g. -100 ms off). Other times, 'test1' slows down (e.g. +50ms off, +400ms off, +600ms off, etc.). In any case, after starting 'test1', just repeatedly paste-execute the extra 4 timer commands, and you'll see what I mean -- each time you do, how much the interval of 'test1' strays +/- from 1000 ms will be different.

P.S. Is there a reason -- or is it an unrelated bug -- that mIRC's $ticks function itself has low resolution? It seems to always round to 10ms or 11ms (note the many 1001/1002's vs. 992's ... and 1602/1603's vs. 1592/1593's above above).

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Confirmed, after some test, it seems to be related to the fact that one timer is calling another one.
Use /.timertest -oh 0 1000 test as said but add this alias instead :
Code:
alias test1 {
  .timertest1 -ho 1 0 .timertest1 -om 0 3000 noop
}
once you started the test timer, type randomly /test1 one or more time and check the results.
Now try with :
Code:
alias test1 {
  .timertest1 -om 0 3000 noop
}
the problem doesn't appear

Btw pishposh:
Originally Posted By: http://msdn.microsoft.com/en-us/library/ms724408
The resolution of the GetTickCount function is limited to the resolution of the system timer, which is typically in the range of 10 milliseconds to 16 milliseconds.

Last edited by Wims; 13/04/11 10:35 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
After seeing this:

Originally Posted By: versions.txt - mIRC 7.23
6.Changed /timer handling so that it is now more precise/reliable.
I tried this and good news, it's fixed (still happening in 7.22).


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2006
Posts: 167
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Aug 2006
Posts: 167
I noticed that too.

Thanks, Mr. MB. smile


Link Copied to Clipboard