Rapid button + Timer

Hello, I would like to create a minigame that involves repeatedly pressing the "ok" button to emerge as winners, a classic.
I want to create something like this Lisa the Painful's minigame: [link].

The system should have a timer, for example, one minute, and during this period, the player must press the "ok" button as quickly as possible. If they delay too much, the event is interrupted, and they have to start over.
I found a good foundation in this post: [link], but it doesn't include the timer aspect. As it stands, the player can press the "ok" button (even after a long time) until they reach the designated variable.
you can use a variable, like that, but you can check galv_VariableBar and
check the demo how it's used with it.

you dont have t use the plugin in general as it is for showing and hiding,
but it can be a helptool to see how it works when you press the button.

any button require a keymapper plugin so you arent restricted to the
5 or 6 basic (OK, Cancel and arrows).
you can use a variable, like that, but you can check galv_VariableBar and
check the demo how it's used with it.

you dont have t use the plugin in general as it is for showing and hiding,
but it can be a helptool to see how it works when you press the button.

any button require a keymapper plugin so you arent restricted to the
5 or 6 basic (OK, Cancel and arrows).
I check the variable using supertoolsengine! 🙂
I think this idea can be performed without plugin - I can use the conditional branch "if "OK" Button is pressed" just like it is said in this post: link
like I said, you can use it as a tool, as the images aren't required to
check if the system works.

if it works, you can just remove them, and you can say something like a
gabwindow if a variable ID reach X if you which too.
as message window will interupt it, also galv timed message might work
here nicely if done correctly 🙂
like I said, you can use it as a tool, as the images aren't required to
check if the system works.

if it works, you can just remove them, and you can say something like a
gabwindow if a variable ID reach X if you which too.
as message window will interupt it, also galv timed message might work
here nicely if done correctly 🙂
Alright, thank you. I will check out this plugin then.
Hello, @caethyril

I'm really sorry to bother you! If you can spare a bit of your time, I'd like to ask for help regarding the "rapid button press" issue.

I'm trying to use the solution you suggested in this post: [link]. In the message, you mentioned that if you want to add a timer, you just need to add a variable and branches. However, I can't quite figure out how to do it, 🙁 and the result I'm getting isn't what I need (I require this "rapid button press" mechanic just on the map, not in battles).
In case it helps: you may find "button mash" is a good search term for this. 👋

Here's the linked example, plus how I would use a timer variable:
Spoiler: edited example
◆Control Switches:#0001 ButtonDown = OFF ◆Control Variables:#0004 Input = 0 ◆Control Variables:#0005 Timer = 180 ◆Loop ◆If:ButtonDown is ON ◆If:Button [OK] is pressed down ◆Comment:Nothing. ◆ :Else ◆Comment:Button was pressed and released! ◆Control Switches:#0001 ButtonDown = OFF ◆Control Variables:#0004 Input += 1 ◆ :End ◆ :Else ◆If:Button [OK] is pressed down ◆Comment:Button is now pressed down! ◆Control Switches:#0001 ButtonDown = ON ◆ :End ◆ :End ◆Comment:Check if button has been mashed enough. ◆If:Input = 10 ◆Break Loop ◆ :Else ◆Comment:Advance timer and check for timeout. ◆Control Variables:#0005 Timer -= 1 ◆If:Timer ≤ 0 ◆Break Loop ◆ :Else ◆Wait:1 frame ◆ :End ◆ :End ◆ :Repeat Above ◆If:Timer > 0 ◆Text:None, Window, Bottom : :You escaped! \.Congratulations! ◆ :Else ◆Text:None, Window, Bottom : :Oh no! ◆ :End
I.e. before the loop starts, set a new variable, e.g. "Timer", equal to the number of frames the player has to complete the game. Each loop, decrease the value of "Timer" by 1; if "Timer" hits 0, that's time up, so break out of the loop. It's a success if "Timer" is more than 0 after the loop.
In case it helps: you may find "button mash" is a good search term for this. 👋

Here's the linked example, plus how I would use a timer variable:
Spoiler: edited example
◆Control Switches:#0001 ButtonDown = OFF ◆Control Variables:#0004 Input = 0 ◆Control Variables:#0005 Timer = 180 ◆Loop ◆If:ButtonDown is ON ◆If:Button [OK] is pressed down ◆Comment:Nothing. ◆ :Else ◆Comment:Button was pressed and released! ◆Control Switches:#0001 ButtonDown = OFF ◆Control Variables:#0004 Input += 1 ◆ :End ◆ :Else ◆If:Button [OK] is pressed down ◆Comment:Button is now pressed down! ◆Control Switches:#0001 ButtonDown = ON ◆ :End ◆ :End ◆Comment:Check if button has been mashed enough. ◆If:Input = 10 ◆Break Loop ◆ :Else ◆Comment:Advance timer and check for timeout. ◆Control Variables:#0005 Timer -= 1 ◆If:Timer ≤ 0 ◆Break Loop ◆ :Else ◆Wait:1 frame ◆ :End ◆ :End ◆ :Repeat Above ◆If:Timer > 0 ◆Text:None, Window, Bottom : :You escaped! \.Congratulations! ◆ :Else ◆Text:None, Window, Bottom : :Oh no! ◆ :End
I.e. before the loop starts, set a new variable, e.g. "Timer", equal to the number of frames the player has to complete the game. Each loop, decrease the value of "Timer" by 1; if "Timer" hits 0, that's time up, so break out of the loop. It's a success if "Timer" is more than 0 after the loop.
Thank you so much, it worked!

Original thread: https://forums.rpgmakerweb.com/threads/rapid-button-timer.162187/