Randomly Generated Strings/Names

I've been trying to make a program in GameSalad that'll generate a random word using a pattern of vowels and consonants. I have it so when a button is pressed, an boolean attribute will be set to true, and an object will, if the attribute is true, take a vowel and consonant from a table and generate a word that is pronounceable, but I keep getting the same string over and over again with the same vowels and consonants. It's not the exact same string every time I reload the scene, it'll change, but only when I reset it, when I hit the button, it gives me the same string over and over. Here's the expression used to randomize the string:

tableCellValue( game.tblLetters ,random(1,5),1)..tableCellValue( game.tblLetters ,random(1,21),2).. tableCellValue( game.tblLetters ,random(1,5),1)

Here are some screenshots as well:

photo ScreenShot2013-04-11at43224PM_zpsdc924b24.png

photo ScreenShot2013-04-11at43253PM_zps06c0b00b.png

photo RandomName_zps2ecb449e.png

Having trouble with your game? Sounds like a personal problem.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2013
    Try taking the random functions out of the tableCellValue expressions. This is a known issue with GameSalad. Generate them first and then use the attributes you generate within the tableCellValue expressions:

    Change Attribute self.random1 to random(1,5)
    Change Attribute self.random2 to random(1,21)
    Change Attribute self.random3 to random(1,5)

    tableCellValue( game.tblLetters ,self.random1,1)..tableCellValue( game.tblLetters ,self.random2,2).. tableCellValue( game.tblLetters ,self.random3,1)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ADSentertainmentADSentertainment Member Posts: 397
    edited April 2013
    Try taking the random functions out of the tableCellValue expressions. This is a known issue with GameSalad. Generate them first and then use the attributes you generate within the tableCellValue expressions:

    Change Attribute self.random1 to random(1,5)
    Change Attribute self.random2 to random(1,21)
    Change Attribute self.random3 to random(1,5)

    tableCellValue( game.tblLetters ,self.random1,1)..tableCellValue( game.tblLetters ,self.random2,2).. tableCellValue( game.tblLetters ,self.random3,1)
    That's a bit of a problem, if I have multiple vowels or consonants, they'd all be the same letter since they're derived from the same random value from the attribute, is there something I can do that DOESN'T involve me making a random value for each individual vowel and consonant?

    EDIT: oh, I thought you were using random3 as the third column with the other characters. Is there still a way I can do this without making an attribute for every vowel and consonant?

    Having trouble with your game? Sounds like a personal problem.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    How long are your words? If you have 5-letter words, then you need 5 random attributes. If you have 10-letter words, then you need 10 random attributes, etc.

    If you want to make 500 5-letter words, you still just use the same 5 attributes and just have them generate a new random value each time you want to make a word.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ADSentertainmentADSentertainment Member Posts: 397
    How long are your words? If you have 5-letter words, then you need 5 random attributes. If you have 10-letter words, then you need 10 random attributes, etc.

    If you want to make 500 5-letter words, you still just use the same 5 attributes and just have them generate a new random value each time you want to make a word.
    It'll really depend, I'm going to have multiple options, and I might even make it so you'd be able to choose the pattern of consonants and vowels

    Having trouble with your game? Sounds like a personal problem.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @ADSentertainment Here's a demo.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.