|
BlackSmith Apprentice
Joined: 08 Dec 2002 Posts: 152
|
Posted: Wed Oct 26, 2005 7:57 pm
%time, variable and way to compire their values |
I have seen handfull of version about how to keep record about how long some effect is/has been on and i have made myself a alarm based thingy too, BUT im not statisfied on them. Either they are too complicated (mainly too much variables), inacurate (all those that keep account by X seconds from uptime/midnight/alarms), they become too cpu consuming (~15 one sec alarms going on all the time) or they are too bug vurnable (one missing variable fucks up them real good).
So i was thinking to use %time to get present time and store it to a variable or chop it down to a string list, and when i want to know how much of time has gone i just compare the time stamp stored in that variable and the present time.
I know how to do the framework/foundation but geting the %time's output in to a variable (and to a string list if possibe) in a form that it can be compared is the problem.
Help would be very much appreciated. |
|
_________________ BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Oct 26, 2005 10:30 pm |
The %time function allows you to specify its format string, and is pretty clearly spelled out in the help file. Something like
%eval(%time("dd*24)+hh*60+nn)*60+ss"))
Should do you up to days. You could always script further up to years if you have trouble figuring out how to pick up midnight. I used to have a script that ran from 11pm till 12pm, 7 days a week. Its design was exp gain, and it gave a continuous exp per hour output. I had no problems with using %secs. I also did my time updates for it on my actual text triggers rather then using an alarm. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
BlackSmith Apprentice
Joined: 08 Dec 2002 Posts: 152
|
Posted: Wed Oct 26, 2005 11:50 pm |
Vijilante wrote: |
The %time function allows you to specify its format string, and is pretty clearly spelled out in the help file. |
Yes it is. Like i said in my post, i have the skeleton right. I need help getin multiple values to one variable, aka string list.
Vijilante wrote: |
Something like %eval(%time("dd*24)+hh*60+nn)*60+ss"))Should do you up to days. You could always script further up to years if you have trouble figuring out how to pick up midnight. |
I stumbled on something like your suggestion in my researches, but i cant hack the idea of neither of your or this:
Quote: |
#ALIAS timer {
#math %1 (%time(yyyy)-1970)*365*24*60*60)
#math %1 @%1+(%time(m)*30*24*60*60)
#math %1 @%1+(%time(d)*24*60*60)
#math %1 @%1+(%time(h)*60*60)
#math %1 @%1+(%time(n)*60)
#math %1 @%1+%time(s)
}
#ALIAS formattime {
timer currenttime
#math tmptime @currenttime-@%1
#math tmpmin @tmptime/60
#math tmpsek @tmptime-(@tmpmin*60)
#if (@tmpmin=0) {#var timed [@{tmpsek}s]} {#var timed [@{tmpmin}m@{tmpsek}s]}
} |
Thus if i have undestod it right, both translates present timeto a huge (second's) value and the difference of the two time stamps is then in form of seconds, right?
Vijilante wrote: |
I had no problems with using %secs. |
I had. Before midnight casted effects contiuning over midnight flipped, and effects having longer than 24h effect were a lost cause.
Vijilante wrote: |
I also did my time updates for it on my actual text triggers rather then using an alarm. |
I ment that multiple alarm triggs to keep track of each effects time, not that it scans each second if some effect is on. |
|
_________________ BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient. |
|
|
|
BlackSmith Apprentice
Joined: 08 Dec 2002 Posts: 152
|
Posted: Sat Nov 05, 2005 2:32 pm |
anyone?
|
|
_________________ BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient. |
|
|
|
Pseudo Wanderer
Joined: 25 Oct 2005 Posts: 99
|
Posted: Sat Nov 05, 2005 5:06 pm |
Without an example of the exact format you are looking for, here is your string list including date and time. This example uses 24 hours in a day, NOT am/pm.
#VAR DateTime %mss(Hour(Now)&"|"&Minute(Now)&"|"&Second(Now)&"|"&Month(Now)&"|"&Day(Now)&"|"&Year(Now)) |
|
|
|
|
|