设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 133|回复: 0

[转载发布] Advanced Timer

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-2 19:52:24 | 显示全部楼层 |阅读模式
                                                                                                  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:       
    1. #==============================================================================
    2. # ■ Codename:334's Advanced Timer
    3. #==============================================================================
    4. #==============================================================================
    5. # ■ Installation: Paste above main
    6. #==============================================================================
    7. #==============================================================================
    8. # ■ Game_Timer
    9. #==============================================================================
    10. class Game_Timer
    11.   #--------------------------------------------------------------------------
    12.   # ● Public Instance Variables
    13.   #--------------------------------------------------------------------------
    14.   attr_accessor :timer_hide               # Hide timer (additional)
    15.   #--------------------------------------------------------------------------
    16.   # ● Object initialization (alias)
    17.   #--------------------------------------------------------------------------
    18.   alias timer_hide_initialize initialize
    19.   def initialize
    20.     timer_hide_initialize#Old method call
    21.     @timer_hide = false
    22.   end
    23.   #--------------------------------------------------------------------------
    24.   # ● 0.00 Acquisition of second
    25.   #--------------------------------------------------------------------------
    26.   def c_sec
    27.     @count % 60 / 2 * 100 / 30
    28.   end
    29. end
    30. #==============================================================================
    31. # ■ Sprite_Timer
    32. #------------------------------------------------------------------------------
    33. #  This is a sprite for displaying a timer.
    34. #  Monitors $game_timer, and the state of the sprite automatically change.
    35. #==============================================================================
    36. class Sprite_Timer < Sprite
    37.   #--------------------------------------------------------------------------
    38.   # ● Update (redefine) source bitmap
    39.   #--------------------------------------------------------------------------
    40.   def update_bitmap
    41.     if $game_timer.sec != @total_sec or $game_timer.c_sec != @c_sec
    42.       @c_sec = $game_timer.c_sec
    43.       @total_sec = $game_timer.sec
    44.       redraw
    45.     end
    46.   end
    47.   #--------------------------------------------------------------------------
    48.   # ● Creating text for drawing (redefinition)
    49.   #--------------------------------------------------------------------------
    50.   def timer_text
    51.     sprintf("%02d'%02d''%02d", @total_sec / 60, @total_sec % 60, @c_sec)
    52.   end
    53.   #--------------------------------------------------------------------------
    54.   # ● Visible state update (redefinition)
    55.   #--------------------------------------------------------------------------
    56.   def update_visibility
    57.     self.visible = $game_timer.working? && !$game_timer.timer_hide #Addition
    58.   end
    59. end
    60. #==============================================================================
    61. # ■ Game_Interpreter
    62. #------------------------------------------------------------------------------
    63. # An interpreter that executes event commands.
    64. # This class is used inside the Game_Map class,
    65. # the Game_Troop class, and the Game_Event class.
    66. #==============================================================================
    67. class Game_Interpreter
    68.   #--------------------------------------------------------------------------
    69.   # ● Conditional branching (redefinitional)
    70.   #--------------------------------------------------------------------------
    71.   def command_111
    72.     result = false
    73.     case @params[0]
    74.     when 0  # Switch
    75.       result = ($game_switches[@params[1]] == (@params[2] == 0))
    76.     when 1  # Variable
    77.       value1 = $game_variables[@params[1]]
    78.       if @params[2] == 0
    79.         value2 = @params[3]
    80.       else
    81.         value2 = $game_variables[@params[3]]
    82.       end
    83.       case @params[4]
    84.       when 0  # Equal To
    85.         result = (value1 == value2)
    86.       when 1
    87.         result = (value1 >= value2)
    88.       when 2
    89.         result = (value1 <= value2)
    90.       when 3
    91.         result = (value1 > value2)
    92.       when 4
    93.         result = (value1 < value2)
    94.       when 5
    95.         result = (value1 != value2)
    96.       end
    97.     when 2  # Self-Switch
    98.       if @event_id > 0
    99.         key = [@map_id, @event_id, @params[1]]
    100.         result = ($game_self_switches[key] == (@params[2] == 0))
    101.       end
    102.     when 3  # Timer
    103.       if $game_timer.working?
    104.         if @params[2] == 0
    105.           result = ($game_timer.sec >= @params[1] && $game_timer.c_sec == 0)
    106.         else
    107.           result = ($game_timer.sec <= @params[1] && $game_timer.c_sec == 0)
    108.         end
    109.       end
    110.     when 4  # Actor
    111.       actor = $game_actors[@params[1]]
    112.       if actor
    113.         case @params[2]
    114.         when 0  # Party
    115.           result = ($game_party.members.include?(actor))
    116.         when 1
    117.           result = (actor.name == @params[3])
    118.         when 2
    119.           result = (actor.class_id == @params[3])
    120.         when 3
    121.           result = (actor.skill_learn?($data_skills[@params[3]]))
    122.         when 4
    123.           result = (actor.weapons.include?($data_weapons[@params[3]]))
    124.         when 5
    125.           result = (actor.armors.include?($data_armors[@params[3]]))
    126.         when 6
    127.           result = (actor.state?(@params[3]))
    128.         end
    129.       end
    130.     when 5  # Enemy Character
    131.       enemy = $game_troop.members[@params[1]]
    132.       if enemy
    133.         case @params[2]
    134.         when 0  # Appearance
    135.           result = (enemy.alive?)
    136.         when 1  # State
    137.           result = (enemy.state?(@params[3]))
    138.         end
    139.       end
    140.     when 6  # Character
    141.       character = get_character(@params[1])
    142.       if character
    143.         result = (character.direction == @params[2])
    144.       end
    145.     when 7  # Gold
    146.       case @params[2]
    147.       when 0
    148.         result = ($game_party.gold >= @params[1])
    149.       when 1
    150.         result = ($game_party.gold <= @params[1])
    151.       when 2
    152.         result = ($game_party.gold < @params[1])
    153.       end
    154.     when 8  # Item
    155.       result = $game_party.has_item?($data_items[@params[1]])
    156.     when 9
    157.       result = $game_party.has_item?($data_weapons[@params[1]], @params[2])
    158.     when 10
    159.       result = $game_party.has_item?($data_armors[@params[1]], @params[2])
    160.     when 11
    161.       result = Input.press?(@params[1])
    162.     when 12
    163.       result = eval(@params[1])
    164.     when 13
    165.       result = ($game_player.vehicle == $game_map.vehicles[@params[1]])
    166.     end
    167.     @branch[@indent] = result
    168.     command_skip if !@branch[@indent]
    169.   end
    170. end
    复制代码




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

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 08:29 , Processed in 0.143743 second(s), 59 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表