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: Tue Aug 13, 2002 12:53 am   

Timer Options
 
Are there any other viable solutions for tracking time, other than %ctime, %secs and an #alarm? I need to track seconds, but all three of those choices have problems keeping them from working well. The trigger I need it for tracks my exp rate. %ctime messes up my rate big time if I go link dead and reconnect. %secs bugs if I play through midnight. And using an #alarm that fires every second causes my zMUD to lag and usually crash.

Any ideas?

Fat Tony
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Aug 13, 2002 2:54 am   
 
You can look at the tick timer #TS and cause it to fire ever time period and update a
variable.

I usually make a patch for midnight and %secs checks myself.

Ton Diening
Reply with quote
fattony
Apprentice


Joined: 27 Dec 2001
Posts: 105
Location: USA

PostPosted: Tue Aug 13, 2002 3:05 am   
 
I forgot to list the tick timer, but I have tried that one as well and it isn't effective for what I need it to do, but thanks for reminding me of its presence.

May I ask how you got around the %secs? I'd appreciate any help you can give, but if not, I'll work through it as best I can.

Fat Tony
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Aug 13, 2002 3:14 am   
 
The key is to track when you started tracking %secs. You realize that you can extract
the time from secs with:

#SH %eval(%secs/1000/60/60) hr %eval(%secs/1000/6060) min

You then know %secs goes to midnight. #SH %eval(24*60*60*1000) or 86400000 ms

#VAR V_secs_start %secs

do stuff

#VAR V_secs_end %secs

When you do your calculation with them you take into consideration if the start>end.

#IF (@V_secs_end > @V_secs_start) {#VAR V_secs_time [@V_secs_end-@V_secs_start]} {#VAR V_secs_time [@V_secs_end + 86400000 - @V_secs_start]}

Now you can use @V_secs_time for the differential milli second time it took to do what you
want to figure out.

Ton Diening
Reply with quote
fattony
Apprentice


Joined: 27 Dec 2001
Posts: 105
Location: USA

PostPosted: Tue Aug 13, 2002 3:11 pm   
 
Very very cool, I had thought of doing something like that, but couldn't figure out how to get around the midnight reset of %secs. Thank you for your help.

Fat Tony
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Aug 13, 2002 6:44 pm   
 
You could also use the time function. I'm assuming you wouldn't play for more than 24 hours at a time (or at least wouldn't try to track experience for longer than that). If you did, additional calculations would be needed.

;capture start date and time
#VAR ExpDate1 {%time(%d)};#MATH ExpTime1 {(%time(h) * 3600) + (%time(n) * 60) + (%time(s))}
;do stuff
;capture end date and time

#VAR ExpDate2 {%time(%d)};#MATH ExpTime2 {(%time(h) * 3600) + (%time(n) * 60) + (%time(s))}
;do calculations
#IF (ExpDate2 = ExpDate1) {#MATH ExpSecs {@ExpTime2 - @ExpTime1}} {#MATH ExpSecs {(24 * 3600) + @ExpTime2 - @ExpTime1}}

LightBulb
Senior Member
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