The "vngen_get_button" Function


[clear]booleanOptional: Enables or disables clearing the result from memory after returning it (enabled by default)


When run, this script will return the result of the most recently-selected button, which is stored as the ID of the selected button. If buttons exist but none has been selected, -1 will be returned instead.

This script is intended to be used in conditional statements such as if and switch to take action based on the selected button. In order to prevent this conditional statement from repeatedly executing code, button results will be cleared from memory after being returned. To disable this behavior, it is possible to set the [clear] argument to false, in which case button results can be cleared later with vngen_button_clear.


if (vngen_get_button(false) == "btn") {
switch (vngen_get_button()) {
case "btn1": /* Action */; break;
case "btn2": /* Action */; break;