Question on saving my user's keyboard input
APPlause
Member Posts: 29
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
-
ericzingeler Posts: 334Not 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
@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.