mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2007
Posts: 66
B
beer Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2007
Posts: 66
Hi. I'm trying to run a function every day at 11pm but I'm not sure what the best way to do it is. Would I just make an endless timer with a delay of the number of seconds in a day, like:

timerDailyTimer 23:00 0 86400 { msg #testchannel today is $date }

Or is there a better way to trigger an event/function at a specific time every day?

Thanks!

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Assuming that works for 24 hour days, it won't work for the 23 and 25 hour days when we go on/off daylight time. Another way to do it is to have the timer be created daily.

TimerDailyTimer 22:59 1 60 My_Alias msg #testchannel today is $!date

... where My_Alias displays its command, then runs the above timer command again. Also, the way your command behaves is that it evaluates $date into a string, then displays it 86400 seconds later. You should either use $!identifiername to delay evaluation, or else have My_Alias contain the message in its entirety. The alias should also have error checking, such as making sure you're still in #testchannel.

Joined: Jul 2007
Posts: 66
B
beer Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2007
Posts: 66
Thanks maroon. I didn't think you could create the same timer within a function triggered by that timer. Now that I think about it, once the function is called, the timer doesn't exist anymore so creating the timer in the function wouldn't actually overwrite it.. Or whatever, you know what I mean (hopefully).

At any rate, it's working now, thanks again!

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
The timer still exists during the execution of that timer.

Code:
//timerxyz 1 3 echo -a current timer is $!ctimer remaining reps $!timer(xyz).reps sec $!timer(xyz).secs delay $!timer(xyz).delay commandline: $!timer(xyz).com



Even if there were future repetitions of the timer, you can use the same timer name to redefine an existing timer into being anything you wish.


Link Copied to Clipboard