I don't have the solution, but perhaps hearing what the wait really is might trigger your memory if you did this before - because the wait is a bit misnomed.
The wait command does NOT tell the engine to wait. Instead it tells "skip processing this event for x frames/cycles of the main game loop".
Basically all events are objects (command lists) in the main game loop, and when the engine skips processing one of them for a number of cycles that looks like a wait to the player for simple action button events.
in the case of parallel processes that is why waits reduce lag - they tell the engine to process the PP less times than every frame.
and you basically need to do the same - not halt the processing, but telling the engine to skip processing your commands at those moments.
Hmm.. yes I mean I did know this but still helpful & thanks for the quick reply
🙂
Perhaps this could help me figure this out
Also, in a Script command, you can use
this to reference the current interpreter, e.g.
You might need to give more context, i.e.
- Where you are trying to use this (a Script command, a plugin, somewhere else?); and
- What you are seeing vs what you want to see.
Ahhh yes I see.. so I would be using this in a plugin from plugin command triggered from an event or possibly from a common event depending on the user of the plugin.
I just tested this.wait(10) directly from the event itself and it worked exactly as needed. It caused a delay before the next command in the list on the event. So it seems the problem I really have is trying to cause the event to do a "wait" before executing the next command in the list but only because I need to do this from a plugin.
What happens is there is no delay before the next code in the plugin.
What I am trying to achieve is a set amount of frame delay to animate a series of pictures.
Thanks again for all the help figuring this out
☺️
Edit:
Okay sooo... I figured out how to cause the desired amount of wait
That is to use the code to place inside of the Game Interpreter of $gameMap list like so:
JavaScript:
var i = $gameMap._interpreter._indent;
var pre = $gameMap._interpreter._list.slice(0, $gameMap._interpreter._index + 1);
var post = $gameMap._interpreter._list.slice($gameMap._interpreter._index + 1);
$gameMap._interpreter._list = pre.concat([
{ code: 355, indent: i, parameters: ["console.log('test 1')"]},
{ code: 230, indent: i, parameters: [120] },
{ code: 355, indent: i, parameters: ["console.log('test 2')"]},
], post);
This is just a test example..
the above will just print out to console "test 1" then wait 120 frames then print out "test 2"
Now my only problem with that seems to be the player also cannot move around... All other events move.
So I'm wondering how can I do this "wait" to only make the next code "wait" and still allow the player to function as normal? hope the way I asked that makes sense?
I'm guessing this is most likely because this is not being in a parallel process event that calls the plugin command but now I need to figure out how to now also allow the player to move while code in the list is executed.
Thanks again for the replies
🙂
Edit (again):
hmm... yeah there's got to be a better way because now it also seems if I try to execute other code in the game interpreters list while running that from a parallel event it stops the first events code.
Gosh I hope this is making sense to you.
...if not maybe I can make a small demo of what is happening and try to better explain what it is I want to happen.