じ☆ve冰风 发表于 2026-7-31 16:38:32

Timer - Call methods after X frames


https://dl.dropboxusercontent.com/u/73268/rmvxace/scripts/TDD_Timer.png
1.0.1

Ever wanted to call a sound effect in your scripts after, say, 30 frames have passed? Or how about wait 60 seconds before you render a sprite with the bitmap Cache.system("gone_4_60_s")? Well now you can, with this teeny tiny and easy-to-use script!

Introducing the fantabulous TDD::Timer.call_after_frames!


https://dl.dropboxusercontent.com/u/73268/rmvxace/scripts/how_it_works.png


You use it like this:

TDD::Timer.call_after_frames(:frames   => Number,- Number of frames to wait before calling :method
bserver => Object,- Object for which method should be called:method   => :symbol, - Method to call on
bserver Object
arams   => Object,- OPTIONAL: Any object you wish to pass to the :method)Real world example:

SpoilerHere it is used (in combination with my Ease animation script) to match the sound effects to the animation, by using delayed calls to methods that call the sound effect:



One of those calls look like this:

# Audio: Play fall againTDD::Timer.call_after_frames(observer: self, method:
lay_shatter_sfx, frames: 170) 




https://dl.dropboxusercontent.com/u/73268/rmvxace/scripts/installation.png


You know the drill: Put it somewhere below ▼ Materials but above ▼ Main Process


https://dl.dropboxusercontent.com/u/73268/rmvxace/scripts/download.png


You can get it on github directly here; this link will always be up-to-date with the latest stable version:

https://raw.githubusercontent.com/TorD/TDD-Timer/master/script.rb

If you want to follow the development, or report bugs, please use the GitHub repository found here:

https://github.com/TorD/TDD-Timer


https://dl.dropboxusercontent.com/u/73268/rmvxace/scripts/license.png


Free for non-commercial and commercial use. Credit greatly appreciated but not required. Share script freely with everyone, but please retain the description area unless you change the script completely. Thank you.

 


https://dl.dropboxusercontent.com/u/73268/rmvxace/scripts/credits.png


Galenmereth / Tor Damian Design

 

 

Feeling generous?

If you would like to give me a small tip to help me spend even more time making and maintaining these free scripts, do consider supporting me on Gratipay. Any and all support will be greatly appreciated.


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