Hi,
So I want to add a little minigame to my rpg, so I wrote a script for it. The script works pretty well except I'm having trouble with getting the delay to work right. I put a minimal example in the picture below. As in the picture, the structure of the event I want in rpg maker mz is:
(1) ask the player for something (that works fine) then if yes:
(2) play a mini-game. this mini-game is a script that is much more complicated than the below script (uses PIXI etc.) but it does work.
(3) then AFTER the mini-game is complete, talk some more
The problem I'm having is that the event does not "wait" for the minigame to end. Like in the below minimal example, in my minigame I did a loop by having a counter then recursively calling a function f() with setTimeout(). That works fine for the game itself, but the event just seems to continue on to the text after that even while my mini-game is still playing! (in the below example, my mini game is counting from 1 to 10, so not so much of a game haha. But it gets the idea across.)
So here's my big question: what do I need to do so that this event does not continue until AFTER the script in the middle there is done? Is there something I can call that's like "stop execution" at the beginning of the script, then in the 10th counter can I call "continue execution" somehow?
Any help is super appreciated -- thanks!!
So I want to add a little minigame to my rpg, so I wrote a script for it. The script works pretty well except I'm having trouble with getting the delay to work right. I put a minimal example in the picture below. As in the picture, the structure of the event I want in rpg maker mz is:
(1) ask the player for something (that works fine) then if yes:
(2) play a mini-game. this mini-game is a script that is much more complicated than the below script (uses PIXI etc.) but it does work.
(3) then AFTER the mini-game is complete, talk some more
The problem I'm having is that the event does not "wait" for the minigame to end. Like in the below minimal example, in my minigame I did a loop by having a counter then recursively calling a function f() with setTimeout(). That works fine for the game itself, but the event just seems to continue on to the text after that even while my mini-game is still playing! (in the below example, my mini game is counting from 1 to 10, so not so much of a game haha. But it gets the idea across.)
So here's my big question: what do I need to do so that this event does not continue until AFTER the script in the middle there is done? Is there something I can call that's like "stop execution" at the beginning of the script, then in the 10th counter can I call "continue execution" somehow?
Any help is super appreciated -- thanks!!