mIRC Homepage

on *:TIME

Posted By: pheonix

on *:TIME - 14/08/03 07:27 AM

on *:TIME:[s,n,h]:{
on *:TIME:s:{
event occurs when time changes in seconds.
on *:TIME:n:{
event occurs when time changes in minutes.
on *:TIME:h:{
event occurs when time changes in hours.
Posted By: NaquadaServ

Re: on *:TIME - 14/08/03 11:28 AM

The wonderful world of signals, they have a million uses... smile
Code:
on *:start:{ enable_time_event }
alias enable_time_event { .timer -m 0 500 chktime }
alias chktime {
  var %hh $asctime(hh) | var %nn $asctime(nn) | var %ss $asctime(ss)
  if (%last-hh == $null) { set %last-hh %hh }
  if (%last-nn == $null) { set %last-nn %nn }
  if (%last-ss == $null) { set %last-ss %ss }
  if (%last-hh != %hh) { .signal -n TIME-HOURS-CHANGE }
  if (%last-nn != %nn) { .signal -n TIME-MINUTES-CHANGE }
  if (%last-ss != %ss) { .signal -n TIME-SECONDS-CHANGE }
  set %last-hh %hh
  set %last-nn %nn
  set %last-ss %ss
}
on *:signal:TIME-HOURS-CHANGE:{ echo -a New Hour }
on *:signal:TIME-MINUTES-CHANGE:{ echo -a New Minute }
on *:signal:TIME-SECONDS-CHANGE:{ echo -a New Second }
Posted By: pheonix

Re: on *:TIME - 14/08/03 11:35 AM

i posted here because its feature suggestion, i know it can be scripted but i dont want to use a laggy timer....
thanx anyway :tongue:
Posted By: codemastr

Re: on *:TIME - 15/08/03 05:18 PM

Then use a high resolution or multimedia timer.
Posted By: Prizm

Re: on *:TIME - 16/08/03 01:33 PM

Quote:

Then use a high resolution or multimedia timer.


Multimedia timers use more system resources than standard timers, therefore, it will be even more laggy!


Quote from the mIRC help file:

Note: The -h switch creates a high-resolution multimedia timer. This type of timer should only be used in critical timer situations since it uses system resources heavily.

Posted By: codemastr

Re: on *:TIME - 16/08/03 04:18 PM

Yeah what's your point? To implement ON TIME mIRC is going to HAVE TO create a high resolution timer anyway! How else will mIRC know when the time changes? It can only figure it out by using a timer. And to ensure accuracy, the delay of the timer has to be less than the smallest change of the clock, which means the timer has to have a delay of less than a second which requires a high resolution timer. So ON TIME would basically be mIRC just triggers an ON TIME even each time the time changes as detected by the high resolution timer. So basically it would be SLOWER than just using a high resolution timer yourself.
Posted By: Rich

Re: on *:TIME - 16/08/03 05:12 PM

But mIRC could use one timer for all ON TIME events in all loaded scripts, instead of all scripts running one timer (or a lot of timers if they are coded the easy way)
Posted By: starbucks_mafia

Re: on *:TIME - 16/08/03 09:04 PM

It could be replicated using a single high-res timer and signals for those who wanted it. It just seems 'messy' for it to be a built-in event. I mean, would the timer always be running even if you had no 'on TIME' events? Or would mIRC check for the presence of an 'on TIME' event before creating the timer and then constantly monitor for the presence of one? Both ways seem pretty wasteful, especially for something provided just for convenience.
Posted By: arps

Re: on *:TIME - 21/08/03 05:15 PM

Good Idea with the signal code though!
© 2021 mIRC Discussion Forums