* little scripts update.
* added new script: uptime.def
This commit is contained in:
parent
2d90dc3cfe
commit
2e703f52b1
@ -17,6 +17,10 @@ APPLYPERMISSIONS
|
||||
// preload the scripts, however its not important to load them now.
|
||||
//they will get loaded automatically if needed
|
||||
LOADALL
|
||||
|
||||
// load the uptime counter
|
||||
LOADDEF uptime
|
||||
|
||||
// RELOADDEF myscript
|
||||
// ...
|
||||
|
||||
|
||||
@ -31,6 +31,9 @@
|
||||
|
||||
// we need this variable later as "array-index"
|
||||
set,x 0
|
||||
|
||||
// unregister the timer if it has been registered before
|
||||
removeevent event_{${@myname}}
|
||||
|
||||
// register the timer.
|
||||
// script name is "autobroadcast", so the event name will be "event_autobroadcast" and the script command to call will be "autobroadcast"
|
||||
|
||||
29
bin/scripts/uptime.def
Normal file
29
bin/scripts/uptime.def
Normal file
@ -0,0 +1,29 @@
|
||||
#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
|
||||
|
||||
#onload
|
||||
set,#uptime 0
|
||||
removeevent event_{${@myname}}
|
||||
addevent,event_{${@myname}},1000 add,#uptime 1
|
||||
#endonload
|
||||
|
||||
set,s ${#uptime}
|
||||
|
||||
set,h ${s}
|
||||
div,h 3600
|
||||
mod,s 3600
|
||||
|
||||
set,m ${s}
|
||||
div,m 60
|
||||
mod,s 60
|
||||
|
||||
out UPTIME: ${#uptime} secs = ${h}h ${m}m ${s}s
|
||||
say UPTIME: ${h} hours, ${m} minutes, ${s} seconds
|
||||
|
||||
unset h
|
||||
unset m
|
||||
unset s
|
||||
Loading…
x
Reference in New Issue
Block a user