Skip to main content

The "vngen_get_button" Function

Syntax#

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

Description#

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.

Example#

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