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
Necro
Beginner


Joined: 22 Mar 2003
Posts: 10
Location: USA

PostPosted: Tue Jul 22, 2003 2:21 am   

Build Timer
 
Hi. I've learned a lot about Zmud in the past year and the help you all have given me has proven invaluable. Thanks to all who have assisted me.

What I'm wanting to do is a Timer. I'm not sure if it is even possible. I haven't figured it out and would like suggestions. I play Inferno. You earn builds that are used to train new skills or increase existing ones. I would like to create a timer that would tell me how long between each build.

When you earn a build you get this message:

*** You gain a build!

What I'm hoping to do is create a timer that will start over each time I recieve that message and then display the last total build time. Something like...

*** You gain a build!

"Starting new build time."
"Your last build time was 2400 seconds." Or 40 minutes or something I can convert to hours or minutes.

Is that possible? Or should I stick to the "watch the clock method"? LOL :)

Thanks
Reply with quote
DeathShadow
Adept


Joined: 11 Nov 2000
Posts: 228
Location: USA

PostPosted: Tue Jul 22, 2003 2:39 am   
 
Greetings,

I would use the %ctime internal variable in zmud. %ctime is your connected time to the zmud in seconds.

Trigger on *** You gain a build! and store %ctime in a variable. Once you get that information you just need to subtract the old %ctime with the current %ctime to get the effect your looking for.

Rather then script the whole thing for you (not much fun in that) ill leave it at that.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jul 22, 2003 2:49 am   
 
#TR {^~*~*~* You gain a build!} {#MATH buildtime (%secs - @buildclock)/1000;#VAR buildclock %secs;#IF (@buildtime < 0) {#ADD buildtime 86400};#SAY Your last build time was @buildtime seconds.}
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Tue Jul 22, 2003 6:28 am   
 
There's a script for a generic timer/stopwatch thingy..
http://zuggsoft.com/forum/topic.asp?TOPIC_ID=8699&SearchTerms=stopwatch

I don't recommend using JLaxons addon to it unless you specifically want the statistical output he wrote... its complex and a bit slower, though it does work.
Reply with quote
Necro
Beginner


Joined: 22 Mar 2003
Posts: 10
Location: USA

PostPosted: Thu Aug 21, 2003 1:24 am   
 
Ok. Lightbulb, thanks I used basically what you wrote. I put it in a trigger and I have tested it for a month. It does what I wanted. Just a basic tool to help me know if my training is spent wisely or if I need to hunt more powerful creatures or train harder to earn builds faster. Thanks Lightbulb.

#TR {You gain a build!} {
#MATH buildtime (%secs - @buildclock)/1000
#VAR buildclock %secs
#IF (@buildtime < 0) {#ADD buildtime 86400}
#SAY Your last build time was @buildtime seconds.}

I divide the result by 60 to get minutes and 60 again to get hours if needed. I don't mind that, but if there is an easier way, like if I can change the %secs to %mins it would be easier. I'll try it and see if it works or not.

The other thing is.. Notice my last build time is 86400 seconds. That's 1440 minutes. Build times are between 30 and 90 minutes usually. What happens is, the timer continues to time, while I've logged out of the game, so the only accurate readings I get are when I earn more than one build while playing the game.

Any suggestions on how I could cause the Build Timer to stop counting when not connected to the mud and then continue the count the next time I connect to the game?

Thanks.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Aug 21, 2003 2:48 am   
 
%secs is a system variable, giving the number of milliseconds since midnight. There are no corresponding variables for minutes or hours. When the clock passes midnight, it goes from 86399999 to 0. The 86400 (number of seconds in a day) is simply an adjustment for this change.

If you prefer minutes, just include that in your math. Instead of dividing by 1000, divide by 60000.

Starting and stopping as you connect and disconnect requires another variable to hold the leftover time.
#VAR buildtime2 0
#AL atconnect {#VAR buildclock %secs}
#TR {You gain a build!} {
#MATH buildtime (%secs - @buildclock)/60000
#VAR buildclock %secs
#IF (@buildtime < 0) {#ADD buildtime 1440}
#ADD buildtime @buildtime2
#VAR buildtime2 0
#SAY Your last build time was @buildtime minutes.}
#AL atdisconnect {
#MATH buildtime2 (%secs - @buildclock)/60000
#IF (@buildtime2 < 0) {#ADD buildtime2 1440}}
Reply with quote
Necro
Beginner


Joined: 22 Mar 2003
Posts: 10
Location: USA

PostPosted: Wed Aug 27, 2003 4:28 am   
 
Thanks Lightbulb. You've been a great help. I'm learning. Ever so slowly. Smile
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