Randomly Generated Strings/Names
ADSentertainment
Member Posts: 397
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:
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:
Having trouble with your game? Sounds like a personal problem.
Comments
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
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.
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
Having trouble with your game? Sounds like a personal problem.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User