What I am asking is hard to put into a question, but in my game, I want to have the player type an answer to a question and have the game check if the answer is correct or not. I assume you need to somehow enter a value in the blueprint and have it see if the text box matches that value, but I don’t know how to do it.
What do I need to do, or at least how do I start?
Thanks, in advance.
Oh my gosh, that’s so simple. Thank you so much!
Hello! I thought it was simple, but I guess I spoke too soon. I tried to follow what you said, but I am pretty new to scripting and I’m stuck. No matter what I text enter into the text box, it will only go to false and show that text, even if I enter the correct answer. Do you know what part(s) I am doing wrong?
you could use a widget blueprint.
add a text box. Then with the text box selected, add the ‘on text committed’ event from the details panel. This will automatically take you to the graph editor part of the blueprint. use the “branch” node to compare the text entered against the correct answer.
Hi! Creating Virtual Keyboard Interactions Look at this - yes the keyboard is virtual but whole setup is still related to your question. It’s a simple password checking.
there are a few ways to compare text such as the text equal node, but there are many more ways to compare strings so you may want to convert your text to a string. the below first picture shows a few of the nodes you could use.
the second picture below shows a little widget i made to test this. the widget consists of a text box where the player can input text, and a button. the way the script i wrote works is that it gets the text from the textbox, then converts it to a string and compares it against a predetermined string, and based on if it matches (the branch) the script will print a message. pretty simple stuff.
You are not checking your answer against an answer, put in a print string and see what your answer variable is and what the comparison value is.