- Joined
- Jan 23, 2014
- Messages
- 171
- Reaction score
- 24
- First Language
- English
- Primarily Uses
- RMMZ
Hi Selchar,
This might be a silly question, but for the live of me I can't figure this out.
I have a common event called "wait" that allows the player to move time forward by a certain amount of hours.
It works fine, but if the player waits for longer than a value more than 24 hours it doesn't do the time correctly.
This is for the Calendar Clock Add-on (as far as I know) but could also be the Calender itself.
Example: Ideally, if the player decides to wait 13 hours after 9PM it should be 10AM right?
What happens: It makes it 22PM and then switches it to 12AM the next day. Any idea how to fix this?
The Game Variable for hour would be at 21, and the wait command would add 13 to that, making the total 34.
I think it has something to do with this:
EDIT: I found a solution actually, in my common event I just took the input from the user and when added (if bigger than 24) and subtracted 24 to get the correct number. So the time is correct and but the day isn't >:C
I am curious if there is a script version of my solution? If not, I'll keep my common event.
EDIT2: I got the day to work with the script call HM::SEL::next_day($game_variables[228])
$game_variables[228] is my Hour variable.
Hooray~
This might be a silly question, but for the live of me I can't figure this out.
I have a common event called "wait" that allows the player to move time forward by a certain amount of hours.
It works fine, but if the player waits for longer than a value more than 24 hours it doesn't do the time correctly.
This is for the Calendar Clock Add-on (as far as I know) but could also be the Calender itself.
Example: Ideally, if the player decides to wait 13 hours after 9PM it should be 10AM right?
What happens: It makes it 22PM and then switches it to 12AM the next day. Any idea how to fix this?
The Game Variable for hour would be at 21, and the wait command would add 13 to that, making the total 34.
I think it has something to do with this:
def self.current_time? hour = $game_variables[HOUR] minute = $game_variables[MIN] if hour == 0 hour = 12 else if hour >= 13 hour -= 12 end end #.to_s when used on a number's variable, turns it into a string? if hour < 10 hour = ' ' + hour.to_s else hour.to_s end if minute < 10 minute = '0' + minute.to_s else minute.to_s end #Resulting text for the method. return hour.to_s #+ ':' + minute.to_s end
I am curious if there is a script version of my solution? If not, I'll keep my common event.
EDIT2: I got the day to work with the script call HM::SEL::next_day($game_variables[228])
$game_variables[228] is my Hour variable.
Last edited by a moderator: