mIRC Home    About    Download    Register    News    Help

Print Thread
Timer Events... An interesting use of signals... #1289 12/12/02 05:45 AM
Joined: Dec 2002
Posts: 580
N
NaquadaServ Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
I hate using tons of timers, do you too? Try this out....

alias tmr_signals {
if ($timer(S30) == $null) { .timerS30 -o 0 30 .scid -a .signal TMR_30 }
if ($timer(S60) == $null) { .timerS60 -o 0 60 .scid -a .signal TMR_60 }
if ($timer(S90) == $null) { .timerS90 -o 0 90 .scid -a .signal TMR_90 }
if ($timer(S1800) == $null) { .timerS1800 -o 0 1800 .scid -a .signal TMR_1800 }
if ($timer(S3600) == $null) { .timerS3600 -o 0 3600 .scid -a .signal TMR_3600 }
}

on *:signal:TMR_30:{ echo -s This will echo in every status window once every 30 seconds }

I could if I tried, but if someone has a really clean/quick way to do this with only one timer, please post... smile

/me loves signals! smile

Enjoy,
NaquadaServ

Last edited by NaquadaServ; 12/12/02 05:52 AM.

NaquadaBomb
www.mirc-dll.com
Re: Timer Events... An interesting use of signals... #1290 12/12/02 04:54 PM
Joined: Dec 2002
Posts: 86
D
d00dman Offline
Babel fish
Offline
Babel fish
D
Joined: Dec 2002
Posts: 86
Cool idea. I dunno if it's necessarily a good idea, but it's still pretty cool.

Here's my first thoughts on how to make it cleaner:

Code:
; timer-signal.mrc

; aliases
alias ts_start {
  .timerTS -o 0 1 ts_exec
  %ts_start = $ctime
}

alias ts_exec {
  var %elapse = $calc($ctime - %ts_start)
  if (%elapse < 0) { ts_start | halt }
  scid -a .signal ts_1
  if (!$calc(%elapse % 2)) { scid -a .signal ts_2 }
  if (!$calc(%elapse % 3)) { scid -a .signal ts_3 }
  if (!$calc(%elapse % 4)) { scid -a .signal ts_4 }
  if (!$calc(%elapse % 5)) { scid -a .signal ts_5 }
}

; events
on *:START:ts_start

; test
on *:SIGNAL:ts_1:echo -a timer-signal: 1
on *:SIGNAL:ts_2:echo -a timer-signal: 2
on *:SIGNAL:ts_3:echo -a timer-signal: 3
on *:SIGNAL:ts_4:echo -a timer-signal: 4
on *:SIGNAL:ts_5:echo -a timer-signal: 5


-chris