From 2e703f52b135371b42d9885298e8241f775dbd29 Mon Sep 17 00:00:00 2001 From: "False.Genesis" Date: Sat, 17 Feb 2007 20:43:46 +0000 Subject: [PATCH] * little scripts update. * added new script: uptime.def --- bin/scripts/_startup.def | 4 ++++ bin/scripts/autobroadcast.def | 3 +++ bin/scripts/uptime.def | 29 +++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 bin/scripts/uptime.def diff --git a/bin/scripts/_startup.def b/bin/scripts/_startup.def index 4663d56..916ed04 100644 --- a/bin/scripts/_startup.def +++ b/bin/scripts/_startup.def @@ -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 // ... diff --git a/bin/scripts/autobroadcast.def b/bin/scripts/autobroadcast.def index cb4bf6f..fe6b83f 100644 --- a/bin/scripts/autobroadcast.def +++ b/bin/scripts/autobroadcast.def @@ -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" diff --git a/bin/scripts/uptime.def b/bin/scripts/uptime.def new file mode 100644 index 0000000..26d4891 --- /dev/null +++ b/bin/scripts/uptime.def @@ -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 \ No newline at end of file