|
fattony Apprentice
Joined: 27 Dec 2001 Posts: 105 Location: USA
|
Posted: Thu Jan 24, 2002 7:44 pm
Math and %time |
I was wondering if there is a way to perform basic math functions on the %time function. I thought of showing only the hours and minutes, dividing that down to one lump sum of minutes, etc. but I need the date calculated too. I'm trying to make an alias to show when the last time I died, casted a spell, recieved certain messages, etc from the MUD. Anybody know how to pull this off?
uhhuh |
|
|
|
Troubadour GURU
Joined: 14 Oct 2000 Posts: 556 Location: USA
|
Posted: Thu Jan 24, 2002 10:00 pm |
Save the indivual components of the date and time as a string list:
#var lastevent {%time(yyyy)|%time(mm)|%time(dd)|%time(hh)|%time(nn)|%time(ss)}
Then to calculate durations perform integer division and modulus operations between like components.
Troubadour |
|
|
|
Troubadour GURU
Joined: 14 Oct 2000 Posts: 556 Location: USA
|
Posted: Thu Jan 24, 2002 10:06 pm |
Better yet, save them as a record variable:
#var lastevent {yyyy=%time(yyyy)|mm=%time(mm)|dd=%time(dd)|hh=%time(hh)|nn=%time(nn)|ss=%time(ss)}
The doing the math is just a matter of comparing the components.
#MATH dsecs {%time(ss) - @lastevent.ss}
Troubadour |
|
|
|
|
|