Vlue 269 Posted April 28, 2012 (edited) Basic Real Time (System Time) v1.0 by V.M. Introduction Simple module to provide a series of functions and escape characters to incorporate system time into games. Features - Use conditional branches to activate or not based on current date or time - Incorporate current date or time within message boxes - Use current date and time within scripts How to Use Plug and play and read. Script Convenient Pastebin: Here Not so convenient but more helpful link here: Here FAQ None at the moment. Credit and Thanks - By V.M. of D.T. - Free to use in any project with credit given Edited August 5, 2012 by Vlue 4 HelixGames, imel, KayDgirl91 and 1 other reacted to this Share this post Link to post Share on other sites
starbrother 3 Posted June 29, 2012 Nicely done bro 1 Vlue reacted to this Share this post Link to post Share on other sites
HelixGames 0 Posted January 24, 2013 Awesome script! Thank you very much for making it! I however need a little help with it... I want to have a christmas event on 24th of December, what eventing stuff (please provide full instructions) do I need to do? Share this post Link to post Share on other sites
Vlue 269 Posted January 25, 2013 Just have an event that's sole purpose is to set a switch when the month is 12 and the day is 24. Conditional branches have script options, it would be: Rtime.month == 12 and Rtime.day == 12 Then you can set up events based on that switch Share this post Link to post Share on other sites
HelixGames 0 Posted January 25, 2013 Thank you for the quick answer! Share this post Link to post Share on other sites
Denna 10 Posted February 19, 2013 (edited) I have some questions, too. Where can I change the name of the weekday? I'm making a german game that's why I need german weekdays not english. The same with the 12 hours system. How can I use the 24 hours system? Edited February 20, 2013 by Shadow-Dragon Share this post Link to post Share on other sites
Vlue 269 Posted February 20, 2013 There are options in there to use the 24 hour clock RTime::time(true) and Rtime::hour(true) the names of the days however are built into the ruby localization that RPG Maker uses. I'll make a workaround for that in a bit Share this post Link to post Share on other sites
Denna 10 Posted February 20, 2013 (edited) There are options in there to use the 24 hour clockRTime::time(true) and Rtime::hour(true) Oops! I overlooked this function, sorry. Edit: Sorry, but I seem to be stupid. I don't get it to work. Please, can you explain me exactly what I have to do? the names of the days however are built into the ruby localization that RPG Maker uses.I'll make a workaround for that in a bit That would be nice. Thank you. Edited February 20, 2013 by Shadow-Dragon Share this post Link to post Share on other sites
Vlue 269 Posted February 20, 2013 Well, what are you trying to do that involves the 24 hour clock? And this is for the days, just paste this below the script and edit the names. module RTime WEEKDAYNAMES = ["Sunday","Monday","Tuesday","Wedsnesday","Thursday", "Friday","Saturday"] WEEKDAYABBRS = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"] def self.day(name = false, abbr = false) return Time.now.day if name == false return WEEKDAYABBRS[dayweek] if abbr return WEEKDAYNAMES[dayweek] end end Share this post Link to post Share on other sites
misttribe 8 Posted February 20, 2013 Can you add a feature, such as, if a map title name has, "[iN]" or whatever tag in the title, it makes the scripts lighting effects for night time and daytime null and resets the tint to default, like being indoors. Then when you go back onto a normal map it resumes the outdoor tint. I remember there being a similar script for VX that allowed this, and it was a pretty handy feature. Share this post Link to post Share on other sites
Denna 10 Posted February 20, 2013 Thank you for the workaround. But unfortunately it works only on weekday itself not at the function "fulltime". Within Script and Conditional Branches That mean the script call, right? So I tried to make a script call with "Rtime::time(true)" and "Rtime::hour(true)" in it before I show a textbox with fulltime. Also I tried to change the setting of "Rtime::time" and "Rtime::hour" in the script itself to true. But this doesn't work, so I changed it back. Share this post Link to post Share on other sites
Vlue 269 Posted February 21, 2013 (edited) @misttribe That'd have to be done in or with the lighting effects script. @Shadow-Dragon Ah, so what you want to do is for fulltime in the textbox to show your localized day/month names and the 24 hour time instead of the 12? Edit: Messed up the quoting on that.. screw it :/ Edited February 21, 2013 by Vlue Share this post Link to post Share on other sites
Denna 10 Posted February 22, 2013 Yeah, that's right. "Fulltime" makes it easier for me to control what I need and what I get. (Don't forget about that I want to use "fulltime" for a clock.) I'm now in the situation that I look what this script can and to compare it with what I need. Besides, this is the only script of its kind I know. But don't misunderstand me, I also need the values of the 24 hours system for conditional branches and script (= script call? - 3rd eventpage). Share this post Link to post Share on other sites
Vlue 269 Posted February 22, 2013 Try this. Also, using the call RTime::hour? will return the current hour of the day in 24 hour format for conditional branches. module RTime MONTHNAMES = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] WEEKDAYNAMES = ["Sunday","Monday","Tuesday","Wedsnesday","Thursday", "Friday","Saturday"] WEEKDAYABBRS = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"] def self.day(name = false, abbr = false) return Time.now.day if name == false return WEEKDAYABBRS[dayweek] if abbr return WEEKDAYNAMES[dayweek] end def self.fulltime a = WEEKDAYNAMES[dayweek] + ", " b = MONTHNAMES[month] c = Time.new.strftime(" %-d, %y %H:%M") return a + b + c end end Share this post Link to post Share on other sites
Denna 10 Posted February 22, 2013 This works perfect. Thank you very much. Share this post Link to post Share on other sites
Notsalony 12 Posted February 26, 2013 YAY! Another one of my favorite scripts added with no errors to my game. -SMILES- And I even managed to make it not rain indoors this time! -SMILES- I'm very happy. 1 Vlue reacted to this Share this post Link to post Share on other sites
yurikoma 1 Posted April 9, 2013 man, back in the day of rpgmaker 2000 and XP I was after a script like this for ages, thanks for putting in the effort to make this. great work 1 Vlue reacted to this Share this post Link to post Share on other sites
P3RR1N 3 Posted October 12, 2015 I am very sorry at the lateness of discovering this wonderful script. I was just wondering...is there a way to have it show and track the month and days within the game clock? Instead of just time of day? Such as : [Mon 22, 6:30 AM] ? Share this post Link to post Share on other sites
Notsalony 12 Posted October 12, 2015 I am very sorry at the lateness of discovering this wonderful script. I was just wondering...is there a way to have it show and track the month and days within the game clock? Instead of just time of day? Such as : [Mon 22, 6:30 AM] ? I think there is if you go in and read through the script on what to put in to get make the display to appear in that format. Hang on. you're wanting day of the week, number of the month, time correct? Yeah if you read the header on the script it tells you how to do that. And the first few lines of the script tells you where to put it. %d %D, %H:%m %T If you want to add in the month in there you want to put in %d, %n %D, %H:%m %T That helpful? Share this post Link to post Share on other sites
P3RR1N 3 Posted October 12, 2015 (edited) I am very sorry at the lateness of discovering this wonderful script. I was just wondering...is there a way to have it show and track the month and days within the game clock? Instead of just time of day? Such as : [Mon 22, 6:30 AM] ? I think there is if you go in and read through the script on what to put in to get make the display to appear in that format. Hang on. you're wanting day of the week, number of the month, time correct? Yeah if you read the header on the script it tells you how to do that. And the first few lines of the script tells you where to put it. %d %D, %H:%m %T If you want to add in the month in there you want to put in %d, %n %D, %H:%m %T That helpful? Is there anyway you could show me a screen cap of where to implement changes? I am so lost. I wholeheartedly apologize on my lack of understanding. *EDIT-again, so sorry!* I am looking to have it Display the abbrv Day of the week, the date of the month, the month abbrv, and the time and year Edited October 12, 2015 by P3RR1N Share this post Link to post Share on other sites
Notsalony 12 Posted October 12, 2015 (edited) Line 54 return Time.now.strftime("%A, %B %-d, %Y %l:%M") Replace everything in the " " with the new string that I provided. If that doesn't look right let me know. edit: okay I read your edit, you want it to read "%a %D, %b,%H:%m %T, %Y" should return something like Mon 12, Oct, 12:58 pm, 2015 Edited October 12, 2015 by Notsalony Share this post Link to post Share on other sites
P3RR1N 3 Posted October 12, 2015 I must not be seeing this right. I cannot seem to find what you mentioned. This is the script: #Basic Game Time + Night/Day v1.6.2#----------##Features: Provides a series of functions to set and recall current game time# as well customizable tints based on current game time to give the# appearance of night and day.##Usage: Script calls:# GameTime::minute? - returns the current minute# GameTime::hour? - returns the current hour# GameTime::set(time) - sets the game time to time, in frames (max:1440)# GameTime::change(time) - increments the game time! (can be negative)# GameTime::pause_time(set) - stops time for events and stuff, true or false# GameTime::pause_tint(set) - time runs, but tints do not update# GameTime::clock(set) - sets whether clock is visible or not##Customization: Set below, in comments.##Examples: GameTime::set(360)##----------##-- Script by: V.M of D.T##- Questions or comments can be:# given by email: sumptuaryspade@live.ca# provided on facebook: http://www.facebook.com/DaimoniousTailsGames# All my other scripts and projects can be found here: http://daimonioustails.weebly.com/##--- Free to use in any project, commercial or non-commercial, with credit given# - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)#---Game Clock---##USE_CLOCK to true to display game time clock#CLOCK_POSITION for position of clock# 1 = topleft, 2 = topright, 3 = bottomleft, 4 = bottomright#CLOCK_TOGGLE is any input button available, see the INPUT help file for options#------#USE_CLOCK = trueCLOCK_POSITION = 4CLOCK_TOGGLE = :Lmodule GameTime#---Game Time Details---##Number of frames in a game minute, 60 frames = 1 secondTIME_COUNT = 60#Sets whether to tint screen based on game timeUSE_TINT = true#Switch to denote day or night timeUSE_SWITCH = falseNIGHT_DAY_SWITCH = 1DAY_TIME_START = 6NIGHT_TIME_START = 18#True to pause time while not in map or while during a messagePAUSE_IN_COMBAT = falsePAUSE_NOT_IN_MAP = truePAUSE_IN_MESSAGE = true#Sets time frames of tints by minute count, one day is 1440 minutes# 0 = 12am, 360 = 6am, 720 = 12pm, 1080 = 6pm etc...PRESUNRISE_TIME = 240SUNRISE_TIME = 360NOONSTART_TIME = 660NOONEND_TIME = 900PRESUNSET_TIME = 1080SUNSET_TIME = 1260MIDNIGHT_TIME = 60 #Must be greater than 0#Sets custome tintsPRESUNRISE_TONE = Tone.new(-75,-75,0,50)SUNRISE_TONE = Tone.new(0,0,0,0)NOONSTART_TONE = Tone.new(45,45,0,-25)NOONEND_TONE = Tone.new(0,0,0,0)PRESUNSET_TONE = Tone.new(-50,-50,0,25)SUNSET_TONE = Tone.new(-75,-100,0,75)MIDNIGHT_TONE = Tone.new(-125,-125,0,125)#Include the ids of any maps not to be tinted based on time# Usually reserved for indoor mapsNOTINTMAPS = [2]#Store current time in a variable?USE_VARIABLE = falseTIME_VARIABLE = 1#---END---#def self.init$game_time = 360$game_time_pause_time = false$game_time_pause_tint = falseenddef self.updateif $game_time_pause_time then return else endcase SceneManager::scene_is?(Scene_Map)when trueif $game_message.visible == true && PAUSE_IN_MESSAGE then else$game_time += 1 if Graphics.frame_count % TIME_COUNT == 0 endwhen falseif !PAUSE_NOT_IN_MAP and !SceneManager::scene_is?(Scene_Battle)$game_time += 1 if Graphics.frame_count % TIME_COUNT == 0 endif SceneManager::scene_is?(Scene_Battle) && PAUSE_IN_COMBAT != true$game_time += 1 if Graphics.frame_count % TIME_COUNT == 0 endendif $game_time == 1440 then $game_time = 0 end$game_variables[TIME_VARIABLE] = $game_time if USE_VARIABLEupdate_night_switch if USE_SWITCHGameTime::tint if $game_time_pause_tint != trueenddef self.update_night_switchif hour? > DAY_TIME_START and hour? < NIGHT_TIME_START$game_switches[NIGHT_DAY_SWITCH] = true unless $game_switches[NIGHT_DAY_SWITCH] == trueelse$game_switches[NIGHT_DAY_SWITCH] = false unless $game_switches[NIGHT_DAY_SWITCH] == falseendenddef self.hour?return $game_time / 60enddef self.minute?return $game_time % 60enddef self.time?meri = "AM"hour = GameTime::hour?minute = GameTime::minute?if hour > 11 then meri = "PM" endif hour == 0 then hour = 12; meri = "AM" endif hour > 12 then hour -= 12 endif hour < 10 then hour = " " + hour.to_s else hour.to_s endif minute < 10 then minute = "0" + minute.to_s else minute.to_s endreturn hour.to_s + ":" + minute.to_s + " " + merienddef self.set(number)$game_time = number if number < 1440GameTime::tint(0) if $game_time_pause_tint != trueenddef self.change(number)$game_time += number$game_time -= 1440 if $game_time > 1440$game_time += 1440 if $game_time < 0GameTime::tint(0) if $game_time_pause_tint != trueenddef self.tint(tint = 60)if USE_TINT != true then return endfor i in NOTINTMAPSif $game_map.map_id == i$game_map.screen.start_tone_change(Tone.new(0,0,0,0),0)returnendendif SceneManager::scene_is?(Scene_Map) then else return endcase $game_timewhen PRESUNRISE_TIME .. SUNRISE_TIME$game_map.screen.start_tone_change(PRESUNRISE_TONE, tint)when SUNRISE_TIME .. NOONSTART_TIME$game_map.screen.start_tone_change(SUNRISE_TONE, tint)when NOONSTART_TIME .. NOONEND_TIME$game_map.screen.start_tone_change(NOONSTART_TONE, tint)when NOONEND_TIME .. PRESUNSET_TIME$game_map.screen.start_tone_change(NOONEND_TONE, tint)when PRESUNSET_TIME .. SUNSET_TIME$game_map.screen.start_tone_change(PRESUNSET_TONE, tint)when SUNSET_TIME .. 1440$game_map.screen.start_tone_change(SUNSET_TONE, tint)when 0 .. MIDNIGHT_TIME$game_map.screen.start_tone_change(SUNSET_TONE, tint)when MIDNIGHT_TIME .. PRESUNRISE_TIME$game_map.screen.start_tone_change(MIDNIGHT_TONE, tint)endenddef self.pause_time(set)$game_time_pause_time = setenddef self.pause_tint(set)$game_time_pause_tint = setenddef self.clock(set)return unless SceneManager.scene.is_a?(Scene_Map)SceneManager.scene.clock_visible?(set)endclass Window_Clock < Window_Basedef initializecase CLOCK_POSITIONwhen 1super(0,0,115,56)when 2super(429,0,115,56)when 3super(0,360,115,56)when 4super(429,360,115,56)endself.visible = $game_time_clock_visibility unless $game_time_clock_visibility.nil?enddef updateself.contents.clearself.contents.draw_text(0,0,100,24,GameTime::time?)$game_time_clock_visibility = self.visibleendendendGameTime::initmodule DataManagerclass << selfalias gametime_msc make_save_contentsalias gametime_esc extract_save_contentsenddef self.make_save_contentscontents = gametime_msccontents[:gametime] = $game_timecontentsenddef self.extract_save_contents(contents)gametime_esc(contents)$game_time = contents[:gametime]endendclass Scene_Map < Scene_Basealias gametime_post_transfer post_transferalias gametime_create_all_windows create_all_windowsalias gametime_update_map updatedef post_transferGameTime::tint(0) if $game_time_pause_tint != truegametime_post_transferenddef create_all_windowsgametime_create_all_windows@gametimeclock = GameTime::Window_Clock.new if USE_CLOCKenddef updategametime_update_map@gametimeclock.update if @gametimeclock.nil? == falseif Input.trigger?(CLOCK_TOGGLE) and @gametimeclock.nil? == false@gametimeclock.visible ? @gametimeclock.visible = false : @gametimeclock.visible = trueendenddef clock_visible?(set)@gametimeclock.visible = setendendclass Scene_Basealias gametime_update updatedef updategametime_updateGameTime::updateendend Share this post Link to post Share on other sites
Notsalony 12 Posted October 12, 2015 Okay that's the day and night script, not the basic real time script. The day and night script changes the tint to the screen and the weather. You're wanting to change the clock which is not in the day and night script. You're trying to apply edits to the WRONG script if that's the script your editing. Share this post Link to post Share on other sites
P3RR1N 3 Posted October 12, 2015 (edited) I feel stupid....I thought I was editing this script the WHOLE time...GAH! Ty so much man! *EDIT* Is there a way to swap everything to make it apply to the game? and not use my PC's time and date? Edited October 12, 2015 by P3RR1N Share this post Link to post Share on other sites
Notsalony 12 Posted October 12, 2015 I think there is. I think it's in the game time script. I have to go run an errand, private message me and I'll see what I can pull up when I get home from my late lunch and see if I can help you out that way. But I think you want Vlue's game time script. If you can't get it to work, let me know. -is heading out the door- Share this post Link to post Share on other sites