mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2014
Posts: 1
J
Mostly harmless
OP Offline
Mostly harmless
J
Joined: Jul 2014
Posts: 1
I have an event that triggers and I would like to find the elapsed time since the last run. I have messed around with the time and date stuff but can't figure out the right format to use that will work over multiple days (friday morning compared to thursday night).

Also, just to make sure I have the right layout idea, (with a preset oldtime) I can:

start the on event
store newtime
compare old and new
output text based off of difference
set oldtime from newtime
end the on event

Is that about right?

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Set a variable %oldctime when the event occurs to $ctime, and check before this, that the variable exists, to announce the time since the last run, let's suppose the event is a simple on text:
Code:
on *:text:!newevent:#:{
  if (%oldctime != $null) {
    var %diff = $ctime - %oldctime
    msg $chan Last event was on $asctime(%oldctime) -- time elapsed since: %diff seconds, or $duration(%diff)
  }
  msg $chan New event!!
  set %oldctime $ctime
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard