MV SDJB_EnhancedWaitOptions

PluginName: SDJB_EnhancedWaitOptions
Author: ShadowDragon


Spoiler: How it works
Code:
 Introduction
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 Enhanced Wait Options to use plugins commands or scriptcalls
 to use inside plugins or in the editor in various ways to
 simplify your needs.


 Plugin Commands
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 Wait 180 Frames
 Wait 3 Second (or Seconds)
 Wait 1 Minute (or minutes)

 Wait For Route        => Waits for all movement routes
 Wait For Animation    => Waits for all animations
 Wait For Balloon      => Waits for all balloon animations
 Wait For Message      => Waits for all messages (Best in parallel)
 Wait For Transfer     => Waits for map transfer
 Wait For Scroll       => Waits for scrolling
 Wait For Gather       => Waits for all followers to gather
 Wait For Action       => Waits for battle action
 Wait For Video        => Waits for all video's
 Wait For Image        => Waits for images to load
 Wait For SE           => Waits for all Sound Effects
 Wait For ME           => Waits for all Music Effects
 Wait For Condition    => Waits for custom condition
 Cancel Wait           => Cancels any active wait or condition

 Example: Wait For Condition <condition>

 Wait For Condition $gameVariables.value(3) > 5
 Wait For Condition Input.isTriggered("cancel")


 Script Calls
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 There are 3 kinds of scriptcalls available that can be
 used inside events, common events or in plugins.

 waitFor(value, unit);
 waitForCond(condition);
 cancelWait();
 
 The Scriptcall "waitFor(value, unit)" can be used for
 a duration of time as follows: (like 3 seconds)
 
 waitFor(180);
 waitFor(180, "frames")
 waitFor("180 frames")
 waitFor(3, "second");
 waitFor(3, "seconds");
 waitFor("3 second");
 waitFor("3 seconds");

 The rest of the waitFor(value) are like plugin commands
 
 waitFor("route");
 waitFor("animation");
 waitFor("balloon");
 waitFor("message");
 waitFor("transfer");
 waitFor("scroll");
 waitFor("gather");
 waitFor("action");
 waitFor("video");
 waitFor("image");
 waitFor("se");
 waitFor("me");


 For the Scriptcall "waitForCond(condition)",
 condition must be in quotes:

 waitForCond("Input.isTriggered('cancel')");
 waitForCond("$gameSwitches.value(5)");
 waitForCond("$gameVariables.value(3) > 5");


 For the Scriptcall "cancelWait()" inside plugins

 setTimeout(() => cancelWait(), 3000);
 or
 setTimeout(cancelWait, 3000);

 This eliminate the conditions or timer after 3 seconds.


PS:
SRD_WaitOptions had some issues, so its a mostly rewrite with extra defensive layer and extra
feature for scriptcalls to make it even more powerful.

I had this for a while making my side game, where I needed it a lot when I encounter problems.
So it has some heavy rewrites to make it work as it should and optimized for extension.


=== TERMS OF USE ===
Free for Non-Commercial and Commercial use when credit is given.
credit one of the following:
ShadowDragon
ShadowDragonJB


=== WARNING ===
YOU ARE NOT ALLOWED TO:
* MODIFY without permission
* EXTEND without permission
* TAKE CODE without permission
* CLAIM AS YOU MADE IT
* REDISTRIBUTE but link back to the forum or itch.io
* SELL this product as standalone.
* DO NOT REMOVE THE HEADER.


(file is below as it require my base plugin (SDJB_Base or SDJB_BaseMZ (minified version))

Download from itch.io
Ohh, yet another wait plugin. I think the only thing you have that mine doesn't is "cancel wait"… I wonder where one would use that… oh, I guess I don't have "wait N seconds/minutes" either. (I also don't have Wait N Frames, but that one's built-in.)
Awesome! :hhappy:
This makes me wonder if there's a use case for a pixi delta time based wait. Maybe for something that benefit from being independent from RM main loop?
What I've tried before was simply hooking into pixi ticker for minigames lol.
Ohh, yet another wait plugin. I think the only thing you have that mine doesn't is "cancel wait"… I wonder where one would use that… oh, I guess I don't have "wait N seconds/minutes" either. (I also don't have Wait N Frames, but that one's built-in.)
wait N frames is default, but I optimized it far further with scriptcalls.

this way, it can be used in editor as well for plugin usages, simple
wait of 180 or write it fully, cancel wait is more if you use events with wait,
but it can run common event with cancel wait to counter it if they don't want
to wait if the player should wait and don't move for 2min and less than 2.5 min.
or move on some timing way.

but I don't know that you had one though =)


Awesome! :hhappy:
This makes me wonder if there's a use case for a pixi delta time based wait. Maybe for something that benefit from being independent from RM main loop?
What I've tried before was simply hooking into pixi ticker for minigames lol.
it may work for PIXI but didn't test it there, but most make a tick variable and update
till it reach n or subtract to check if its 0 otherwise.

but your free to see if it works for PIXI but I can check to make something to use it
inside it as well if it simplify the waiting part like "PIXIwait(value, unit)" or something
purely used for pixi only =)

Original thread: https://forums.rpgmakerweb.com/threads/sdjb_enhancedwaitoptions.181843/