YoYo Games Wiki

choose(x1,x2,x3,...)

From YoYoGames Wiki

Description

choose will return, randomly, one of the values in the brackets.

Arguments

  • x1: first value
  • x2: second value
  • x3: third value
  • ...: other values to choose from (16 values max)

Returns

  • (real): a random value from the possible values

Example

In the following example, the variable whatroom could hold room1 or room2 or room3. It's a way of choosing random from a list of things. The most choices you can have is 16.

whatroom = choose(room1,room2,room3);
Content from GMKB, was used to expand this article. The content was contributed by nickydude.