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

dm604

Veteran
Veteran
Joined
Sep 18, 2021
Messages
49
Reaction score
15
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,992
Reaction score
8,625
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,992
Reaction score
8,625
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
49
Reaction score
15
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,283
Reaction score
1,234
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
49
Reaction score
15
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,283
Reaction score
1,234
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
49
Reaction score
15
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

unintentionally made a track that sounds straight out of Yume Nikki
Revisiting one of my older projects in a long time to work some more on the mechanics. I've been working on- and off-again for about a year now on recreating the Force and Mystic systems from Wild ARMs. And I think I've finally made some good breakthroughs on that!

Still, it is not perfect and I may post my thoughts at a later time to see if there are any other suggestions or alternatives I've missed.
actor name string, why you gotta be case sensitive like that?
Doing RPG Maker News for 26th October 2021

My entire world, full of monsters and treasures, will likely be done by the end of the year. After that it's all NPCs and side quests... then done. I'm never making an open world game again xD

Forum statistics

Threads
116,106
Messages
1,095,841
Members
151,502
Latest member
cpdealer
Top