Random text and tables
imjustmike
Member Posts: 450
Hi all,
I've been playing with tables and displaying text recently and wondered if someone could answer a question I haven't been able to answer my self.
Essentially, I want to be able display stock phrases (saved in a table) that include a saved attribute (potentially in a different table).
A simple use case would be a character in a game giving a dialogue box that had the player's name. That's simple enough. BUT what I want to do is have the ability to select a random phrase from the table, and then input the attribute (to add a bit of variety to the game, I don't want the exact same dialogue showing with each interaction). Because each phrase will be structured differently, the attribute won't be in the same place each time so I'm struggling to work out if this is possible with the expression editor + tables + display text.
Example use case:
Player reaches a character in game which could prompt (randomly selected) one of 3 phrases:
1. Hello PLAYERNAME, welcome to the city.
2. PLAYERNAME, you've reached the city.
3. Welcome the the city, PLAYERNAME.
The attribute is the same in every example, but it's position in the phrase is different each time.
Is there any simple way to set this up?
Ideally the solution would be to able to place the attribute in the table - literally having the above phrases in the table, but from what I can gather this isn't possible.
Does anyone have any pointers?
I've been playing with tables and displaying text recently and wondered if someone could answer a question I haven't been able to answer my self.
Essentially, I want to be able display stock phrases (saved in a table) that include a saved attribute (potentially in a different table).
A simple use case would be a character in a game giving a dialogue box that had the player's name. That's simple enough. BUT what I want to do is have the ability to select a random phrase from the table, and then input the attribute (to add a bit of variety to the game, I don't want the exact same dialogue showing with each interaction). Because each phrase will be structured differently, the attribute won't be in the same place each time so I'm struggling to work out if this is possible with the expression editor + tables + display text.
Example use case:
Player reaches a character in game which could prompt (randomly selected) one of 3 phrases:
1. Hello PLAYERNAME, welcome to the city.
2. PLAYERNAME, you've reached the city.
3. Welcome the the city, PLAYERNAME.
The attribute is the same in every example, but it's position in the phrase is different each time.
Is there any simple way to set this up?
Ideally the solution would be to able to place the attribute in the table - literally having the above phrases in the table, but from what I can gather this isn't possible.
Does anyone have any pointers?
Answers
http://gshelper.com/cycle-through-a-list-at-random-with-out-repeats-gamesalad-tutorials-video/
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Thanks also @braydon_sfx - that tutorial will come in very useful too :-)
@MotherHoose i am having the same problem anyway you could send me that demo?
Hopefully emailed the right demo to you!
- MH
@MotherHoose is back!
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
OMG. I was going to write that @MotherHoose is no longer active. Welcome back, @MotherHoose!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
LOL same here! Hope you stick around, MH!
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Glad to see you posting @MotherHoose!