Scan text for certain words

PSyCHoHaMSTeRza
Thu, 14 Jan 2016 14:50:04 +0000
UI

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?

3 posts - 1 participant