GameSalad

Using Tables to store multiple user input texts, and displaying the texts in actor

indra.azizindra.aziz Posts: 34Member, PRO

Hey everyone,

I'm currently learning to use tables (as suggested by @Japster and @tatiang in my prev question). I looked at the tutorials on tables and pretty much understand how it works and why we use them. After trying it out I have some questions.

Condition:
I want the user to be able to keyboard input multiple text attributes (up to 20), and then have the text stored in one col or row of my table, and then have them each displayed in an actor, before later randomising the texts to result in a winner text.

Problem:
I used one button actor for prompting keyboard input, and an integer attribute +1 for each new input added. And then I use change tableCellValue behaviour to store each of the user input text in the table in hopes to be able to display them in different actors by simply using the expression editor to pull the tableCellValue in display text behaviour in the actor. But it did not work :neutral: well it worked for only one actor, but not for the second and the rest. The other actors wont display the tableCellValue.

Questions:
1. Where should I put change tableCellValue behaviour? - in the "add button" actor or in each "display text" actor or in other?
2. Where should I put save table behaviour if I want to save every input?
3. Do I have to have up to 20 text attributes and up to 20 actors for this?
4. Additional question: Does the keyboard prompt work properly in both Android and iOS?

That's the questions for now, I hope I can learn from all of you, thank you!

Best Answer

Answers

  • indra.azizindra.aziz Posts: 34Member, PRO

    Hey thanks @tatiang,

    Aha! So that way, the game.text attribute is just a bridge from user to table, very nice. And use my integer attribute+1 to control which row to insert, is that correct?

    One actor with multiple instances in one scene, so I should just go in and modify the display text behaviour in the each instance, okay noted! This makes it simple and clean.

    I'm already out of my house right now, I can't wait to try this method later tonight. I will update, thanks again!

  • tatiangtatiang Posts: 10,782Member, Sous Chef, PRO, Senior Sous-Chef

    @indra.aziz said:
    Aha! So that way, the game.text attribute is just a bridge from user to table, very nice. And use my integer attribute+1 to control which row to insert, is that correct?

    Yes.

    One actor with multiple instances in one scene, so I should just go in and modify the display text behaviour in the each instance, okay noted! This makes it simple and clean.

    It's not clear from your description how you intend to display the table values. But you might consider the tableMergeValues function described here and shown here. For example, if you wanted to display all 20 rows horizontally, you could merge the cells with a space separator (" ") or if you wanted to display them vertically, you could merge the cells with a newline separate ("\n").

  • indra.azizindra.aziz Posts: 34Member, PRO

    @tatiang said:

    @indra.aziz said:
    Aha! So that way, the game.text attribute is just a bridge from user to table, very nice. And use my integer attribute+1 to control which row to insert, is that correct?

    Yes.

    One actor with multiple instances in one scene, so I should just go in and modify the display text behaviour in the each instance, okay noted! This makes it simple and clean.

    It's not clear from your description how you intend to display the table values. But you might consider the tableMergeValues function described here and shown here. For example, if you wanted to display all 20 rows horizontally, you could merge the cells with a space separator (" ") or if you wanted to display them vertically, you could merge the cells with a newline separate ("\n").

    This is great! Thanks

Sign In or Register to comment.