Keyboard Input / Fill in with table value

tswartztswartz Member Posts: 24
edited June 2012 in Working with GS (Mac)
I have an actor displaying text from a table. On touch, keyboard input opens and allows the user to change the default text, then saving it back to the table. The keyboard input obviously opens with a blank input screen.

Is it possible to fill the keyboard input text in from the table? I'd like it to remain the old value until changed (e.g., if the default is "123" I'd like the keyboard input to be filled in with "123" when opened, instead of "").

Answers

  • lukey5227lukey5227 Member Posts: 111
    Sure! You see where it says "Change Attribute" in keyboard input? Look right below it. Keyboard prompt. This is what it says inside the text box when you first open it. Just make the keyboard the correct row and column of your table!
  • tswartztswartz Member Posts: 24
    Keyboard prompt is for the text that shows on the top, but not IN the text input area.
  • HC_DKHC_DK Member Posts: 92
    Keyboard Prompt is the "Headline" of the pop-up box as you already stated.

    Make a table, have two ROWS - first one for the "Headline" and the second for the "Keyboard Input Textfield".
    Add the text you like in the two ROWS.

    Add two LOCAL text attributes called eg. FROM TABLE and COMPARE TEXT.

    Make a rule:
    When ALL - TOUCH is pressed
    - Change Attribute: self. From Table to tableCellValue(YOURTABLE,2,1)
    - Keyboard Input: Change Attribute: self.From Table
    Keyboard Promt: tableCellValue(YOURTABLE,1,1)

    This way you will have the original text from the TABLE and being able to add or change the text.
    But this has only changed the self.FROM TABLE attribute.

    To save it make a new rule (outside the TOUCH rule above):
    When ALL - Attribute: self.COMPARE TEXT is self.FROM TABLE (do nothing)

    Otherwise
    Change Table Value:
    - ROW: 2
    - COL: 1
    - Value: self.FROM TABLE

    Save Table: YOUR TABLE

    Hope this helps to solve your problem.

    BR,
    Henrik
  • APPlauseAPPlause Member Posts: 29
    HenrikChristensen, I don't know if it's the Windows version not working or me but I call myself following your steps precisely and not only does my value not update I don't even get the prompt to appear in the headline! :-(
    Are you changing your Table value at the end with a Change Attribute: set self.FromTable to self.Compare Text or do I have that backwards? I still don't see why I don't even get the prompt with the keyboard input. I like your set up though. Just not working for me.
  • HC_DKHC_DK Member Posts: 92
    @APPlause: I missed a CHANGE ATTRIBUTE for the Compare Text attribute and the wrong attribute is saved to the table :-(
    Instead of all this code I should just have linked to the file a made!!
    Get it here: http://dl.dropbox.com/u/12878764/Save Keyboard Input to Table.zip

    When ALL - TOUCH is pressed
    - Change Attribute: self. From Table to tableCellValue(YOURTABLE,2,1)
    - Change Attribute: self. Compare Text to tableCellValue(YOURTABLE,2,1)
    - Keyboard Input: Change Attribute: self.Compare Text
    Keyboard Promt: tableCellValue(YOURTABLE,1,1)


    When ALL - Attribute: self.COMPARE TEXT is self.FROM TABLE (do nothing)

    Otherwise
    Change Table Value:
    - ROW: 2
    - COL: 1
    - Value: self.COMPARE TEXT

    Save Table: YOUR TABLE

    HC
  • APPlauseAPPlause Member Posts: 29
    thanks! Maybe I'm ACTUALLY starting to catch on a little! LOL. I'll follow up on it. I"m off to work for now. have a good one!
  • HC_DKHC_DK Member Posts: 92
    Hehe, it seems like you caught this one and glad you did :-)

    A bad thing, trying to help other people and making mistakes!!

  • tswartztswartz Member Posts: 24
    Probably did not clarify my answer well enough. I can update the table, using a similar method, upon change. What I'd like to have happen, which I think isn't possible at this point:

    1) User inputs text. Obviously saved to the table using the above.
    2) User goes back to the text, to change it for example. Right now, the text box is blank and you'd need to retype everything to "edit" your text. I'd like the preexisting text to show for edits (e.g., making it possible to delete a letter or add a paragraph WITHOUT retyping everything else).
  • NStarStudiosNStarStudios Member Posts: 1
    Hello, Guys do you know if its possible to customize the text input box? I want to make a typing game but without removing the player from the action to type.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,947
    @NStarStudios nope. I wish there was but there isn't. One of my students is designing a typing game and he's finding it very tedious to make the game recognize text input letter by letter.

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

  • lewisonelewisone Member, PRO Posts: 47

    DUDES!!! This is dope. Thanks GameBrothers for this post, very informational and clever. On my project I needed to display the value as well as click on the area and change it. I ended up using two actors, one in the back to simply display the value of the table, then one invisible one on top when pressed changed the table value.

    -LewisOne (My Website, FB, Twitter, IG, YT)

Sign In or Register to comment.