Hey back again, that crash at the title screen is back line 360: RGSSError occurred failed to create bitmap
O ok, thx for the help again lol edit I can't seem to get the clock to stay on/visible. As soon as I toggle it on, it hides itself again. Any ideas?
Fine for me... can you paste here your settings in a spoiler so I can look at them? You can! If you go to Control Variables, there's a script option. Putting in GameTime.hour? would set the variable to the current hour, GameTime.day? would be day of the month, etc.
Sure can. Maybe I'm messing something up? Idk sometimes lol Spoiler #Advanced Game Time + Night/Day v1.1.4#----------# #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 in an advanced and customizable way. # #Usage: Script calls: # GameTime.sec? #current second # GameTime.min? #current minute # GameTime.hour? #current hour # GameTime.hour_nom? #current hour (12-hour) # GameTime.day? #current day of month # GameTime.day_week? #current day of the week # GameTime.month? #current month # GameTime.year? #current year # GameTime.year_post("set") #changes the year post to set # GameTime.pause_tint = true/false #pauses/unpauses tint # GameTime.change(s,m,h,d,mn,y) #manually set the time # seconds,minutes,hours,days,months,years # any can be nil to not be changed # GameTime.set("handle",n) #increases a certain time portion # valid arguments are: # addsec,addmin,addhour,addday # addmonth,addyear # GameTime.clock?(true/false) #hides/shows the clock # GameTime.save_time #saves the current time # GameTime.load_time #loads the saved time # # Message Codes: # GTSEC #Inputs the current second # GTMIN #Inputs the current minute # GTHOUR #Inputs the current hour # GTDAYN #Inputs the day of the month # GTDAYF #Inputs the day of the week (full) # GTDAYA #Inputs the day of the week (abbreviated) # GTMONN #Inputs the month of the year # GTMONF #Inputs the name of the month (full) # GTMONA #Inputs the name of the month (abbreviated) # GTYEAR #Inputs the current year # # Map Note Tags: # Notime #Stops time from moving in that map # #Customization: Set below, in comments. # #Examples: GameTime.pause_tint = false # GameTime.change(nil,30,4,1,1,2012) # GameTime.set("addyear",5) # GameTime.clock?(true) # #----------# #-- Script by: V.M of D.T #--- Free to use in any non-commercial project with credit given #_# BEGIN_CUSTOMIZATION #_# #Wether or not to set time to PC (Real) Time USE_REAL_TIME = false #Time does not increase while the message window is visible: NOTIMEMESSAGE = true #Time does not increase unless you are on the map PAUSE_IN_MENUS = false #Time does not increase if you are in battle NOBATTLETIME = true #Date is shown on the clock USECLOCKDATE = false #Clock is shown USECLOCK = true #Set to true to have the clock show up in the menu! USECLOCK_MENU = true #True if you want to use 24-hour clock or have a different # of hours in a day MILITARY_CLOCK = false #Clock window background opacity CLOCK_BACK = 255 #Button to be used to toggle the clock CLOCK_TOGGLE = :CTRL #X and Y position of clock CLOCK_X = 370 CLOCK_Y = 0 #Finetune the width of the clock window here: CLOCK_WIDTH = 175 #Set to tru if you want to use a custom clock USE_CUSTOM_CLOCK = false #Here is where you would insert the array of commands for the custom clock: CUSTOM_CLOCK = ["hour12",":","min"," ","meri"," ","weekshort"," ","day"," ","year","yearp"] #Available commands for CUSTOM_CLOCK: # "sec" - seconds "min" - minutes # "hour" - hour (24) "hour12" - hour (12) # "meri" - AM/PM "day" - day of the month # "weekshort" - day of the week abbr # "weeklong" - day of the week long # "month" - month "monthshort" - month name abbr # "monthlong" - month name # "year" - year "yearp" - year post #Using KHAS lighting effects script? Turn this on to use that tint USE_KHAS = true #Any maps that are not supposed to be tinted are put in here: #Array format [#,#,#] I.E. [5,65,134] NOTINTMAPS = [0] #Use Tint in the Battles BATTLE_TINT = false #Time it takes for a second (or minute) to pass, in frames #(Frame rate is 60 frames per second) TIMELAPSE = 1 #Whether to use seconds or not NOSECONDS = false #Number of seconds in a minute SECONDSINMIN = 60 #Number of minutes in an hour MINUTESINHOUR = 60 #Number of hours in a day HOURSINDAY = 24 #Names of the days (As little or as many days in the week as you want) DAYNAMES = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"] #Day name abbreviations DAYNAMESABBR = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"] #Number of days in each month (Also represents number of months in a year) MONTHS = [31,28,31,30,31,30,31,31,30,31,30,31] #Names of the months MONTHNAMES = ["January","February","March","April","May","June", "July","August","September","October","November","December"] #Abrreviated names of the months MONTHNAMESABBR = ["Jan","Feb","Mar","Apr","May","Jun", "Jul","Aug","Sep","Oct","Nov","Dec"] #The default letters to be posted before the year in dates DEFAULT_YEAR_POST = "AD" #NOT YET IMPLEMENTED *IGNORE* USE_PERIODS = true #Gradual tint effects! (The hardest part) #It may look daunting, and it is, but here is where you put the tint #to be shown at each hour (the actual tint is usually somewhere in between) #The number of Color.new objects here must equal the number of hours in a day #Starts from hour 0 (or 12am) #A color object is -> Color.new(r,g,b,a) # Where r is red,g is green,b is blue,and a is opacity and all are (0-255) TINTS = [Color.new(30,0,40,155), Color.new(20,0,30,135), Color.new(20,0,30,135), Color.new(10,0,30,135), Color.new(10,0,20,125), Color.new(0,0,20,125), Color.new(80,20,20,125), Color.new(130,40,10,105), Color.new(80,20,10,85), Color.new(0,0,0,65), Color.new(0,0,0,35), Color.new(0,0,0,15), Color.new(0,0,0,0), Color.new(0,0,0,0), Color.new(0,0,0,5), Color.new(0,0,0,15), Color.new(0,0,0,25), Color.new(0,0,10,55), Color.new(80,20,20,85), Color.new(130,40,30,105), Color.new(80,20,40,125), Color.new(10,0,50,135), Color.new(20,0,60,135), Color.new(30,0,70,155)] #NOT YET IMPLEMENTED *IGNORE* PERIODS = [["Night",0,5], ["Morning",6,11], ["Afternoon",12,17], ["Evening",18,23]] #_# END CUSTOMIZATION #_# module GameTime def self.run $game_time = Current_Time.new $game_time_tint = Sprite_TimeTint.new end def self.update return if $game_message.busy? and NOTIMEMESSAGE if !SceneManager.scene.is_a?(Scene_Map) and PAUSE_IN_MENUS return unless SceneManager.scene.is_a?(Scene_Battle) and !NOBATTLETIME end $game_time.update $game_time_tint = Sprite_TimeTint.new if $game_time_tint.disposed? $game_time_tint.update end def self.sec? return $game_time.sec end def self.min? return $game_time.min end def self.hour? return $game_time.hour end def self.hour_nom? hour = $game_time.hour hour -= 12 if hour > 11 hour = 12 if hour == 0 return hour end def self.day? return $game_time.day + 1 end def self.day_week? return $game_time.dayweek end def self.day_name return DAYNAMES[$game_time.day] end def self.day_name_abbr return DAYNAMESABBR[$game_time.day] end def self.month_name_abbr return MONTHNAMESABBR[$game_time.month] end def self.month? return $game_time.month + 1 end def self.month_name return MONTHNAMES[$game_time.month] end def self.year? return $game_time.year end def self.pause_tint @pause_tint end def self.change(s = nil,m = nil,h = nil,d = nil,mn = nil,y = nil) $game_time.manual(s,m,h,d,mn,y) end def self.set(handle,n) $game_time.forward(handle,n) end def self.clock?(set) SceneManager.scene.clock_visible?(set) end def self.year_post(set) $game_time.year_post = set end def self.save_time $saved_game_time = $game_time.dup end def self.load_time $game_time = $saved_game_time.dup end def self.no_time_map note = $game_map.map_note /Notime/ =~ note return false unless $~ return true end class Current_Time attr_reader :sec attr_reader :min attr_reader :hour attr_reader :day attr_reader :dayweek attr_reader :month attr_reader :year attr_accessor :year_post def initialize reset_all_values end def reset_all_values @sec = 0 @min = 0 @hour = 0 @day = 0 @dayweek = 0 @month = 0 @year = 0 @year_post = DEFAULT_YEAR_POST end def update return realtime if USE_REAL_TIME return if GameTime.no_time_map return unless Graphics.frame_count % TIMELAPSE == 0 NOSECONDS ? addmin(1) : addsec(1) end def realtime @sec = Time.now.sec @sec = 0 if @sec == 60 @min = Time.now.min @hour = Time.now.hour @day = Time.now.day @dayweek = Time.now.wday @month = Time.now.month @year = Time.now.year 0 end def addsec(s) @sec += s return unless @sec == SECONDSINMIN @sec = 0 addmin(1) end def addmin(m) @min += m return unless @min == MINUTESINHOUR @min = 0 addhour(1) end def addhour(h) @hour += h return unless @hour == HOURSINDAY @hour = 0 addday(1) end def addday(d) @day += d @dayweek += d @dayweek = 0 if @dayweek == DAYNAMES.size return unless @day == MONTHS[@month] @day = 0 addmonth(1) end def addmonth(mn) @month += mn return unless @month == MONTHS.size @month = 0 addyear(1) end def addyear(y) @year += y end def manual(s = nil,m = nil,h = nil,d = nil,mn = nil,y = nil) @sec = s if !s.nil? @sec = SECONDSINMIN - 1 if @sec >= SECONDSINMIN @min = m if !m.nil? @min = MINUTESINHOUR - 1 if @min >= MINUTESINHOUR @hour = h if !h.nil? @hour = HOURSINDAY - 1 if @hour >= HOURSINDAY @day = d if !d.nil? @day = MONTHS[@month] - 1 if @day >= MONTHS[@month] @month = mn if !mn.nil? @month = MONTHS.size - 1 if @month >= MONTHS.size @year = y if !y.nil? end def forward(handle,n) handle = handle.to_s + "(1)" n.times do |s| eval(handle) end end def reverse return "Time doesn't work like that." end end class Sprite_TimeTint < Sprite_Base def initialize(viewport = nil) super(viewport) self.z = 100 create_contents update end def create_contents self.bitmap = Bitmap.new(Graphics.width,Graphics.height) self.visible = false end def update create_contents if self.bitmap.height != Graphics.height create_contents if self.bitmap.width != Graphics.width self.visible = SceneManager.scene.is_a?(Scene_Map) self.visible = true if SceneManager.scene.is_a?(Scene_Battle) and BATTLE_TINT self.visible = false if no_tint self.bitmap.clear if no_tint return unless self.visible ctint = TINTS[$game_time.hour] ntint = TINTS[$game_time.hour + 1] unless $game_time.hour + 1 == HOURSINDAY ntint = TINTS[0] if $game_time.hour + 1 == HOURSINDAY min = $game_time.min r = ctint.red.to_f - ((ctint.red.to_f - ntint.red) * (min.to_f / MINUTESINHOUR)) g = ctint.green.to_f - ((ctint.green.to_f - ntint.green) * (min.to_f / MINUTESINHOUR)) b = ctint.blue.to_f - ((ctint.blue.to_f - ntint.blue) * (min.to_f / MINUTESINHOUR)) a = ctint.alpha.to_f - ((ctint.alpha.to_f - ntint.alpha) * (min.to_f / MINUTESINHOUR)) self.bitmap.clear self.bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(r,g,b,a)) unless USE_KHAS return unless USE_KHAS begin temp = $game_map.light_surface.opacity rescue return end self.bitmap.clear $game_map.effect_surface.change_color(0,r,g, $game_map.effect_surface.set_alpha(a) end def no_tint for i in NOTINTMAPS return false if $game_map.nil? if $game_map.map_id == i return true else next end end return false end end class Window_GameClock < Window_Base def initialize super(CLOCK_X,CLOCK_Y,CLOCK_WIDTH,56) self.opacity = CLOCK_BACK update end def update contents.clear string = normal_clock string = dated_clock if USECLOCKDATE and !MILITARY_CLOCK string = military_clock if MILITARY_CLOCK string = dated_military_clock if MILITARY_CLOCK and USECLOCKDATE string = custom if USE_CUSTOM_CLOCK contents.draw_text(0,0,contents.width,contents.height,string,1) end def military_clock hour = $game_time.hour minute = $game_time.min if hour < 10 then hour = " " + hour.to_s else hour.to_s end if minute < 10 then minute = "0" + minute.to_s else minute.to_s end string = hour.to_s + ":" + minute.to_s return string end def dated_military_clock hour = $game_time.hour minute = $game_time.min dayweek = DAYNAMESABBR[$game_time.dayweek] day = $game_time.day day += 1 unless USE_REAL_TIME if hour < 10 then hour = " " + hour.to_s else hour.to_s end if minute < 10 then minute = "0" + minute.to_s else minute.to_s end if day < 10 then day = " " + day.to_s end string = dayweek.to_s + " " + day.to_s + " " string += hour.to_s + ":" + minute.to_s return string end def normal_clock meri = "AM" hour = $game_time.hour minute = $game_time.min if hour > 11 then meri = "PM" end if hour == 0 then hour = 12; meri = "AM" end if hour > 12 then hour -= 12 end if hour < 10 then hour = " " + hour.to_s else hour.to_s end if minute < 10 then minute = "0" + minute.to_s else minute.to_s end string = hour.to_s + ":" + minute.to_s + " " + meri return string end def dated_clock meri = "AM" hour = $game_time.hour minute = $game_time.min dayweek = DAYNAMESABBR[$game_time.dayweek] day = $game_time.day day += 1 unless USE_REAL_TIME if hour > 11 then meri = "PM" end if hour == 0 then hour = 12; meri = "AM" end if hour > 12 then hour -= 12 end if hour < 10 then hour = " " + hour.to_s else hour.to_s end if minute < 10 then minute = "0" + minute.to_s else minute.to_s end if day < 10 then day = " " + day.to_s end string = dayweek.to_s + " " + day.to_s + " " string += hour.to_s + ":" + minute.to_s + " " + meri return string end def custom sec = $game_time.sec sec = "0" + sec.to_s if sec < 10 hour = $game_time.hour hour >= 12 ? meri = "PM" : meri = "AM" hour = " " + hour.to_s if hour < 10 hour12 = $game_time.hour hour12 -= 12 if hour12 > 12 hour12 = 12 if hour12 == 0 minute = $game_time.min minute = "0" + minute.to_s if minute < 10 dayweek = DAYNAMESABBR[$game_time.dayweek] dayweekn = DAYNAMES[$game_time.dayweek] day = $game_time.day day += 1 unless USE_REAL_TIME month = $game_time.month month += 1 unless USE_REAL_TIME monthn = MONTHNAMES[$game_time.month] monthna = MONTHNAMESABBR[$game_time.month] year = $game_time.year string = "" for command in CUSTOM_CLOCK case command when "sec" string += sec.to_s when "min" string += minute.to_s when "hour" string += hour.to_s when "hour12" string += hour12.to_s when "meri" string += meri.to_s when "weekshort" string += dayweek.to_s when "weeklong" string += daylong.to_s when "day" string += day.to_s when "month" string += month.to_s when "monthshort" string += monthna.to_s when "monthlong" string += monthn.to_s when "year" string += year.to_s when "yearp" string += $game_time.year_post else string += command.to_s end end return string end end end GameTime.run class Window_Base < Window alias real_time_convert_escape_characters convert_escape_characters def convert_escape_characters(text) result = real_time_convert_escape_characters(text) result.gsub!(/GTSEC/) { GameTime.sec? } result.gsub!(/GTMIN/) { GameTime.min? } result.gsub!(/GTHOUR/) { GameTime.hour? } result.gsub!(/GTDAYN/) { GameTime.day? } result.gsub!(/GTDAYF/) { GameTime.day_name } result.gsub!(/GTDAYA/) { GameTime.day_name_abbr } result.gsub!(/GTMONF/) { GameTime.month? } result.gsub!(/GTMONN/) { GameTime.month_name } result.gsub!(/GTMONA/) { GameTime.month_name_abbr } result.gsub!(/GTYEAR/) { GameTime.year? } result end end class Scene_Base alias game_time_update update def update game_time_update GameTime.update end end class Scene_Map alias game_time_post_transfer post_transfer alias game_time_init create_all_windows alias game_time_map_update update alias game_time_start start def start game_time_start $game_time_tint.update end def create_all_windows game_time_init @gametimeclock = GameTime::Window_GameClock.new if USECLOCK end def post_transfer $game_time_tint.update game_time_post_transfer end def update game_time_map_update return unless USECLOCK @gametimeclock.update if Input.trigger?(CLOCK_TOGGLE) and @gametimeclock.nil? == false @gametimeclock.visible ? @gametimeclock.visible = false : @gametimeclock.visible = true end end def clock_visible?(set) @gametimeclock.visible = set end end class Game_Map def map_note return @map.note unless @map.nil? end end class Scene_Menu alias gt_start start alias gt_update update def start gt_start @clock = GameTime::Window_GameClock.new if USECLOCK_MENU @clock.x = 0 @clock.y = @gold_window.y - @clock.height @clock.width = @gold_window.width @clock.create_contents end def update gt_update @clock.update unless @clock.nil? end end module DataManager class << self alias gametime_msc make_save_contents alias gametime_esc extract_save_contents end def self.make_save_contents contents = gametime_msc contents[:gametime] = $game_time contents end def self.extract_save_contents(contents) gametime_esc(contents) $game_time = contents[:gametime] end end edit nvm, it was my bad, one of the maps I had was glitching it out. It works fine everywhere else.
Version 1.2 is now up and going - Fixed a bug with KHAS that made it not work with maps marked as no tint (That's a big problem!) - Custom clocks can now have two lines instead of one! - Notint works differently now, you use map properties note box instead of the array in the script (Putting Notint into the notebox)
Hey Vlue, awesome updates with this. i had a question though. Did you ever get my last question i posted in the topic about your Advanced Climate script? I ask it here because it dealt with cross compatibility with this script.
Alright, so I've turned on the custom clock variables thing and I kept getting a bunch of error messages. So I poked around in the code and found this: Code: 581 when "weeklong" 582 string += daylong.to_s Since the error kept saying something about "daylong" being an undefined local variable or method, I kept poking around until I found the problem. Code: 546 def custom(array) 547 sec = $game_time.sec 548 sec = "0" + sec.to_s if sec < 10 549 hour = $game_time.hour 550 hour >= 12 ? meri = "PM" : meri = "AM" 551 hour = " " + hour.to_s if hour < 10 552 hour12 = $game_time.hour 553 hour12 -= 12 if hour12 > 12 554 hour12 = 12 if hour12 == 0 555 minute = $game_time.min 556 minute = "0" + minute.to_s if minute < 10 557 dayweek = DAYNAMESABBR[$game_time.dayweek] 558 dayweekn = DAYNAMES[$game_time.dayweek] 559 day = $game_time.day 560 day += 1 unless USE_REAL_TIME 561 month = $game_time.month 562 month += 1 unless USE_REAL_TIME 563 monthn = MONTHNAMES[$game_time.month] 564 monthna = MONTHNAMESABBR[$game_time.month] 565 year = $game_time.year The main problem being this particular snippet: Code: 557 dayweek = DAYNAMESABBR[$game_time.dayweek] 558 dayweekn = DAYNAMES[$game_time.dayweek] 559 day = $game_time.day I noticed that when defining the other "long" variables, you used "n" as a suffix to denote it being a "long" variable/method. Therefore through deductive logic I changed the "daylong" from earlier to "dayweekn" and now it works. Just thought I should let you know just in case you overlooked it; I'm sure I'm not the only one who wants to use custom clock labels.
Also, for anyone who wants the clock to be on the bottom right like the Basic Time System, just change the X and Y to this: Code: 82 #X and Y position of clock 83 CLOCK_X = 370 84 CLOCK_Y = 338 Just a tip for those who want it, heh.
How do you use the Custom Times you have listed in the main post? I tried replacing that part in the script in my project and a blank project, but it keeps coming up with an error message. I was trying the Harvest Moon-esque one.
If copy pasting is messing up you can just play it safe by copying the custom time I have listed and instead of replacing what's already there, just copy it to line 181, it'll be below the other times and will be used instead. It's messy but definitely should work.
Question: How does "TIMER_VARIABLES = []" on line 111 work? More specifically, would I enter [25, 26] to have variable 25 handle seconds and 26 to handle minutes? And then, does the variable update with the timer or is it possible to just call a script event that saves the time when it's called? I'm trying to implement a bank with interest system so I need to be able to save a time before deposit and then calculate the difference in times upon withdraw. For this, I'd also need to know if the variables can save elapsed time as well.
Timer Variables is where you enter the id number of certain variables to have them count down to 0 every time update (minutes or seconds based on how it's set up) If you want to set a variable to equal the current hour or minute there's a script option in Control Variables where you can input something like... GameTime.hour? or GameTime.minute? and so on.
So, I've run into a small problem. What I'm trying to do is after the player sleeps at the inn, the new day must dawn, let's say at 8 o'clock. I've tried several ways, including: V[04] = GameTime.day? , and then { GameTime.change(nil, nil, 8, \V[04]+1, nil, nil) } V[04] = GameTime.day? + 1, and then { GameTime.change(nil, nil, 8, \V[04], nil, nil) } { GameTime.change(nil, nil, 8, GameTime.day? +1, nil, nil) } but causes the game to crash, as it's not recognised by the interpreter. Any ideas, how can I put the variable value inside the script call?
Yes, \v is only for messages and.. whatnot. In script calls it's $game_variables[#] Try.. GameTime.change(nil,nil,8) GameTime.set("addday", 1)