Solving the ‘A Button Paradox’

Many of you might be wondering what the A Button Paradox is. If you have come across this issue, it can be very frustrating. The A Button Paradox is when you add dialogue to a script attached to the A button, but on pressing A to close the dialogue box, your script is executed again, causing some undesired effects in your games.

There are many reasons you might want to put dialogue in a script attached to A button. I personally use this for battle systems and some other things. So how do you overcome this issue? 

The Method 

This is the easiest method. You simply use a variable to check if the script is currently running and if it is, you skip the script like so:

A local variable is used to bypass the infinite loop

This took me hours to work out, mostly because I was overthinking it. Sometimes when you are working on a project for hours on end, you can sit there overthinking a task that has quite a simple solution. Breaks do help and if I had done so earlier, I might not have had such a hard time working this out!

Liked it? Take a second to support GB Studio Central on Patreon!
Become a patron at Patreon!