bretseattle
Member
This is my attempt at an in game clock. It is made from a gutted gold window and some bits of a playtime window. It isn't a very powerful script because it needs events to do the time processing. Hopefully I am not wasting anyones time by posting such primative script. Any help in streamling this would be great.
#==============================================================================
# ** Window_Clock
#------------------------------------------------------------------------------
# This window displays the time and date.
#==============================================================================
class Window_Clock < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(100, 0, 160, 128)
self.opacity = (160)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin"gear"
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
e = $game_variables[32]
i = $game_variables[40]
self.contents.font.size = 35
self.contents.clear
self.contents.draw_text(0, 0, 120, 32, "Week", 0)
self.contents.draw_text(0, 0, 120, 32, $game_variables[34].to_s, 2)
self.contents.draw_text(0, 32, 120, 32, $Week.to_s, 1)
hour = $game_variables[42]
min = $game_variables[39]
text = sprintf("%2d:%02d", hour, min)
self.contents.draw_text(0, 64, 120, 32, text, 0)
self.contents.draw_text(0, 64, 120, 32, $M[e].to_s, 2)
end
def update
refresh
end
end
class Array
$Week = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
$M = ["AM","PM"]
end
# ** Window_Clock
#------------------------------------------------------------------------------
# This window displays the time and date.
#==============================================================================
class Window_Clock < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(100, 0, 160, 128)
self.opacity = (160)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin"gear"
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
e = $game_variables[32]
i = $game_variables[40]
self.contents.font.size = 35
self.contents.clear
self.contents.draw_text(0, 0, 120, 32, "Week", 0)
self.contents.draw_text(0, 0, 120, 32, $game_variables[34].to_s, 2)
self.contents.draw_text(0, 32, 120, 32, $Week.to_s, 1)
hour = $game_variables[42]
min = $game_variables[39]
text = sprintf("%2d:%02d", hour, min)
self.contents.draw_text(0, 64, 120, 32, text, 0)
self.contents.draw_text(0, 64, 120, 32, $M[e].to_s, 2)
end
def update
refresh
end
end
class Array
$Week = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
$M = ["AM","PM"]
end