03-08-2008, 04:11 AM
Window_YourCurrentTime
Some time ago I was looking for a script that would allow me to replace the in-game time or play time with a e.g. PST or GMT
This is what I edited in the Window_PlayTime script...
I replaced the original lines (where def refresh is defined) with these...
Another UPDATE!!!
Just in case someone is having problems with the full weekday name being displayed in English, I included a modification that would allow you to see it being displayed in your mother tongue.
Replace text1 value with the one you need.
Take a look at these examples:
# German
'Monday' => 'Montag',
# Italian
'Monday' => 'Lunedi',
# Spanish
'Monday' => 'Lunes',
# Portuguese
'Monday' => 'Segunda', # or Segunda-feira
Script:
Some time ago I was looking for a script that would allow me to replace the in-game time or play time with a e.g. PST or GMT
This is what I edited in the Window_PlayTime script...
I replaced the original lines (where def refresh is defined) with these...
Another UPDATE!!!
Just in case someone is having problems with the full weekday name being displayed in English, I included a modification that would allow you to see it being displayed in your mother tongue.
Replace text1 value with the one you need.
Take a look at these examples:
# German
'Monday' => 'Montag',
# Italian
'Monday' => 'Lunedi',
# Spanish
'Monday' => 'Lunes',
# Portuguese
'Monday' => 'Segunda', # or Segunda-feira
Script:
Code:
#============================
# Your Current Time Window
# version 1.1
# by shadowball
# 11.25.2007 - 11.28.2007
#============================
# This is what I edited in the Window_PlayTime script...
# I replaced the original lines (where def refresh is defined) with these...
# It prints the current date/time this way:
# Sunday
# 11.25.2007 23:59
class Window_YourCurrentTime < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)#88)
self.contents = Bitmap.new(width - 32, height - 32)
#self.windowskin = RPG::Cache.windowskin('001-WallofCloudsSHB01')
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Draw Time Text
t = Time.now
# The full weekday name is normally displayed in English.
# If you speak English, you may delete this hash.
days = {'Monday' => 'Lunes',
'Tuesday' => 'Martes',
'Wednesday' => 'Miércoles',
'Thursday' => 'Jueves',
'Friday' => 'Viernes',
'Saturday' => 'Sábado',
'Sunday' => 'Domingo'}
months = {'January' => 'Enero',
'February' => 'Febrero',
'March' => 'Marzo',
'April' => 'Abril',
'May' => 'Mayo',
'June' => 'Junio',
'July' => 'Julio',
'August' => 'Agosto',
'September' => 'Setiembre',
'October' => 'Octubre',
'November' => 'Noviembre',
'December' => 'Diciembre'}
text1 = days[t.strftime('%A')]
text2 = months[t.strftime('%B')]
# End of full weekday / month name in your language
text3 = t.strftime('%d.%m.%Y %H:%M')
self.contents.font.bold = true
# System Color
self.contents.font.color = system_color
# Print Day Of The Week
self.contents.draw_text(0, 0, 60, 32, text1, 0)
# Normal Color
self.contents.font.color = normal_color
# Print Time
self.contents.draw_text(0, 32, 145, 32, text2, 0)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#===========================================================================
# ** Window_YourCurrentTimeHUD
# v1.0
# by shadowball
# 27.12.2007
#===========================================================================
class Scene_Map
alias_method :shbyct_main, :main
def main
# Make play time window
@yctime_window = Window_YourCurrentTime.new
@yctime_window.x = 480
@yctime_window.y = 64
@yctime_window.z = 120
shbyct_main
Graphics.freeze
@yctime_window.dispose
end
alias_method :shbyct_update, :update
def update
@shb_hour = Time.now.strftime('%H').to_i
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 - 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 - 7 p.m.
$game_screen.start_tone_change(Tone.new(30, 10, 0, 0), 1)
end
shbyct_update
@yctime_window.update
if Input.trigger?(Input::L) && $scene.is_a?(Scene_Map)
@yctime_window.visible = false
elsif Input.trigger?(Input::R) && $scene.is_a?(Scene_Map)
@yctime_window.visible = true
end
end
end
class Scene_Menu
alias_method :shbyct_main, :main
def main
# Make play time window
@yctime_window = Window_YourCurrentTime.new
@yctime_window.x = 0
@yctime_window.y = 224
@yctime_window.z = 120
shbyct_main
Graphics.freeze
@yctime_window.dispose
end
alias_method :shbyct_update, :update
def update
shbyct_update
@yctime_window.update
end
end
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE