Keyboard Input Saving

I have a planner app that has 18 different actors set up to display text.
I have a rule for each one that says:

"When actor receives event" "touch" is "pressed"
Keyboard input
Change attribute game.textbox#
Save attribute

The problem is that when you press the actor the keyboard pops up and then it saves that attribute, but you haven't typed in your text yet, so its not saving what you type in. Is there a way to have it "save attribute" after you hit done on the keyboard?

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited November 2015

    Yes. Create another text attribute called game.input. Note that two quotes ("") in an expression indicates a blank string.

    When Touch is Pressed
         Change Attribute game.input to ""
         Keyboard input [game.input]

    When Attribute game.input is not ""
         Change Attribute game.textbox# to game.input
         Save Attribute game.textbox# to [key]

    ... that way game.textbox# only changes value when game.input has changed from the Keyboard Input behavior.

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

  • JustJackmnJustJackmn Member, PRO Posts: 9

    When I quit out of the app and go back in, the area is blank. I have the load attribute as the first thing within the actor that loads it back into game.textbox#

    I also have a rule to display text game.textbox#

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Make sure your key values are identical in the Save Attribute and Load Attribute behaviors. Post the project file or screenshots of the rules and we can figure out why it's not working for you.

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

  • JustJackmnJustJackmn Member, PRO Posts: 9


    game.text save in my project is your game.textbox#
    My game.text Input is to your game.input

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    What is the attribute game.Text Save Bo... ??? Is that a blank string with the value ""? If not, it needs to be at least for the Touch Is Pressed rule. Double-check the rules I posted above.

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

  • JustJackmnJustJackmn Member, PRO Posts: 9
    edited November 2015

    Here is my game project (Its below in a zip you can download). Click on the top box to see the one i have tried to change based on what you said.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited November 2015

    Forget what I said about the blank string. The way you have it set up in that project file should work just fine. Have you tested it on a device?

    By the way, any time you have more than a few (say, three) attributes doing the same sort of thing, it's just crying out for tables. All of those attributes could be in a single table and you could use a Save Table behavior (tables load automatically at runtime).

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

  • JustJackmnJustJackmn Member, PRO Posts: 9

    I tried it on my device and it doesn't work. It just goes back to being blank. I wanted to use a table but couldn't figure out how to do keyboard input into a table cell? Do you know how to do that? Also if you do how would I use the save table value to make sure it saves after the user is done typing their input? And what would be the best way to display that table value as a display text behavior?

  • tonymtbirdtonymtbird Member, PRO Posts: 10

    @JustJackmn @tatiang Reading this post solved my issue which was similar, thanks!

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @tonymtbird Glad we could help! :)

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

Sign In or Register to comment.