The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => Topic started by: neutral12 on May 03, 2011, 01:35:39 AM

Title: [RPGXP] Real 24-hour clock system, how do I make this work?
Post by: neutral12 on May 03, 2011, 01:35:39 AM
Hello. I was looking into this for quite some time now. I wanted to make a clock system in my game where it tells you the real time in 00:00 format. For example, lets say you click a clock in somebody's room. It would find the system time and display that in 00:00 format (for example, 8:33 pm). I'm assuming this might be a script. But either way. I was hoping to find a working system for this feature. I have looked all over the place (including google/youtube) and I haven't found one that works. Perhaps someone here has made it possible? One that works? It has been bugging me for quite some time now, and I never found a working one. Nor do I have the scripting knowledge to figure it out (I hope some time I have the knowledge in the future, at least).

~Neutral
Title: Re: [RPGXP] Real 24-hour clock system, how do I make this work?
Post by: ForeverZero on May 03, 2011, 04:33:17 AM
You use this script call:

Code: [Select]
t = Time.now
s = "#{t.hour}:#{t.minute}"
$game_variables[ID] = s

Replace ID with whatever ID of a game variable you want to use for it.
You can then make a normal evented message with this:

"The current time is \v[ID]."
Title: Re: [RPGXP] Real 24-hour clock system, how do I make this work?
Post by: neutral12 on May 03, 2011, 08:17:10 PM
Uhh, i'm having a problem with this code at the moment.

http://i176.photobucket.com/albums/w177/Neutral12/error.png

Every time I run the event when I click it, I get this error message. I included the coding for the event.
Title: Re: [RPGXP] Real 24-hour clock system, how do I make this work?
Post by: game_guy on May 04, 2011, 12:11:26 AM
Try time.min
Title: Re: [RPGXP] Real 24-hour clock system, how do I make this work?
Post by: ForeverZero on May 04, 2011, 02:13:10 AM
Yeah, gg's right. I don't know why I wrote "minute", its "min".
Title: Re: [RPGXP] Real 24-hour clock system, how do I make this work?
Post by: neutral12 on May 04, 2011, 02:21:18 AM
Thank you so much, this solved my issue with the clock. I appreciate it so much.

One more question though. I was also interested in adding day and night. Is it possible to make it so the game will check for a certian time on your system clock; then depending on that time, it will tint your screen darker for night. Then check your system clock for another time which makes it morning? How can I accomplish this?
Title: Re: [RPGXP] Real 24-hour clock system, how do I make this work?
Post by: ForeverZero on May 04, 2011, 03:43:53 AM
You could use a Common event with a parallel trigger.

Use variations of this little snippet:
Code: [Select]
Time.now.hour == HOUR

Replace HOUR with an actual number, and use this as a conditional branch.
Then have a command set the screen tone accordingly.

That's your most basic way of doing it. There are multiple time system scripts around, though they are usually a little more in-depth than just doing what you asked.