Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Time?
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Malti
USA (55 posts) Bio
|
| Date
| Fri 13 Jul 2007 09:24 PM (UTC) |
| Message
| | Okay so here is the deal. A normal hour in the mud is roughly (or exactly) 60 seconds. How do I extend the hour to 5 minutes persay? I know the hour gets updated in weather_update which gets called in update.c from do_update or whatever. Can I see it so that this gets called every 5 pulses or so? Any suggestions/codes would be appreciated. Thanks | | Top |
|
| Posted by
| Samryn
United Kingdom (60 posts) Bio
|
| Date
| Reply #1 on Sat 14 Jul 2007 01:24 AM (UTC) |
| Message
| I think your after the code in db.c
lhour = ( current_time - 650336715 ) / ( PULSE_TICK / PULSE_PER_SECOND );
time_info.hour = lhour % 24;
lday = lhour / 24;
time_info.day = lday % 35;
lmonth = lday / 35;
time_info.month = lmonth % 17;
time_info.year = lmonth / 17;
If im correct... an hour is a day. So there for changing the 24 to a smaller number, should reduce the speed of time passing by...
Hope its what you want. |
Samryn Medri | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #2 on Sat 14 Jul 2007 03:20 AM (UTC) |
| Message
| | I think that's the code to set up the initial time. I think you want to be looking at update.c -- every tick increment, it decides whether or not it is time to increment the various clocks like in-game hours, days, months... |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Malti
USA (55 posts) Bio
|
| Date
| Reply #3 on Sat 14 Jul 2007 05:28 AM (UTC) |
| Message
| | It is in update.c, i am well aware. However, I do not know how to extand it from updating every pulse/tick which I believe is every minute? Any help is greatly appreciated. Thanks | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #4 on Sat 14 Jul 2007 06:07 AM (UTC) |
| Message
| Well, if you go to update_handler, you'll see that when pulse_point gets to zero it calls a bunch of functions like time_update, which adds an hour to the clock. It also resets pulse_point to be PULSE_TICK plus or minus a little noise.
If you want to make hours longer, you have several options:
- You can make everything about hours take longer, in which case you would increase PULSE_TICK (you'd have to work out the math to figure out what value to use depending on how long you want it to last; look at pulse/second and tick/second etc.)
- You can leave char updates, weather etc. at the current frequency (~1 minute) and only have the hours take longer; that's a little harder and you will need another counter for that. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Gohan_TheDragonball
USA (183 posts) Bio
|
| Date
| Reply #5 on Sat 14 Jul 2007 06:10 AM (UTC) |
| Message
| mud.h:
#define PULSE_TIME (PULSE_PER_SECOND * 3)
update.c:
void update_handler() ----
if (--pulse_time <= 0)
{
pulse_time = (PULSE_TIME/6);
time_update();
}
void time_update() ----
time_info.minute++ >= 60
I do not remember how stock smaug is setup, as i changed mine quite some time ago. But essentially this setup gives me 1 mud minute every 1.5 seconds, making that 1 mud hour every 90 seconds. But the pulse_time variable in update_handler is what will be controlling your mud time. i recommend not changing the define in mud.h, as i recall it messed things up considerably, can't remember what happened though. | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
23,312 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top