Script Request Template
Hey all, this is a request to modify a day/night script to include am and pm. Meaning 24 hours, but only up to 12 for am and 12 for pm. And also, tell me how I would make a condition for something to happen in my game depending on what time it is.
Script Title:
Modified Day Night
RMXP or RMVX:
XP
Detailed Description:
Here is the script
Screen shots:
No screen shot, just tinted screens and stuff.
Other Scripts I am using (in order):
I don't think adding AM and PM will conflict with any of my other scripts, but I have a lot of scripts installed.
Here is my scripts.rxdata. Just paste it and you will see exactly what scripts I am using and by who they were made.
http://www.sendspace.com/file/51gdqc
Thank you to anyone who is willing to take on this task.
EDIT:
Also, it can keep it's 24 hour scheme, but I just want it to DISPLAY in 12 hour format in the menu. Meaning, you don't really have to change anything in the script if you can get it to display it in 12 hour AM and PM format. Also, class Window_GameStats is really class Window_PlayTime if it matters or makes it any easier.
Hey all, this is a request to modify a day/night script to include am and pm. Meaning 24 hours, but only up to 12 for am and 12 for pm. And also, tell me how I would make a condition for something to happen in my game depending on what time it is.
Script Title:
Modified Day Night
RMXP or RMVX:
XP
Detailed Description:
Here is the script
Code:
#==============================================================================
# ** Window_PlayTime + Day & Night Settings Script
# Â Â Window_PlayTime Add-on
# Â Â modified by shadowball
#
# Â On the Menu scene you'll see the current in-game day and time...
#==============================================================================
Â
class Window_GameStats < Window_Base
Â
 def initialize
  super(0, 0, 160, 96)
  self.contents = Bitmap.new(width - 32, height - 32)
  refresh
 end
Â
 def refresh
  self.contents.clear
  @total_sec = Graphics.frame_count / Graphics.frame_rate
  day = @total_sec / 60 / 24 % 7
  hour = @total_sec / 60 % 24
  minute = @total_sec % 60
  text = sprintf("%02d:%02d", hour, minute)
  self.contents.font.color = system_color
  shb_day = 'Sunday'   if day == 0
  shb_day = 'Monday'   if day == 1
  shb_day = 'Tuesday'  if day == 2
  shb_day = 'Wednesday' if day == 3
  shb_day = 'Thursday'  if day == 4
  shb_day = 'Friday'   if day == 5
  shb_day = 'Saturday'  if day == 6
  shb_weekday = shb_day
  self.contents.draw_text(4, -10, 120, 32, shb_weekday, 0)
  self.contents.font.color = normal_color
  self.contents.draw_text(4, 4, 120, 32, text, 2)
 Â
  case $game_party.gold
  when 0..9999
   gold = $game_party.gold
  when 10000..99999
   gold = $game_party.gold.to_s
   array = gold.split(//)
   gold = array[0].to_s+array[1].to_s+","+array[2].to_s+array[3].to_s+array[4].to_s
  when 100000..999999
   gold = $game_party.gold.to_s
   array = gold.split(//)
   gold = array[0].to_s+array[1].to_s+array[2].to_s+","+array[3].to_s+array[4].to_s+array[5].to_s
  when 1000000..9999999
   gold = $game_party.gold.to_s
   array = gold.split(//)
   gold = array[0].to_s+","+array[1].to_s+array[2].to_s+array[3].to_s+","+array[4].to_s+array[5].to_s+array[6].to_s
  end
#Draw Gold
 self.contents.font.color = system_color
 gold_word = $data_system.words.gold.to_s
 cx = contents.text_size(gold_word).width
 cx2=contents.text_size(gold.to_s).width
 self.contents.draw_text(4, 18, 120-cx-2, 32, gold_word)
 self.contents.font.color = normal_color
 self.contents.draw_text(124-cx2+1,32, cx2, 32, gold.to_s, 2)
 self.contents.font.color = system_color
 end
Â
 def update
  super
  if Graphics.frame_count / Graphics.frame_rate != @total_sec
   refresh
  end
 end
end
Â
#==============================================================================
# Â * Â Scene_Map - Modified
# Â Â modified by shadowball
#
# Â Screen tone will change depending on the in-game play time automatically
#==============================================================================
class Scene_Map
 alias shb_map_up update
 def update
  @total_sec = Graphics.frame_count / Graphics.frame_rate
  @shb_hour = @total_sec / 60 % 24
  if @shb_hour < 5 || @shb_hour > 18   # 7 p.m. - 5 a.m.
   $game_screen.start_tone_change(Tone.new(-120, -120, -120, 0), 1)
  elsif @shb_hour > 4 && @shb_hour < 7  # 5 a.m. - 7 a.m.
   $game_screen.start_tone_change(Tone.new(-40, -40, 0, 0), 1)
  elsif @shb_hour > 6 && @shb_hour < 16  # 7 a.m. - 4 p.m.
   $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 1)
  elsif @shb_hour > 15 && @shb_hour < 19 # 4 p.m. - 7 p.m.
   $game_screen.start_tone_change(Tone.new(30, 10, 0, 0), 1)
  end
  shb_map_up
 end
end
Â
#=======================================================
# Â * Â Game_System Add-on v 1.0
# Â Â by shadowball
# Â Â 08.02.2008
#
# Â You can set the time in minutes, hours, days
# Â Syntax: Â $game_system.set_time(0, 30, 2, 3)
#=======================================================
class Game_System
 def set_time(alter = 0, minute = 0, hour = 0, day = 0)
  if minute >= 0
   if minute >= 60
    minute = 59
   end
   set_min = Graphics.frame_rate * minute
  end
  if hour >= 0
   if hour >= 24
    hour = 23
   end
   set_hour = Graphics.frame_rate * 60 * hour
  end
  if day >= 0
   if day >= 31
    day = 30
   end
   set_day = Graphics.frame_rate * 60 * 24 * day
  end
 Â
  case alter
  when 0 # sets the time
   Graphics.frame_count = 0 + set_day + set_hour + set_min
  when 1 # adds the hours, minutes you specified to the current in-game playtime
   Graphics.frame_count = Graphics.frame_count + set_day + set_hour + set_min
  when 2 # this one does exactly the opposite...
   Graphics.frame_count = Graphics.frame_count - set_day - set_hour - set_min
  end
 end
end
No screen shot, just tinted screens and stuff.
Other Scripts I am using (in order):
I don't think adding AM and PM will conflict with any of my other scripts, but I have a lot of scripts installed.
Here is my scripts.rxdata. Just paste it and you will see exactly what scripts I am using and by who they were made.
http://www.sendspace.com/file/51gdqc
Thank you to anyone who is willing to take on this task.
EDIT:
Also, it can keep it's 24 hour scheme, but I just want it to DISPLAY in 12 hour format in the menu. Meaning, you don't really have to change anything in the script if you can get it to display it in 12 hour AM and PM format. Also, class Window_GameStats is really class Window_PlayTime if it matters or makes it any easier.