"If [OK] being pressed" freezes the game if done with mouse click

I have an event that wants the player to continue pressing ok button to gather resources till it reaches a limit. If done with the keyboard no problem, when the "pressing" is done with the mouse, it lags and then freeze the game. Why does that happen? what can I do to fix it?
Please give us screenshots of that event with all properties so that we can check how it works.

I can think of several different reasons depending on how your event works, but the solutions are also different.
The event on the map triggers 3 common events and sets the variables used in the common events.
Two common events are parallel and one is autorun.
"Catch fish" variable is set to 2 at the beginning and tends to zero. The more the player pushes the ok button the more "Catch fish" variable increases. If it reaches the number in "Max pulls fish" variable, the fish is catched, ff it goes to zero the fish is lost.

1670436389173.png

1670436422035.png

1670436434222.png
1670436452125.png
my guess is more the escaping fish and catching fish parallels.

even though, you can combine it together with -1 and +1, but
the mouse part is weird indeed, the only thing I could think off
it having a mouse plugin with a switch being ON that mouse buttons
dont work when fishing, when done fishing, turn it OFF to use the
mouse again for movement or navigation.

as that seems the best solution to handle the event in a clean way,
else you need to add NOT touchinput for the mouse.

as I dont know the MZ version for handly mouse, so they cannot
use it either, but it's up to you.
you have a loop inside an autorun that automatically loops by itself.
so your break loops would just restart the autorun if the switch was not there.

but the main problem is that a double loop like this always creates problems, so I would simply remove all loop and break loop commands from that event.
Tried. It is still kind of the same unfortunately. it lags and even if I click a lot, after 2 seconds it says "fish lost" as if it didn't get the clicks.
you have a loop inside an autorun that automatically loops by itself.
so your break loops would just restart the autorun if the switch was not there.

but the main problem is that a double loop like this always creates problems, so I would simply remove all loop and break loop commands from that event.

my guess is more the escaping fish and catching fish parallels.

even though, you can combine it together with -1 and +1, but
the mouse part is weird indeed, the only thing I could think off
it having a mouse plugin with a switch being ON that mouse buttons
dont work when fishing, when done fishing, turn it OFF to use the
mouse again for movement or navigation.

as that seems the best solution to handle the event in a clean way,
else you need to add NOT touchinput for the mouse.

as I dont know the MZ version for handly mouse, so they cannot
use it either, but it's up to you.
If I don't manage to make it work, I'm going to disable it for the whole game. But i'd rather have it working. Make it on and off is a bit annoying for the player I think.
if it's just for fishing part, you can disable the mouse button press 🙂
so it wont be annoying 🙂

you can also tell NOT to use the mouse in the maintime, so you dont
have to disable it.

there is a simple script that calls touch input, so if you add
if [OK] is being pressed && !touchInput than the mouse wont work either.

you just need to find the right touch input and your good as well.
why split the events at all?
try making it a single event with a wait(1), using another variable to count up the time until you reduce the variable by one.
Which ones would you join? I pictured them as 3 asynchronous events. The animation has its own timing. The player clicking for the +1 has another frequency and the fish going for the -1 has yet another.
why split the events at all?
try making it a single event with a wait(1), using another variable to count up the time until you reduce the variable by one.
all three - I see nothing in there that needs to be divided into a different common event.

what you need to do is to use a variable for an internal time counter instead of that heavy wait
all three - I see nothing in there that needs to be divided into a different common event.

what you need to do is to use a variable for an internal time counter instead of that heavy wait
I had to keep separate the animation event because the animation needs the "wait" otherwise it overlaps many animations, every time the player pushes the button and prevents the player to get the +1 while the -1 of the fish continues going, but it's ok, I removed the other wait and made an event with a variable timer as you said and it works muuuch better! no freeze, no small lags that were present even without using the mouse. all smooth thank you.
Problem is that it completely ignores the mouse clicks. It behaves has the clicks weren't considered as an "ok" button triggered. it just says "fish lost" after one second has it does when player doesn't click anything.
Thanks for taking the time to help me by the way.

1670456367267.png
1670456393419.png
1670456414403.png
I made another event in a clean map, completely distinct from the fishing stuff. the event is simply "if ok triggered show animation (no wait)" and it ignores the click of the mouse completely. it works well with keyboard. At this point I'm not sure the ok button is analogous to the left click of the mouse. Also because thinking about it, the mouse left click is "ok" but it is also used to move, so that may be not that obvious that they're alike. it interprets the click as a "move to this cell" instead of an "ok". what you think?
I had to keep separate the animation event because the animation needs the "wait" otherwise it overlaps many animations,
no, it does not - that can be replaced by you manually handling the timing with the counting variable.
you just have to mae sure that the animation is in a conditional branch checing if enough time has passed. And that in itself is easy with the control variable modulo operator, you just have to test until you get the correct number of counters for the modulo.
no, it does not - that can be replaced by you manually handling the timing with the counting variable.
you just have to mae sure that the animation is in a conditional branch checing if enough time has passed. And that in itself is easy with the control variable modulo operator, you just have to test until you get the correct number of counters for the modulo.
Oh interesting, I've never used modulo operator, I'm not that advanced yet x) but i'll try.

Anyway, i replaced the "if OK button triggered" with a "if TouchInput.isTriggered() || Input.isTriggered("ok")" and it works like a charm 🙂 so I guess they're not considered analogous. I didn't know that.
Thanks for helping me out!

Original thread: https://forums.rpgmakerweb.com/threads/if-ok-being-pressed-freezes-the-game-if-done-with-mouse-click.153161/