Suggestion: Simple Choice Function

0 favourites
  • 3 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • Hello, Dcrew here suggesting a feature!

    Gamemaker has this function, Now I don't use game-maker.. But this is very useful!

    A Choice Function!

    So say if I put:

    Set Global Variable 'Hmmm' to Choose(1,2,3,4,5,6,7,8,9)

    It will loop this peice of code for the ammount of "," times

    And it will choose any of those numbers randomly.

    Another example:

    Set Global Variable 'EG' to Choose(1,-1)

    then It would choose either 1 or -1, at random!!

    This is very useful, and I really hope to see it!

    P.S: You could do it with strings to; Set Global String 'Hello' to Choose("hi","hello","hey","sup")

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can actually do this with a combination of other expressions:

    float(tokenat("1,3,5,7,9", int(random(5)), ","))

    where "1,3,5,7,9" is a comma-separated list of numbers and the 5 in random(5) is the number of items in the list.

  • You can actually do this with a combination of other expressions:

    float(tokenat("1,3,5,7,9", int(random(5)), ","))

    where "1,3,5,7,9" is a comma-separated list of numbers and the 5 in random(5) is the number of items in the list.

    Thanks, But I do recommend adding the choice function still, for people who dislike complex methods, or don't understand how to use it.

    Don't get me wrong, I understand that fully! But I'd prefer just to type "choose(1,3,5,7,9)"

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)