Advanced Timer

Advanced Timer v 1.0



by 334



Introduction

This script will display the Control-Timer in a stop-watch timer way.
(Also sorry if I posted this in the wrong thread maybe.)

How to Use

1. Paste the script above main.
2. Start a Control-Timer from Game Progression.



Screenshots
1650524176747.png



1650524199394.png



Script

Ruby:
#==============================================================================
# ■ Codename:334's Advanced Timer
#==============================================================================

#==============================================================================
# ■ Installation: Paste above main
#==============================================================================

#==============================================================================
# ■ Game_Timer
#==============================================================================

class Game_Timer
  #--------------------------------------------------------------------------
  # ● Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :timer_hide               # Hide timer (additional)
  #--------------------------------------------------------------------------
  # ● Object initialization (alias)
  #--------------------------------------------------------------------------
  alias timer_hide_initialize initialize
  def initialize
    timer_hide_initialize#Old method call
    @timer_hide = false
  end
  #--------------------------------------------------------------------------
  # ● 0.00 Acquisition of second
  #--------------------------------------------------------------------------
  def c_sec
    @count % 60 / 2 * 100 / 30
  end 
end
#==============================================================================
# ■ Sprite_Timer
#------------------------------------------------------------------------------
#  This is a sprite for displaying a timer.
#  Monitors $game_timer, and the state of the sprite automatically change.
#==============================================================================

class Sprite_Timer < Sprite
  #--------------------------------------------------------------------------
  # ● Update (redefine) source bitmap
  #--------------------------------------------------------------------------
  def update_bitmap
    if $game_timer.sec != @total_sec or $game_timer.c_sec != @c_sec
      @c_sec = $game_timer.c_sec
      @total_sec = $game_timer.sec
      redraw
    end
  end
  #--------------------------------------------------------------------------
  # ● Creating text for drawing (redefinition)
  #--------------------------------------------------------------------------
  def timer_text
    sprintf("%02d'%02d''%02d", @total_sec / 60, @total_sec % 60, @c_sec)
  end
  #--------------------------------------------------------------------------
  # ● Visible state update (redefinition)
  #--------------------------------------------------------------------------
  def update_visibility
    self.visible = $game_timer.working? && !$game_timer.timer_hide #Addition
  end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter that executes event commands.
# This class is used inside the Game_Map class,
# the Game_Troop class, and the Game_Event class.
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # ● Conditional branching (redefinitional)
  #--------------------------------------------------------------------------
  def command_111
    result = false
    case @params[0]
    when 0  # Switch
      result = ($game_switches[@params[1]] == (@params[2] == 0))
    when 1  # Variable
      value1 = $game_variables[@params[1]]
      if @params[2] == 0
        value2 = @params[3]
      else
        value2 = $game_variables[@params[3]]
      end
      case @params[4]
      when 0  # Equal To
        result = (value1 == value2)
      when 1 
        result = (value1 >= value2)
      when 2 
        result = (value1 <= value2)
      when 3 
        result = (value1 > value2)
      when 4 
        result = (value1 < value2)
      when 5 
        result = (value1 != value2)
      end
    when 2  # Self-Switch
      if @event_id > 0
        key = [@map_id, @event_id, @params[1]]
        result = ($game_self_switches[key] == (@params[2] == 0))
      end
    when 3  # Timer
      if $game_timer.working?
        if @params[2] == 0
          result = ($game_timer.sec >= @params[1] && $game_timer.c_sec == 0)
        else
          result = ($game_timer.sec <= @params[1] && $game_timer.c_sec == 0)
        end
      end
    when 4  # Actor
      actor = $game_actors[@params[1]]
      if actor
        case @params[2]
        when 0  # Party
          result = ($game_party.members.include?(actor))
        when 1 
          result = (actor.name == @params[3])
        when 2 
          result = (actor.class_id == @params[3])
        when 3 
          result = (actor.skill_learn?($data_skills[@params[3]]))
        when 4 
          result = (actor.weapons.include?($data_weapons[@params[3]]))
        when 5 
          result = (actor.armors.include?($data_armors[@params[3]]))
        when 6 
          result = (actor.state?(@params[3]))
        end
      end
    when 5  # Enemy Character
      enemy = $game_troop.members[@params[1]]
      if enemy
        case @params[2]
        when 0  # Appearance
          result = (enemy.alive?)
        when 1  # State
          result = (enemy.state?(@params[3]))
        end
      end
    when 6  # Character
      character = get_character(@params[1])
      if character
        result = (character.direction == @params[2])
      end
    when 7  # Gold
      case @params[2]
      when 0 
        result = ($game_party.gold >= @params[1])
      when 1 
        result = ($game_party.gold <= @params[1])
      when 2 
        result = ($game_party.gold < @params[1])
      end
    when 8  # Item
      result = $game_party.has_item?($data_items[@params[1]])
    when 9 
      result = $game_party.has_item?($data_weapons[@params[1]], @params[2])
    when 10 
      result = $game_party.has_item?($data_armors[@params[1]], @params[2])
    when 11 
      result = Input.press?(@params[1])
    when 12 
      result = eval(@params[1])
    when 13 
      result = ($game_player.vehicle == $game_map.vehicles[@params[1]])
    end
    @branch[@indent] = result
    command_skip if !@branch[@indent]
  end
end

Original thread: https://forums.rpgmakerweb.com/threads/advanced-timer.146956/