Download

Storing player text input

I am looking to store whatever a player types on the keyboard in a variable. I can’t quite figure out how to do this. The game I am working on is partly a text adventure. It seems easy enough to store a single key stroke (on key press, set var to whatever that key was). Is there a way to do this with whatever the player types up until they hit “enter”?

You could give them a widget with an editable text box to type in and use the onTextCommited:

Capture.PNG

So, how would I be able to reference that variable later, in the level blueprint? Basically want I want to is this: The player gets asked a question, they type their answer, and depending what they type different things will happen. The best I can figure is that I would put a multiline text box in the hud. Would this not be the best way? How could I get this to work?