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

[转载发布] Timers

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

    连续签到: 2 天

    [LV.7]常住居民III

    8307

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 6 天前 | 显示全部楼层 |阅读模式
    Timers v1.1
    FeelZoR


    Free to Use for both Commercial and Non-Commercial projects.
    Credits not required but highly appreciated!

    You can find a more in-depth version of the TOS here.

    Requested here.

    Introduction
    Have you ever needed to use some Timers in your game? For example, to stop the game for a few seconds, but the "Wait" command wasn't enough? (or you would put 50 "Wait 999 frames").
    With this real time plugin, you can create multiple timers. You create them in one call, and check if the time elapsed since their creation is over a certain amount of time (in milliseconds, seconds or minutes) and you can do something after this specific time!

    Features
    - Create timers and check if the time elapsed since their creation is over a certain amount of time.
    - Timers are dependent of each save file.
    - Timers won't run while the game is paused (in menu, message window open, ...).

    How to Use
    Do not rename the file! It must be called Timers.js in order to function correctly!

    Plugin Commands:
    - Timers CREATE NameOfTheTimer MSRollback - Creates a new Timer.
    NameOfTheTimer - The name of the timer. Be careful, the name is case sensitive. You can you almost any symbol you want, though it's better to keep clear and alphanumerical names.
    MSRollback - If you don't want the timer to use the current time, use this parameter. It will allow you to make a timer MSRollback milliseconds old.
    E.g.: Timers CREATE Chicken 500 - If I execute this command at 2:00:00.500, it will create a Timer named Chicken with the time 2:00:00.000.
    E.g.: Timers CREATE Chicken -500 - If I execute this command at the same time than before, it will create a Timer named Chicken with the time 2:00:01.000.

    Careful: If the Timer already exists, it won't be updated.

    - Timers UPDATE NameOfTheTimer MSRollback - Updates (or create) a new timer.
    The usage is the same than Timers CREATE NameOfTheTimer MSRollback, but it updates the Timer if it already exists and create it if it doesn't.

    - Timers DELETE NameOfTheTimer - Deletes the specified timer.

    - Timers MODE mode - Changes the Timer mode.
    mode - The new mode to use. Accepted values are:

    • ms: Set the mode to milliseconds. (milliseconds, msec, msecs and reset are accepted values, too).
    • s: Set the mode to seconds. (sec, seconds and secs are accepted values, too).
    • min: Set the mode to minutes. (m, minutes and mins are accepted values, too).
    E.g.: Timers MODE s - Will set the mode to seconds.

    Script calls:

    - Use $gameTimers.isOver(name, time); to know if the Timer name is older than the time specified.
    name: Case sensitive; the name of the timer.
    time: The time that needs to be elapsed since the last timer update for this method to return true.
    Depending on the mode, the time needs to be in milliseconds, seconds or minutes.
    E.g.: $gameTimers.isOver("Chicken", 50); will return true if the timer Chicken hasn't been updated in 50ms, 50s or 50min depending on the mode.

    - Use $gameTimers.isOverVar(name, variable); to do the same than the previous script call, with the content of a variable instead of a constant value.
    E.g.: $gameTimers.isOverVar("Chicken", 2); will return true if the timer Chicken hasn't been updated since the time specified in variable 2. It also uses the mode to decide whether it's milliseconds, seconds or minutes.

    Demo
    Available here.
    Sounds and graphics removed to make the download faster. Please copy and paste it in a new project.

    Script
    You can download it here.

    FAQ
    No FAQ yet.

    Credit and Thanks
    - FeelZoR for making the plugin


    Changelog

    Version 2.0 - Major update
    + Added possibility to delete a timer
    + Timer update is now handled by a specific command.
    + Plugin commands used instead of script calls when possible.
    * Timer creation cannot update timers anymore.​

    Version 1.1 - Bug fix

    • Corrected a bug where the save wouldn't work.
    Version 1.0 - Initial Version

    Author's Notes
    As this is my first plugin in RMMV, do not hesitate to report any bad things in the code.
    It's probably not very well-designed sometimes, as I'm not very used to JS and RMMV yet, I'm learning with what's already made!


    Do not hesitate to report me any bug you find, and I'm open to suggestions too!


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-1 20:49 , Processed in 0.160554 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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