mIRC Homepage
Posted By: da_hype timers.. - 12/04/04 08:33 AM
If using to many timers on a script are bad... anyone have a better way? like a a DLL code to do it?

cause right now i have timers on the titlebar... sidepanel resize.. statusbar and switchbar.
Posted By: SergioNL Re: timers.. - 13/04/04 01:33 AM
i dont see any point for that, timers aint eating that much cpu as some ppl think, when i had a p200 id keep the timers abit low but nowdays most pc's are over 1.5 ghz
Posted By: SergioNL Re: timers.. - 13/04/04 01:35 AM
exept if the timers call huge loops ofcoure:P
Posted By: Epsilon Re: timers.. - 13/04/04 08:02 AM
The only problem I see is that High Resolution Timer (timer -h) are not accurate enough on WinXP/2K.

They have the same minimal delay as /timer -m !!

Basically, they can only fire an alias max. 65 times per seconds. (tested on the best PCs) So the min. delay is 15ms.
(Wich far too much when animating things with picwin, that limit to 65FPS whatever the PC CPU is).

The strangiest is that under Win9x on Pentium II 200Mhz, they can fire up to 130 times/seconds.

So I might write a DLL to call real high res timers.

(I checked and mIRC use custom window events to fire the alias associated with a high res timers, so its not reliable)
Posted By: starbucks_mafia Re: timers.. - 13/04/04 11:33 AM
The problem with timers is that they can very easily and unwittingly be turned off. A simple /timers off by a user who doesn't consider the full implications will bring a timer-reliant script down on it's knees. If possible it's best to rely on some specific event or action.
Posted By: MeStinkBAD Re: timers.. - 23/04/04 09:34 PM
I personnally strive for fewer timers that cause a sequence of actions rather than a bunch that cause single actions. I do this because of neatness and simplicity.

Here are the timers I have running right now...

* Active timers:
* Timer .internal.timer 1s delay if $isalias(INTERNAL.TIMER.EVENT) { INTERNAL.TIMER.EVENT }
* Timer .failsafe 1s delay if ($isalias(STARTFAILSAFETIMER) != $true) { .timers.* off  .unset %p.* %g.*  .timer.REMOTE.REENABLE -oi 1 60 /REMOTE ON  REMOTE OFF }
* Timer .msec.inc 5ms delay /inc %p.msec.inc 5 | if (%p.msec.inc > 999) %p.msec.inc = 0
* Timer .titlebar.update 50ms delay if $isalias(TITLEBAR.UPDATE)) { TITLEBAR.UPDATE }

The last timer, the "Titlebar updater" is good example of how I approach the problem.

It calls the following function.

  if (($appactive != %l.appactive) || ($appstate != %l.appstate)) {
    set %l.appactive $appactive
    set %l.appstate $appstate

  set %p.tb -


  if (%p.tb !== $titlebar) {
    /titlebar %p.tb
} }


Using this technique, every script file loaded may be called, depending on if an ON *:SIGNAL:TITLEBAR.UPDATE: event exists within that file.

Anyhow, this should explain how to lower the number of timers in a script. I hope it helps.
Posted By: Iori Re: timers.. - 24/04/04 12:44 PM
If that is your actual timers list I think your "failsafe" timer is going to fail, there are no timers.* listed there.wink

BTW whats with the chr5's (.timers.* off  <<There)?
Posted By: MeStinkBAD Re: timers.. - 24/04/04 05:44 PM
<sheepishly> Whoops... never caught the /timers.* off error. Don't know how long it's been since I coded that... several years perhaps? I dunno. But thanks... </sheepishly>

ASCII character #5 (AKA "|") is used to break up the code into multiple executions... er I mean multiple lines. Why? Is there somethng wrong with this too?
Posted By: starbucks_mafia Re: timers.. - 24/04/04 10:16 PM
ASCII code #5 is the ENQ 'enquiry' control code. The | 'pipe' symbol that separates commands in mIRC is ASCII code #124.
Posted By: Iori Re: timers.. - 26/04/04 11:16 AM
Hehe, one question regarding "ASCII character #5 (AKA "|")". If you thought "" was the ascii char for "|", why did you think it didn't look like "|"? laugh
© mIRC Discussion Forums