mIRC Home    About    Download    Register    News    Help

Print Thread
#37693 21/07/03 04:02 PM
Joined: Feb 2003
Posts: 282
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
I know that it might sound weird, but is there a way that I could execute a command as soon as a timer is set off?

For example, I started a timer: /timergonogo 5 60 echo -a hello

And when the timer is turned off I want to to say: Echo -a Timer Gonogo was turned off.

Off cours that if I use: /timer 1 300 echo -a Timer Gonogo was turned off, I will get the result I want, but not incase the timer is being turned off before its time!!
Since the timer could be turned off by a script, and by a user, I need to find if the timer was turn off by a simple command.

Thanks.

#37694 21/07/03 04:54 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Only thing I can think of is to runa second timer to check on the first...


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#37695 23/07/03 11:43 PM
Joined: Jul 2003
Posts: 14
B
Pikka bird
Offline
Pikka bird
B
Joined: Jul 2003
Posts: 14
You could use a simple alias to turn the timer off instead of the "/timerGongo off"

alias offtimer {
timer $+ $1 off
echo -a Timer $1 was turned off.
}

To turn the timer off, just execute /offtimer Gongo

#37696 24/07/03 08:53 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
that defeats the purpose bruno, esp if you have it run 5 interations, then die. You still need one the same delay later to trigger and end responce.


-KingTomato
#37697 26/07/03 11:52 PM
Joined: Dec 2002
Posts: 117
R
Vogon poet
Offline
Vogon poet
R
Joined: Dec 2002
Posts: 117
You could write an alias to overwrite the /timer command for the timer you want to check:
Code:
;overwrite the timergonogo command
alias timergonogo {
  ;see if the timer is running
  var %wastimer = $timer(gonogo)

  ;execute the real command
  if ($show) timergonogo $1-
  else .timergonogo $1-

  ;timer is turned off if it was running and is no longer running after the 'real' command
  if ((%wastimer) && (!$timer(gonogo))) echo * Timer gonogo has been turned off!

  ;if the timer is started and won't run forever set a timer to execute when this one is finished
  ;the +1 is to make sure it executes after gonogo has stopped, somehow it seems to overtake it sometimes otherwise
  elseif (($1) && ($timer(gonogo))) .timergonogo-check-off 1 $calc($1 * $2 + 1) echo * Timer gonogo has finished!

  ;stop check-up timer if timer is no more
  if (!$timer(gonogo)) .timergonogo-check-off off
}


Note that this needs improvement for supporting switches. (the check-up timer won't work if you use switches, but it shouldn't be too difficult to make that work)


$input(Me like stars, You too?)
#37698 27/07/03 11:13 AM
Joined: Jul 2003
Posts: 742
Hoopy frood
Offline
Hoopy frood
Joined: Jul 2003
Posts: 742
Rich; that is one long hard to figgure out signature...


;p


http://MTec89Net.com
irc.freenode.net #MTec89Net

Link Copied to Clipboard