How to make it so a player MUST press a button X amount of times during dialogue?

Hello!

I have a scene where you play as a cashier who scans 37 items. I want to make it so the player has to press enter exactly 37 times to "scan" the items, as well as play a little beep sound effect with each scan. Is there any way I can do this? This happens in the middle of dialogue, and the player shouldn't be able to move on unless they press the button.

Thank you in advance!
the simplest way is to simply count the number of show text commands, especially if you include something like "another item" - and you can even add beeps there.

anything else s much more complex - you could perhaps create a loop with a counter and conditional branch if button pressed, but that is somewhat tricky due to the need for parallel processes intermixed with your dialogue
Hakuen Studio Message Actions lets you run common events or javascript during messages.
For player's sake, you'd better use a loop plus individual dialogues show the numbers.

1737876652279.png
@utunnels you forgot something more important there if you
use press Enter, you can hold it and skip through 37 and never breaks.

it should be easier to use " Input.isPressed("ok") " so you have to release
the enter key or at least clear the Input so you must re-press it to make it
work.

but they probably have to count as well or enter till >= 37 to break the loop.
I think you are right.
Yeah but that makes the life of the the player easier. :hswt:

Edit*
It seems add a script: Input.clear() will make them have to wait some time before the repeating is triggered if they hold down the confirm key.
the simplest way is to simply count the number of show text commands, especially if you include something like "another item" - and you can even add beeps there.

anything else s much more complex - you could perhaps create a loop with a counter and conditional branch if button pressed, but that is somewhat tricky due to the need for parallel processes intermixed with your dialogue
Makes sense! I was considering that approach if I couldn't figure out another way
For player's sake, you'd better use a loop plus individual dialogues show the numbers.

View attachment 329856
Thank you so much! This definitely helped!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-it-so-a-player-must-press-a-button-x-amount-of-times-during-dialogue.174956/