# Scan text for certain words

**URL:** <https://forums.unrealengine.com/t/scan-text-for-certain-words/344044>\
**Category:** UI\
**Tags:** Variable, text, check, unreal-engine, question, Blueprint\
**Created:** [January 14, 2016, 2:50pm UTC](https://forums.unrealengine.com/t/scan-text-for-certain-words/344044 "2016-01-14T14:50:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PSyCHoHaMSTeRza](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PSyCHoHaMSTeRza](https://forums.unrealengine.com/u/PSyCHoHaMSTeRza)\
**Post date:** [January 14, 2016, 2:50pm UTC](https://forums.unrealengine.com/t/scan-text-for-certain-words/344044/1 "2016-01-14T14:50:04Z")

</div>

Hi there.

I want to make an old school text adventure (like Zork), but I have trouble figuring out how to interpret the user input.

Here is kinda what I want to do.  
Player is in a room. There is a sword and a shield. Player inputs “pick up sword”. That input is saved as a text variable called CurrentInput. Now, the game needs to scan that CurrentInput for certain keyphrases, eg “Go to” or “pick up”. Afterwards it scans for objects in the level, eg “sword” or “shield”. It should be able to bypass other words, so if the player inputs “just pick up the ■■■■ sword already” it just needs to recognize the “pick up” and the “sword” parts. Once the booleans for “pick up” and “sword” are set to true, it executes the action.

I am currently trying to do this in UMG.

Is there a way to scan a text variable for certain words like that? Is there an easier way to do it than the way I described?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e729f54e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e729f54e](https://forums.unrealengine.com/u/anonymous_user_e729f54e)\
**Post date:** [January 14, 2016, 4:08pm UTC](https://forums.unrealengine.com/t/scan-text-for-certain-words/344044/2 "2016-01-14T16:08:44Z")

</div>

Hello PSyCHoHaMSTeRza,

I have an example of a way to pick out words from a sentence. I have provided it below. I hope this information helps.

Example:

This is a function that I have created. It takes in text and converts it to a string so that a substring can be found. After this I use a get substring node to pull out the word I am looking for (if it is there) so as to compare it to the word I am searching for. If this returns true the sentence contains the word and if not, the sentence does not.

 ![74422-findwordhelp1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/d/8/0d84a7a1c6a9680c301f45d1b414846549444242.png)

Here is an example of the function being used.

 ![74425-findwordhelp2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/a/8/9a859828a5d245d83e750cff2f69831e21c431d7.png)

Make it a great day

---

<div class="post-metadata">

**Author:** ![PSyCHoHaMSTeRza](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PSyCHoHaMSTeRza](https://forums.unrealengine.com/u/PSyCHoHaMSTeRza)\
**Post date:** [January 15, 2016, 1:20am UTC](https://forums.unrealengine.com/t/scan-text-for-certain-words/344044/3 "2016-01-15T01:20:53Z")

</div>

Oh yes this is fantastic! Thank you very much
