* various .def scripts updates * added cmd.def & getchatitem.def * fixed: correctly check variable names in function "isset" * fixed problems with loading scripts that cosist captalized IF/ENDIF/LOOP/ENDLOOP statments. now upper, lower and mixedcase work as they should.
40 lines
729 B
Modula-2
40 lines
729 B
Modula-2
#permission=0
|
|
|
|
// purpose: pseuwow uptime counter
|
|
// args: none
|
|
// usage: - load the script to register the uptime counter
|
|
// - call the script to say the uptime formatted in hours, mins & secs
|
|
// returns: uptime formatted as 0h 0m 0s
|
|
|
|
#onload
|
|
if ?{not ?{isset #uptime}}
|
|
set,#uptime 0
|
|
endif
|
|
removeevent event_{${@myname}}
|
|
addevent,event_{${@myname}},1000 add,#uptime 1
|
|
#endonload
|
|
|
|
set,s ${#uptime}
|
|
|
|
set,h ${s}
|
|
div,h 3600
|
|
toint,h ${h}
|
|
mod,s 3600
|
|
|
|
set,m ${s}
|
|
div,m 60
|
|
toint,m ${m}
|
|
mod,s 60
|
|
toint,s ${s}
|
|
set,str ${h}h ${m}m ${s}s
|
|
out UPTIME: ${#uptime} secs = ${str}
|
|
|
|
if ${@inworld}
|
|
say UPTIME: ${h} hours, ${m} minutes, ${s} seconds
|
|
endif
|
|
|
|
unset h
|
|
unset m
|
|
unset s
|
|
|
|
return ${str} |