Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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!

Product Version: UE 4.14
more ▼

asked Feb 16 '17 at 11:34 PM in Blueprint Scripting

avatar image

24 5 9 14

(comments are locked)
10|2000 characters needed characters left

4 answers: sort voted first

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

more ▼

answered Feb 17 '17 at 12:56 AM

avatar image

1.1k 31 16 65

avatar image GreenAF Feb 17 '17 at 01:18 AM

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?

avatar image veccher Feb 17 '17 at 02:02 AM

Hard Drive, i mean, actually save it.

avatar image GreenAF Feb 17 '17 at 07:14 AM

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?

avatar image veccher Feb 17 '17 at 02:53 PM

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 CreatingSaveGame

then add a public text variable in it

public text var

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

alt text

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

saving.png (90.8 kB)
loading.png (69.8 kB)
avatar image GreenAF Feb 17 '17 at 04:56 PM

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!

avatar image GreenAF Feb 17 '17 at 05:17 PM

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?

avatar image veccher Feb 17 '17 at 05:37 PM

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.

avatar image GreenAF Feb 17 '17 at 05:47 PM

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.

avatar image Carlospsp3 May 19 '18 at 02:35 PM

Thank you so muchhh it worked for me

avatar image Denis Lambert Feb 17 '17 at 01:54 AM

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:alt text

savetext.png (67.8 kB)
avatar image GreenAF Feb 17 '17 at 06:10 AM

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

(comments are locked)
10|2000 characters needed characters left

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.

more ▼

answered Feb 17 '17 at 12:38 AM

avatar image

Denis Lambert
310 4 4 8

avatar image GreenAF Feb 17 '17 at 12:43 AM

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.

avatar image veccher Feb 17 '17 at 01:00 AM

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.

(comments are locked)
10|2000 characters needed characters left

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



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

alt text


alt text

more ▼

answered Feb 17 '17 at 12:50 AM

avatar image

47 11 15 14

avatar image GreenAF Feb 17 '17 at 01:07 AM

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.

(comments are locked)
10|2000 characters needed characters left

Thank you it worked for me that was a perfect example

more ▼

answered May 19 '18 at 02:33 PM

avatar image

1 1

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question