mojo_client/bin/scripts/uptime.def
False.Genesis 7de82dd3a9 * fixed if..else..endif
* small .def update
* misc, minor changes to some functions
* added a few more DefScript functions (and, or, xor, GetObjectType, ObjectKnown)
2007-03-16 16:14:13 +00:00

38 lines
691 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
set,#uptime 0
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}