[rgss]
#===============================================================================
# [ Script ] Timer Edit
# by Drago del Fato
# License: Free for non-commercial games. Commercial games only with approval of
# the author.
#-------------------------------------------------------------------------------
# Instructions: Insert above main.
# To call the script run event script and just write
# run_timer(specify hours here, specify minutes here, specify seconds here)
#
#
# You can only specify hours, or hours or minutes or all three.
#
#===============================================================================
#-------------------------------------------------------------------------------
# Class Interpreter Edit
#-------------------------------------------------------------------------------
class Interpreter
def run_timer(hours, minutes = 0, seconds = 0)
time_start = hours * 60 * 60 + minutes * 60 + seconds
$game_system.timer = time_start * Graphics.frame_rate
$game_system.timer_working = true
end
end
#-------------------------------------------------------------------------------
# Class Sprite_Timer Edit
#-------------------------------------------------------------------------------
class Sprite_Timer < Sprite
def update
super
# Set timer to visible if working
self.visible = $game_system.timer_working
# If timer needs to be redrawn
if $game_system.timer / Graphics.frame_rate != @total_sec
# Clear window contents
self.bitmap.clear
# Calculate total number of seconds
@total_sec = $game_system.timer / Graphics.frame_rate
# Make a string for displaying the timer
day = @total_sec / 60 / 60 / 24
@total_sec -= day * 24 * 60 * 60
hour = @total_sec / 60 / 60
@total_sec -= hour * 60 * 60
min = @total_sec / 60
sec = @total_sec % 60
if day > 0
text = sprintf("%02d:%02d:%02d:%02d", day, hour, min, sec)
elsif hour > 0
text = sprintf("%02d:%02d:%02d", hour, min, sec)
else
text = sprintf("%02d:%02d", min, sec)
end
# Draw timer
self.bitmap.font.color.set(255, 255, 255)
self.bitmap.draw_text(self.bitmap.rect, text, 1)
end
end
end
[/rgss]
Here. I added so you can set hours, minutes and seconds. If you need days just calculate them into hours (number of days * 24).
Hope it helps.