Saving and loading a text

How do I make a save system for my text? I want it to save and load whatever I wrote in a certain text box, but it only loads the 'myText’ which would be fine if I the ‘myText’ was equivalent to what I wrote. How do I make the 'myText’ variable equal what I wrote in my text box?

if i understand correctly, you want to save the contents of your text input box to the storage? You could do that like this:

It’s still not working for me unfortunately. Am I doing it right?

Set your text input text to variable

And now you save and load variables with

After load you need to set text input to variable you just loaded

Do you mean I need to make my ‘textinput.Text::Value()’ into a variable?

Yes
And now you check that variable instead of text input

Could you please show me how the code for that would work? Sorry for the bother but I’m still pretty new at using GDevelop and I’m not quite sure how I would code that

Setting variable to whatever text of text input have


I’m still unsure where to put that part in my code. Could you show me the whole thing please?

You made A LOT of mistakes
Look basically all these names need to match
image

In your case nothing match

Also you save your global variable with expression ToJSON(variable name here)
Look at it try to copy it

Also pay attention where you see “quotes” and where you don’t see them


Ok so I’ve coded it like you showed me, but when I press my ‘load’ button nothing appears in the ‘events’ text box.

Only mistake i found so far is that you made tempScene (which should be scene variable) a global variable
IDK if that is your issue but so far that is only difference from what i have

BTW why you try to change text of text input object in load event?
Wouldn’t it make more sense to change text object text?

I am not sure what you are trying to achieve here

Well I’m not really trying to change it. I just want it to be so that I can write something down, maybe like: “Found a blue stone” and later be able to go back to the scene that has the text input box and see that I wrote “Found a blue stone”.

So all you need is

Where MyTextVar is some global text variable

2nd event condition is however you trigger scene change
And in action
You change your global text variable set it to whatever is in your text input
And then you change scene

Where 1st event is at beginning of the scene changing text of text input to whatever was saved in your global text variable

Edit: I tried using a space and it still works.
Edit2: Not sure if it matters but I am using the web version on my mobile. On a computer, spaces may behave differently.

Try removing the space in “This Game”. Spaces in names and variables is generally not good. Either use a mix of upper and lower case or an underscore.

https://wiki.gdevelop.io/gdevelop5/all-features/storage/reference/#actions

Just for another perspective. This is how I tested storage. I used a save and load button.

1 Like

So I did that, but it only says ‘MyTextVar’ in the textinput box now

Can you post your current version?

Make sure MyTextVar isn’t surrounded by quotes. That’s a common mistake when using storage. The storage names are in quotes and people have a habit to also put the text field value in quotes.

“MyTextVar” is a value while MyTextVar is a variable.

1 Like

What Keith said

And for future when something is not working or working NOT the way you want it to work
Paste here screenshot of what you did in events so we have a chance to find issue
Without it is is pure guessing i guess it shows MyTextVar cause its end of the month

1 Like


I took the quotes from MyText but the text box is still blank whenever I try to run the preview

In your 1st event you change object Events to myText

In 2nd event
Yo set myText to value of Dialogue object?