How to save player input from a editable text box?

I am trying to have a journal that the player can type in, but whenever i type in the journal, close it, then reopen the journal, the text is gone.

here is the design page

here is my opening the journal blueprint

here is my closing the journal blueprint

Thanks for your help!

Hi each time you press to open the journal is a new one because you’re always recreate the widget. And you should store the text in a variable and edit the variable to add the new text in, so you’ll be able to show the text.

You can use either Events for the Multi-Line Text Box:

OnTextChanged

OnTextCommitted

Then, you simply set the text variable of the event to your variable “JournalText”.

Example:

126640-ontextchangedblueprint.png

Hi, thanks for your comment! I have the two variables already. The “Journal Entry” is the text box widget itself, and “Journal Text” is the text variable. You can see them in the 3rd blueprint link i sent you. In that link you can see i use GetText then save it to the journal text variable.

when you create the “jornal widget” you set the “text widget” to “journaltext” but the problem is that you get the text from the “jornalwidget” that you’ve just created, so the text you’ve put before closing isn’t there anymore because this is a variable from another instance of the same class, you have 2 options: don’t close the journal, just hide it, so the player can’t see, but don’t delete the instance, so when the player click to open the journal again he will get the text from the variable from the same instance of the journal class, so the text you’ve saved will still be there, another option is store the text somewhere else, i recommend you actually saving it in HD, so you save before closing the widget and load it when opening the widget. I Believe a Static variable would also work, static variables have the same value for every instance of a class, but as far as i know you can’t use static variables in BP

exactly as Denis said, i answered the same thing then i’ve noticed someone answered while i was typing, your problem is that you get the “Journal Entry” and Journal Text from the Journal Widget you’ve just created, you will just find the “default value” from “journal text” there.

After playing around i had changed it to this but the journal still starts fresh every time its open. I have used a print string to see if the variable is saving correctly and it is.

Okay, I am seeing the problem. What is HD? (sorry im new to this).

Or i could hide it like you said, so what event would i use to create the widget? event begin play?

You’ve a couple of good way to do what you need. But don’t forget if you save the text in a variable to not override it. You can save it this way:

Hard Drive, i mean, actually save it.

Okay so I am doing something wrong. I am having the same problem. The journal wont add the text correctly. I think im putting the create widget in the wrong place.
here’s my umg BP

here’s my thirdpersoncharacter BP

Okay, where would I cast to save game? In the journal blueprint, or the thirdpersoncharacter blueprint? How do i save in one blue print then load in another?

yeah if you just want to hide it you could create in event begin play, if you want to save it you can create a BP that inherits from “SaveGame” like this

126715-creating+a+savegame.png

then add a public text variable in it

126716-publictextvariable.png

then you create your save game this way in the event fired by the close journal button

and then load it in the OpenJournal event

PS.: i created this code just to show it how it works, but i created it in a normal actor, so i couldn’t get/set a text box, but i let you a reference to where you should put the get/set text box nodes, if you still have any question, just ask

I changed it from a variable and typed it in like you said. IT WORKED. Thank you so much. I would have never done this on my own.

Wow, thank you for the effort you put into this answer. I really appreciate it. I will try to use this to run it, and ill come back if i cant get it to work. Thanks again!

when i get slot name in my third person blue print it needs a target since its in a different blueprint. What is the target?

maybe i’ve not understood you correctly, what you mean by “get slot name in third person blue print”? you actually don’t need to get it from anywhere, you can just type the slot name in the “load/save game from slote” node, you can as an example type “JournalTextSlot” there, as i said you just need to be sure you’re going to use “JournalTextSlot” to load and to save, if it don’t help try to send a ss of what node exactly you are using.

Thank you it worked for me that was a perfect example

Thank you so muchhh it worked for me