Question on saving my user's keyboard input

APPlauseAPPlause Member Posts: 29
edited July 2012 in Working with GS (PC)
I'm trying to take a user's keyboard input and have the value still there the next time he visits that "field". I've used "Keyboard Input with "Save Attribute" and "Display Text". But when I reload my project the old value is still there, not the newly entered value. What am I missing? And should the Save Attribute be saving my user's input to the box found next to the field name in that scrollable list that includes Physics, Position, etc?

Best Answer

  • ericzingelerericzingeler Posts: 334
    edited July 2012 Accepted Answer
    Not fully understanding what you did, but this is what I would do:

    Attributes (Game or Scene):

    1. ActiveText (text)
    2. LastText (text)

    Actors:

    1. TextField

    ----

    Function in the TextField Actor:

    1. On touch release Rule:
    - Change attribute LastText to ActiveText
    - Keyboard Input to change attribute ActiveText

    2. If ActiveText is LastText Rule:
    - no behaviors

    Otherwise
    - Save attribute ActiveText to Key Save.ActiveText

    3. (No Rule, just sits in actor)
    - Load attribute ActiveText from Save.ActiveText Key

    ---

    Explained:

    1. Lets activate keyboard, but before the keyboard entry we'll need to record the active text to another attribute (LastText) so we can tell if changes have been made after keyboard action is complete.

    2. Does ActiveText = LastText, we'll always be checking. If so, don't do anything. If not, we better save the ActiveText because its been changed.

    3. Only on scene load, lets load the saved text into the active text field.

Answers

  • APPlauseAPPlause Member Posts: 29
    Great! I'll try that. I"m not sure Windows is set up the same though. Under "Otherwise" on step 2 of "Function in the textfield Actor" Windows Save attribute has "Save:" and "As: ". Will the "As:" field function like your "Key" field? Thanks for the feedback!
  • edhogshireedhogshire Member, PRO Posts: 12
    edited June 2014

    @ericzingeler‌ Thanks for this I am sure it works but I got lost. Any chance you post an example of this? You lost me with "key" at then end of the expression and the "save." at the beginning.

Sign In or Register to comment.