You are currently viewing the GMLscripts.com static mirror. Forum access and script submissions are not available through this mirror.

Invert GMLscripts.com

select

Returns an argument selected by n.

n = show_question("Will you click Yes?");
show_message("You clicked " + select(n, "No", "Yes"));

In the above example, show_question() returns either 0 or 1, selecting "No" or "Yes" respectively.

select(n,choice0,choice1,..)
Returns an argument selected by n.
COPY/// select(n,choice0,choice1,..)
//
//  Returns an argument selected by n. If n equals 0,
//  the first choice is returned. The selection value
//  is clamped to return a valid argument.
//
//  eg. select(boolean, "False", "True");
//
//      n           selection, integer
//      choiceN     value to return, if selected
//
/// GMLscripts.com/license
{
    return argument[clamp(argument[0] + 1, 1, argument_count - 1)];
}

Contributors: xot

GitHub: View · Commits · Blame · Raw