|
Rebel Novice
Joined: 29 Oct 2007 Posts: 33
|
Posted: Tue Nov 27, 2007 6:15 pm
Can I display a 5 day timer? |
From my mud I can receive lines like
Reboot in: 3 days 22 hours 52 minutes 30 seconds
Is it possible to synchronise, and have permanently on display, a zMud clock/timer using the above line as a trigger?
A simple 94 hrs would be sufficient in this case - but i can't figure out how to do it
Can it be done?
Thanks in advance
Rebel |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Nov 27, 2007 6:39 pm |
Unfortunately, the tick timer doesn't support days.
The way you'd capture the time value differs depending on whether or not all the items are always displayed, even if they're 0, or if they disappear when they're 0. If they stay:
#trig {Reboot in: (%d) days (%d) hours (%d) minutes (%d) seconds} {RebootTimer=%eval(%4+%3*60+%2*3600+%1*86400)}
if they disappear:
#regex {Reboot in: (?:(\d+) days )?(?:(\d+) hours )?(?:(\d+) minutes )?(\d+) seconds} {days=%if(%1,%1,0);hours=%if(%2,%2,0);minutes=%if(%3,%3,0);RebootTimer=%eval(%4+@minutes*60+@hours*3600+@days*86400)}
Now we have a reboot timer variable that contains the number of seconds until the next reboot. So you create an alarm like so:
#alarm 1 {RebootTimer=@RebootTimer-1}
To decrement the counter every second. You can change this to be whatever time period you like if you don't want an alarm running that often.
Now, to display it, you just divide the number by the number of seconds in an hour, minute, day, week, or whatever, and put the code that does that in your status bar or a button caption or whereever.
Days: %eval(@RebootTimer/86400) Hours: %eval(%mod(@RebootTimer,86400)/3600) Minutes: %eval(%mod(%mod(@RebootTimer,86400),3600)/60) Seconds: %mod(%mod(%mod(@RebootTimer,86400),3600),60)
I'm sure there's a more elegant way to do that. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Nov 27, 2007 6:44 pm |
You have a few options. You can trigger on that line to get the time.
Then you can:
a) Convert it to seconds then use #TIMER and #TSET to set it so that it displays in the command line.
b) Convert it to the format of a #ALARM and have the alarm pop up a few minutes before the reboots.
c) Convert it to a time format (i.e. seconds, or minutes or hours) store it in a variable. Then have an an alarm that fires every hour, minute etc.. (based on what you chose for the variable) that updates the variable and displays either on the screen or in a #MESSAGE
d) Convert it to a time format (i.e. seconds, or minutes or hours) store it in a variable. Display that variable in your status window of status line. hen have an an alarm that fires every hour, minute etc.. (based on what you chose for the variable) that updates the variable.
I hope that helps.
[Edit] Ninjaed by Fang and apparently Option A won't cut it. |
|
_________________ Asati di tempari! |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|