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


Joined: 07 May 2007
Posts: 19

PostPosted: Mon Aug 27, 2007 1:08 pm   

MUD clock question
 
Hi,

I have a question about making a MUD clock for the mud I play
In the mud I play, 24hours in real life are 2hours in the game(we have 1 day, which is represented by 1 hour of "day" and 1 hour of "night")...What I want to do is make a clock which is constant, to appear in zMUD indicating the time which my MUD is currently at...I have no idea how to make this, but I'm sure it's do-able.
I appreciate any help and suggestions

Thank you in advance

P.S: 24h = 2h ; 12h = 1h ; 6h = 30 minutes ; 3h = 15 minutes ; 1h = 5 minutes ; 30 minutes = 2.5minutes

Syntax: RL time ; MUD time

Again, thanks alot
[/code]
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Aug 27, 2007 1:20 pm   
 
You'll need to find a way of synching the timer with the MUD time when you first log in, but once that's done you can just use something like this:

#alarm {1} {#add CurrentTime 12}

This will add 12 seconds to the current time every 1 one real second. You can customise the time it takes for each update to make it slower if you want.

Then you need something to reset the timer each in-game midnight (this will also set the time when you first log in if there's no better way).

#trig {It is midnight} {CurrentTime=0}

Then, finally, to display hours, minutes and seconds, you just do maths on the CurrentTime number:

#say The time is %if(@CurrentTime>3600,%eval(@CurrentTime/3600),00):%if(@CurrentTime>60,%eval((@CurrentTime/60)\60),00):%if(@CurrentTime>0,%eval(@CurrentTime\60),00)

EDIT: Added some colour to help break up the three different calculations.

the \60 part in that command might confuse you - it gives the modulus of @CurrentTime, that is, the remainder when @CurrentTime is divided by 60. What it means is that if @CurrentTime were, say, 3660, that the minutes number will correctly display 1 instead of 61.

PS. You might find you need to "pad out" the numbers with 0s when they're below 10. You can do this with the %format function or with something like:

%concat(%if(@num<10,0),@num)
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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