Does the text parser allow for prepositions and indirect objects?

Started by salbert, Tue 26/05/2020 16:18:43

Previous topic - Next topic

salbert

For example, say I wanted the player to be able to type something like "Place box on table" or "throw knife at monster". Does it allow for prepositions and indirect objects like that, or is it limited to simple [VERB][NOUN] combinations?

Khris

It can match all that easily, provided that all the words are in the word list.
"on" and "at" are in the ignore list, so if you add "place", "box" and "table", then call this first:
Code: ags
  Parser.ParseText("Place box on table");


the following will all be  true:
Code: ags
  Parser.Said("place anyword anyword")
  Parser.Said("place anyword table")
  Parser.Said("place box table")


SMF spam blocked by CleanTalk