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
ebaptist
Newbie


Joined: 16 Oct 2002
Posts: 7
Location: USA

PostPosted: Tue Apr 05, 2005 2:20 am   

Setting up a game timer and its not working quite right.
 
Ok i set this up to work to calculate game time in our mud. Problem is this

settime 12 00 for example so its 12pm

it starts to run and when it gets to 12:59 it keeps counting i.e. 12:71 it doesnt roll the hour over.. what did i miss?
Code:

#CLASS {GameTime}
#ALIAS settime {
  #VARIABLE hours %1
  #VARIABLE mins %2
  }
#VARIABLE hours {0}
#VARIABLE mins {0}
#ALARM {*15} {
  #ADD mins 1
  #IF (@mins >= 60) {
    #ADD hours 1
    #VARIABLE mins 0
    }
  #IF (@hours >= 24) {#VARIABLE hours 1}
  }
#STATUS {Game Time: %if( @hours > 12, %eval( @hours - 12), @hours):%if( @mins < 10, 0)@mins %if( @hours > 12, "pm", "am")}
#CLASS 0
Reply with quote
Maelstrom
Apprentice


Joined: 10 Feb 2005
Posts: 158

PostPosted: Tue Apr 05, 2005 3:07 am   
 
Works good here on my machine... I tied to foul it up but couldn't.
The only thing I can see even remotely fishy is:

#IF (@hours >= 24) {#VARIABLE hours 1}

Should be {#VARIABLE hours 0} I think or you'd gain an hour every 24...
Edit: NM, I cant find anything wrong with this script...
Reply with quote
ebaptist
Newbie


Joined: 16 Oct 2002
Posts: 7
Location: USA

PostPosted: Tue Apr 05, 2005 12:49 pm   
 
im officially embarrassed lol. When i wrote this script and pasted it into zmud it autoexpanded the @minutes variable in the *15 trigger.

I put it back the way it was in this post its working great. sigh. Sorry guys thanks for looking at it. I realized my mistake just now its a perfectly working game timer if your game has time set to 15 seconds per minute.
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