How do I choose random letters from string variable?

0 favourites
  • 7 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Let me explain myself better: I'm building a quiz/trivia app, the idea is, on start of each layout, it randomize the letters displayed. I already managed to do this, like shown here:

    So basically, it randomizes the letters on start of layout. And it doesn't repeat the same letters. But now, I want to add multiple same letters in the variable, like this example: A, B, C, D, E, E, A, G, H

    If i change the strings, it won't work because the While loop is made to not repeat the same strings. So how I do this easily?

    Thanks and I hope I explained myself clearly!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Instead of setting the letter randomly through the system action why don't you draw it straight from the array itself (choosing a random cell of course). That way you could easily control what is in it and just delete the cell when the letter is chosen.

  • Instead of setting the letter randomly through the system action why don't you draw it straight from the array itself (choosing a random cell of course). That way you could easily control what is in it and just delete the cell when the letter is chosen.

    Can you please give me an example on how to do it?

  • just delete(disable) condition(just condition,not actions)

    Array_letters X Contains Value random_letter

  • just delete(disable) condition(just condition,not actions)

    Array_letters X Contains Value random_letter

    Yeah thanks, I already tried that, but now it gives me 3/4 times the same letter randomly. You see what I mean?

    Maybe i should try and randomize another array containing the placement of the letters?

  • No worries, https://db.tt/3b7YVAzB

    You will have to change it to suit your needs but this should show you how.

    Press space to get a random letter from the array. Using debug you can see the cells being removed

    .

  • No worries, db.tt/3b7YVAzB

    You will have to change it to suit your needs but this should show you how.

    Press space to get a random letter from the array. Using debug you can see the cells being removed

    .

    God bless my brother!

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