Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: anagura.raziel on August 21, 2009, 12:21:06 pm

Title: [Resolved] Advanced Time of Day/Day of Week
Post by: anagura.raziel on August 21, 2009, 12:21:06 pm
I noticed there were scripts that detect the date and time from the windows calender thing and I was wondering if it were possible to take that a step further by changing what happens depending on the time.

For example, My game has a church and I wanted there to be a set of events that only triggered if you play it on a sunday.
In future, it might be cool to have to wait until a specific hour of the day to access other areas/events as well.


If there's already a script like this out there, please send me a link. I searched the forums but "time of day script" etc. is pretty vague and wasn't very helpful.
Title: Re: Advanced Time of Day/Day of Week
Post by: shdwlink1993 on August 21, 2009, 02:43:19 pm
To see if the computer says it's Sunday, you'd use a conditional branch that checks if this script is true:

Time.wday == 0


To see what hour it is, you'd use a conditional branch with this:

Time.hour == 14

(That's in military time)

For other functions and such in this class, you'll want to read this (http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_c_time.html) Ruby Documentation.
Title: [Resolved] Advanced Time of Day/Day of Week
Post by: anagura.raziel on August 21, 2009, 03:38:26 pm
Oh, I see... Kinda feel stupid now, haha.

Thanks for your help though. I would never have figured it out.