mIRC Home    About    Download    Register    News    Help

Print Thread
timers.. #78989 12/04/04 08:33 AM
Joined: Feb 2004
Posts: 119
D
da_hype Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Feb 2004
Posts: 119
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.

Re: timers.. #78990 13/04/04 01:33 AM
Joined: Dec 2002
Posts: 54
S
SergioNL Offline
Babel fish
Offline
Babel fish
S
Joined: Dec 2002
Posts: 54
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

Re: timers.. #78991 13/04/04 01:35 AM
Joined: Dec 2002
Posts: 54
S
SergioNL Offline
Babel fish
Offline
Babel fish
S
Joined: Dec 2002
Posts: 54
exept if the timers call huge loops ofcoure:P

Re: timers.. #78992 13/04/04 08:02 AM
Joined: Oct 2003
Posts: 12
E
Epsilon Offline
Pikka bird
Offline
Pikka bird
E
Joined: Oct 2003
Posts: 12
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)


Re: timers.. #78993 13/04/04 11:33 AM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
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.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: timers.. #78994 23/04/04 09:34 PM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
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...

Code:
* 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.

Code:
ALIAS -l TITLEBAR.UPDATE {
  if (($appactive != %l.appactive) || ($appstate != %l.appstate)) {
    set %l.appactive $appactive
    set %l.appstate $appstate
    START.TITLEBAR.UPDATE
  }

  set %p.tb -

  ROOTSIGNAL -n TITLEBAR.UPDATE

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

ALIAS /ROOTSIGNAL { .SIGNAL $1- }



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.


Beware of MeStinkBAD! He knows more than he actually does!
Re: timers.. #78995 24/04/04 12:44 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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)?

Re: timers.. #78996 24/04/04 05:44 PM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
<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?


Beware of MeStinkBAD! He knows more than he actually does!
Re: timers.. #78997 24/04/04 10:16 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
ASCII code #5 is the ENQ 'enquiry' control code. The | 'pipe' symbol that separates commands in mIRC is ASCII code #124.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: timers.. #78998 26/04/04 11:16 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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