Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
fattony
Apprentice


Joined: 27 Dec 2001
Posts: 105
Location: USA

PostPosted: 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
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: 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
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net