mIRC Home    About    Download    Register    News    Help

Print Thread
Request for on TIME event #262213 09/01/18 07:34 PM
Joined: Dec 2002
Posts: 2,016
R
RoCk Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,016
A recent script request from a friend got me thinking about a TIME event. His request was to automatically message his channels when different parts of the world hit midnight on new year's eve. He didn't want to start a bunch of timers to do it, which was my suggestion. The event would trigger one time on the arrival of the specified time. I imagine the specified time would be in 24 hour format.

This would trigger at 6pm
Code:
on *:TIME:1800: {
  ; do stuff
}

This would trigger at 1:31am
Code:
on *:TIME:0131: {
  ; do stuff
}

Maybe we could also make it accept a variable to make it dynamic.
Code:
on *:TIME:%var: {
  ; do stuff
}


What do you think? Is it possible?

Re: Request for on TIME event [Re: RoCk] #262216 09/01/18 09:32 PM
Joined: Jan 2004
Posts: 1,276
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,276
Something like this would make it simpler to have something that triggers daily at the same time.

//timer $asctime($ctime,HH:nn) 1 0 echo -a test

.. triggers immediately, so a daily midnight timer currently needs to either have a 60 second timer to set the midnight timer at 00:01 or use a 60 second delay like

/timer -o 23:59 1 60 aliasname

It's possible for a midnight timer to trigger at 00:01 or later due to being frozen during a $findfile or a long script loop, so it might be useful for such an event to have the triggertime placed either into some kind of $eventtime identifier or placed into the unused $1

It's possible that the computer clock is 00:00:20 when it checks the internet time and resets the clock back to 23:59:50 triggering twice, or sets the clock forward by enough time to skip past the event's trigger time.

This event would also need to decide how to handle

on *:TIME:0230:{ }

.. on the dates when daylight saving time changes to avoid triggering twice in the fall and being skipped in the spring.

Some of this can be solved by just making it the script's responsibility to not set triggers at 2:30am or check how recently it was triggered. Handling skipped trigger times should probably trigger the events skipped the way setting the clock forward triggers Outlook reminders.