How to prevent continuous clicking a button that calls a comment event?

dm604

Veteran
Veteran
Joined
Sep 18, 2021
Messages
42
Reaction score
14
First Language
English
Primarily Uses
RMMZ
Hi, everyone:

In my current project, I have set up an action point (AP) system and a time slice (TS) system.
The day is separated into Morning, afternoon, evening, and night.
Upon clicking the blue arrow, the player would be taken to the next time slice (TS).

Here is the problem, I noticed that when I click on the button continuously, say 5 times, and action would be performed 5 times.

Is there any way I could add a pause somewhere to prevent players from clicking on the button continuously by mistake?

In the current project, the player would be transferred to the ending cutscene map. However, if the player clicked on the button several times before the transfer, the script would still taken effect upon arriving on the final map, which could cause problems.

Here are the screenshots of my setup.

Thank you.
 

Attachments

  • Formosa Quest - RPG Maker MZ 9_20_2021 4_49_19 PM.png
    Formosa Quest - RPG Maker MZ 9_20_2021 4_49_19 PM.png
    151.5 KB · Views: 8
  • Formosa Quest - RPG Maker MZ 9_20_2021 4_49_24 PM.png
    Formosa Quest - RPG Maker MZ 9_20_2021 4_49_24 PM.png
    156.3 KB · Views: 8
  • Formosa Quest 9_20_2021 5_00_05 PM.png
    Formosa Quest 9_20_2021 5_00_05 PM.png
    528.5 KB · Views: 8

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,904
Reaction score
8,598
First Language
German
Primarily Uses
RMMV
you can use an conditional branch inside the common event to prevent it from working on every click.
as the condition you can then use whatever you want to prevent multiple effects, for example a check for time (only one click per second) or a check for story flow (no multiple checks in cutscenes) or whatever.

the condition can be made as simple or as complex as you want, but of course a more complex condition is more work.
 

midnight1443

Villager
Member
Joined
Aug 19, 2016
Messages
17
Reaction score
5
First Language
English
Primarily Uses
you can use an conditional branch inside the common event to prevent it from working on every click.
as the condition you can then use whatever you want to prevent multiple effects, for example a check for time (only one click per second) or a check for story flow (no multiple checks in cutscenes) or whatever.

the condition can be made as simple or as complex as you want, but of course a more complex condition is more work.
How do you check for time?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,904
Reaction score
8,598
First Language
German
Primarily Uses
RMMV
several ways depending on whether you have a time system in your game or not.
the simplest way is to have a different common event permanently running that counts up a variable and then use a second variable to store the last time the click was triggered and compare the difference.

check for one of the tutorials to event a time system for more details
 

dm604

Veteran
Veteran
Joined
Sep 18, 2021
Messages
42
Reaction score
14
First Language
English
Primarily Uses
RMMZ
While I understand the concept, I am having a hard time putting it into code.
Thanks anyways. :)
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,214
Reaction score
1,180
First Language
English
Primarily Uses
RMMV
Is there any way I could add a pause somewhere to prevent players from clicking on the button continuously by mistake?
Just curious, is this actually a concern? I don't know about you, but I have played many computer games over the past 30 years that involve clicking things with a mouse...I might have accidentally double-clicked something a couple of times, total.

I wouldn't consider this worth any extra effort to try to prevent :wink:

Just like all of those menus that ask "Are you sure you want to trash this item?" "Are you sure you want to quit?" Yes, I did not randomly click an element of the UI.
 

dm604

Veteran
Veteran
Joined
Sep 18, 2021
Messages
42
Reaction score
14
First Language
English
Primarily Uses
RMMZ
Just curious, is this actually a concern? I don't know about you, but I have played many computer games over the past 30 years that involve clicking things with a mouse...I might have accidentally double-clicked something a couple of times, total.

I wouldn't consider this worth any extra effort to try to prevent :wink:

Just like all of those menus that ask "Are you sure you want to trash this item?" "Are you sure you want to quit?" Yes, I did not randomly click an element of the UI.

Thanks for your response.
Yeah, I'm still pretty new to RM, so that was my work-around.

The issue is that by clicking on the arrow, the time will jump to the next time slice.

So if I click the button 5 times in a row like a madman, the comment event will run FIVE TIMES, and since the script will also change the screen tint, the end result is not pretty. Haha.

My final work-around involves creating a choice window asking players whether they want to advance the time or not. During this window, players cannot continue to click on the arrow. Thank goodness!

It's not an elegant solution, but it's one solution nonetheless. :)
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,214
Reaction score
1,180
First Language
English
Primarily Uses
RMMV
My final work-around involves creating a choice window asking players whether they want to advance the time or not. During this window, players cannot continue to click on the arrow.
...that was not the point I was trying to make with my post...
:guffaw: :LZYugh:

I point out a thing I hate in UI design, and he proceeds to add it in. I don't think this is my fault.
 

dm604

Veteran
Veteran
Joined
Sep 18, 2021
Messages
42
Reaction score
14
First Language
English
Primarily Uses
RMMZ
Yeah, I hate it when the system asks for confirmation too frequently.
On the other hand, I've rarely used the "advance time" function when I play similar games, so I think this warrants a confirmation, as by advancing the game, the player loses an opportunity to act, which can be quite impactful in a game with a deadline.

Appreciate your opinion. B)

...that was not the point I was trying to make with my post...
:guffaw: :LZYugh:

I point out a thing I hate in UI design, and he proceeds to add it in. I don't think this is my fault.
 

LaimNoah

Warper
Member
Joined
Oct 1, 2021
Messages
1
Reaction score
0
First Language
English
Primarily Uses
N/A
This would mean that if I click cps test the button five times, the script will run five times, changing the screen tint and making things even worse. I am having a difficult time implementing the concept in code.
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Maldra wrote on stramin's profile.
Hi regarding the 32 bit -> 64 bit
I am running on a 64 bit windows OS and tried doing this conversion. I converted all of the .exe files that I could find in the KADOKAWA\RPGMV folder using the 4gbpatch.exe file. However, after trying to access RPG Maker MV after this conversion, it simply will not load. Do you have any advice or any ideas?
****ing muscle memory: does anyone else habitually quit out of test play when they notice something they """HAVE""" to fix, in spite of the fact that you can now edit DURING test play?

...thousands of times...

...every day?
Does anyone recognize him? :kaocry:
pwkyiDa.jpg

And hi.
finally drew 3 of the enemies that appear as students from the high school that's in my game.
Finnuval wrote on ShuBun-Kin's profile.
Loving the avatar :D

Forum statistics

Threads
115,928
Messages
1,094,124
Members
151,187
Latest member
NaughtyPoncho
Top