じ☆ve冰风 发表于 2026-8-2 19:52:24

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










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
    when 0# Switch
      result = ($game_switches[@params] == (@params == 0))
    when 1# Variable
      value1 = $game_variables[@params]
      if @params == 0
      value2 = @params
      else
      value2 = $game_variables[@params]
      end
      case @params
      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]
      result = ($game_self_switches == (@params == 0))
      end
    when 3# Timer
      if $game_timer.working?
      if @params == 0
          result = ($game_timer.sec >= @params && $game_timer.c_sec == 0)
      else
          result = ($game_timer.sec <= @params && $game_timer.c_sec == 0)
      end
      end
    when 4# Actor
      actor = $game_actors[@params]
      if actor
      case @params
      when 0# Party
          result = ($game_party.members.include?(actor))
      when 1
          result = (actor.name == @params)
      when 2
          result = (actor.class_id == @params)
      when 3
          result = (actor.skill_learn?($data_skills[@params]))
      when 4
          result = (actor.weapons.include?($data_weapons[@params]))
      when 5
          result = (actor.armors.include?($data_armors[@params]))
      when 6
          result = (actor.state?(@params))
      end
      end
    when 5# Enemy Character
      enemy = $game_troop.members[@params]
      if enemy
      case @params
      when 0# Appearance
          result = (enemy.alive?)
      when 1# State
          result = (enemy.state?(@params))
      end
      end
    when 6# Character
      character = get_character(@params)
      if character
      result = (character.direction == @params)
      end
    when 7# Gold
      case @params
      when 0
      result = ($game_party.gold >= @params)
      when 1
      result = ($game_party.gold <= @params)
      when 2
      result = ($game_party.gold < @params)
      end
    when 8# Item
      result = $game_party.has_item?($data_items[@params])
    when 9
      result = $game_party.has_item?($data_weapons[@params], @params)
    when 10
      result = $game_party.has_item?($data_armors[@params], @params)
    when 11
      result = Input.press?(@params)
    when 12
      result = eval(@params)
    when 13
      result = ($game_player.vehicle == $game_map.vehicles[@params])
    end
    @branch[@indent] = result
    command_skip if !@branch[@indent]
end
end




本贴来自国际rpgmaker官方论坛作者:Agent334处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/advanced-timer.146956/
页: [1]
查看完整版本: Advanced Timer