menu nicklist,status,channel {
Stopwatch
.Start { start }
.Stop { stop }
.Reset { reset }
.Status { status }
}
alias start {
if (%previous == 1) goto previous
if (%sw == 1) halt
msg $chan Stopwatch started
set %sw 1
set %time $ctime
halt
:previous
unset %previous
set %time $calc($ctime - %time)
msg $chan Stopwatch restarted
halt
}
alias stop {
if (%time == $null) halt
set %total $calc($ctime - %time)
set %check $asctime(%total,HH:nn:ss)
msg $chan Stopped: %check
set %previous 1
set %time %total
}
alias status {
if (%previous == 1) goto previous
if (%time == $null) halt
set %total $calc($ctime - %time)
set %check $asctime(%total,HH:nn:ss)
msg $chan Timing: %check
halt
:previous
msg $chan Paused: %check
halt
}
alias reset {
if (%time == $null) halt
msg $chan Stopwatch reset
unset %time %total %previous %sw %check
}