is there a way to parse user input text?

Get help using Construct 2

Post » Thu May 17, 2012 5:03 am

Hey guys,

Just a quick question. I apologize if this has been covered elsewhere, my searching hasn't returned any results however. Is there anyway I can have the system look for specific words in a string of text input by the player? I'm looking to emulate old text adventure games. So if the player types in "swing sword" I need to be able to reference each word against a set of variables, the first for player actions, and the second for items. Is there a simple way to do this?

Thanks in advance

Brent
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Thu May 17, 2012 5:20 am

How about using the find expression?
[code]find(src, text)
Find the first index within src that text occurs, else returns -1.
[/code]
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu May 17, 2012 5:27 am

Duh, of course lol, good call Nimtrix, thanks lol.
B
64
S
8
G
9
Posts: 290
Reputation: 8,590


Return to How do I....?

Who is online

Users browsing this forum: kamens503, Yahoo [Bot] and 25 guests