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