Introduction
This script alters the default RGSS timer to count upwards rather than just counting down to zero.
Screenshots
Turn on your timer... there you go.
Demo
Too easy to use to need one.
Script
Brew's Timer
Code:
#==============================================================================
# ** BrewMeister's Reverse Timer
# Original version: December 11, 2007
# Edits by DerVVulfman August 1, 2008
#------------------------------------------------------------------------------
# This script alters the default RGSS timer to count upwards rather than just
# counting down to zero.
#
# You can use: [ $game_system.timer_hiding = nil ] to reveal the timer, or
# you can use: [ $game_system.timer_hiding = true ] to hide the timer.
#
# Alternate calls to change direction:
# You can use: [ $game_system.timer_working = 0 ] to pause the timer, or
# You can use: [ $game_system.timer_working = 1 ] to decrease the timer, or
# You can use: [ $game_system.timer_working = 0 ] to increase the timer.
# -- As such, you can use these calls to turn the timer on, too. --
#
#------------------------------------------------------------------------------
# Rewrites:
# Game_System: update
# Interpreter: command_124
#==============================================================================
# Change this value for the default setting
HIDE_TIMER = true
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :timer_hiding # timer hiding flag
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias timer_init initialize
def initialize
timer_init
@timer_hiding = HIDE_TIMER
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# To reduce timer by 1
@timer -= 1 if @timer_working == 1 and @timer > 0
# Or increase timer by 1
@timer += 1 if @timer_working == 2
end
end
#==============================================================================
# ** Sprite_Timer
#------------------------------------------------------------------------------
# This sprite is used to display the timer.It observes the $game_system
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Timer < Sprite
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias timer_update update
def update
if $game_system.timer_hiding
self.visible = false
return
end
timer_update
end
end
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Control Timer
#--------------------------------------------------------------------------
def command_124
# If started
if @parameters[0] == 0
$game_system.timer = @parameters[1] * Graphics.frame_rate
$game_system.timer_working = 1
$game_system.timer_working = 2 if @parameters[1] == 0
end
# If stopped
$game_system.timer_working = false if @parameters[0] == 1
# Continue
return true
end
end
Instructions
Built into the script.
FAQ
Mainly Brew's work. I added comments, found a way to hide the window, and discovered something fun.
Compatibility
Pretty dang compatible.
Credits and Thanks
To Brewmeister who wrote the base code, to Kalier for the initial request, and SixtyandaQuarter for a pause request.
Terms and Conditions
Brew has no problems. Why should I?