0 Favourites

Suggestion: Simple Choice Function

  • 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")

  • Construct 3

    Buy Construct 3

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

    Buy 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)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
random bugs and suggestions
90 4,514
Tom's avatar
Tom Construct Team Founder
Unread hot topic
73 5,920
part12studios's avatar
part12studios
Unread hot topic
63 3,819
eli0s's avatar
eli0s