This little snippet tracks mIRC's uptime as a percentage using the time mIRC has been open divided by the time since the script was started. It even protects against crashes by periodically saving the uptime.
Just load the snippet and type /uppercent to see how much of the time since you loaded the script mIRC has been running.
Example:
Uptime Percentage: 99.235506% since Mon Oct 31 23:50:49 2011 (49 seconds later) Uptime Percentage: 99.24338% since Mon Oct 31 23:50:49 2011 You can watch your up time percentage increase the longer you've been up, assuming you aren't at 100%. Just know that once you drop below 100% it's impossible to reach 100% (theoretically at least, rounding will let you get 100% after long enough lol). ```mirc /* [Addon] Script=Uptime Counter Version=1 Author=pball Desc=Tracks uptime of mIRC For=Mirc Date=10-31-2011 [script] */ on *:start:{ if (!%uptimepercent.beginning) set %uptimepercent.beginning $ctime if (%uptimepercent.temp) set %uptimepercent.up $calc(%uptimepercent.up + (%uptimepercent.temp - %uptimepercent.start)) set %uptimepercent.start $ctime .timer -o 0 600 set %uptimepercent.temp $!ctime } on *:exit:{ set %uptimepercent.up $calc(%uptimepercent.up + ($ctime - %uptimepercent.start)) unset %uptimepercent.temp } alias uppercent { say 7Uptime Percentage: $calc(100* ( %uptimepercent.up + ( $ctime - %uptimepercent.start )) / ( $ctime - %uptimepercent.beginning ) ) $+ % since $asctime(%uptimepercent.beginning) } ```I do believe this is wut dani was trying to do:
on *:LOAD:set %UTPerc:Beg $ctime
on *:START:set -e %UTPerc:Str $ctime
alias uppercent {
var %p = $round($calc(($ctime - %UTPerc:Str + %UTPerc:Tot) / ($ctime - %UTPerc:Beg) * 100),2) $+ %
say Uptime Precent: %p since $asctime(%UTPerc:Beg)
}
on *:EXIT:inc %UTPerc:Tot $calc($ctime - %UTPerc:Str)
on *:UNLOAD:unset %UTPerc:*
napa182, I was just saying has has a fond admiration for jaytea is all, and then he called me a name. He has a constant period outbreak for no reason. I don't know why, but then when you look at his avatar, which shows a long, pissed-off face, and my comment, you'll begin to know why.
Thanks pball, I wish everybody could be as open minded as you. Let's all be happy, excluding the mad one up there, shall we?
P.S. I feel bad napa182 has to endure this unexpected ordeal and makes himself available for comment after being unavailable for a while.
That wouldn't work well for people who replace the exe to update like me. That also does online time verses uptime which is what I'm going more for. So if your internet goes off the online timer stops until you reconnect. Since I personally have mirc open all the time my computer is running.
edit:
slightly better example of why not to check mirc.exe creation date. many people use already setup clients and the creation date would be whenever that was originally setup
I don't know if you tested that but I noticed a problem with your math, you don't want to subtract $ctime from $uptime in the first part of the math. You are also missing a ) at the end of your $calc statement.
Also this will provide incorrect results if you use $uptime. Because if you load this after mirc has been running the uptime will be larger than the time the script has been running. Which will result in an uptime of over 100% which is incorrect.
Example of loading script and showing output:
<~pballz> Uptime Percentage: 163157.5% since Tue Nov 01 17:59:08 2011