Displaying text... in a dynamic way (not working, need help, please!)
ryast
Member Posts: 145
I have 5 text attributes:
Note1 = "one"
Note2 ="two"
Note3 ="three"
Note4 ="four"
Note5 ="five"
I have one more INDEX attribute called counter, and its set at 1
eg: counter = 1
I have a display-text set up like this:
scene.note..game.counter
Running the above gives me "Invalid Expression"
Basically, as the counter goes up, I want my display-text to first show me the value of
Note1,
then Note2
then Note 3
etc
What am I doing wrong?
Thanks!
Comments
Scene.note is a text attribute and game.counter is an index attribute, right?
Make sure you are selecting both attributes from the drop-down menu and not just typing them into the expression editor.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Scene.note1 is a text attribute.
game.counter is an index attribute.
I have to double click the note1 to make it editable and take out the "1" from that string... I think its there that I am making things go screwy...
Also, the Display Text behavior should be outside of any Loop behaviors.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
No loops. Just a simple display text and those 5 variables... nothing else.
Attaching one of the most simplest project files you will ever see!
You can't access attributes using an expression for the name of the attribute. You can display Scene.note..game.counter if Scene.note is an attribute name but you can't use that expression to display Scene.note1, Scene.note2, Scene.note3, etc.
For that you really need... wait for it... tables.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Yes, I want it to dynamically call each of the variables as my counter gets increased.
So, I put in scene.note then the counter gets added (1,2 or 3) and it becomes scene.note1 which should get the value from the attribute...scene.note1, then scene.note2 etc
Heh! I was trying to bypass tables in my little experiment but you caught me