i am working on a advanced npc chat system for my game, where the player types things into a text box to comunicate with npcs in this game. i was wondering if you could test for one or two specific key words and ignore the rest of the sentence to determine the npcs responce rather than think of every sentence some one can type up and test for it.
her is a exsample of what i want to achive:
---------------------------------------------------------------------------------------------------
player types up "hello there"
code finds the world "hello", with nothing atached, and finds it as a greeting
npc responds saying "responce to greeting"
player types up "hello freak"
code finds the word "hello", but also finds the word "freak" and finds it as a offence.
npc: "upset"
player types up hello, have you seen the freak
code sees hello and freak, but sees thet the word "have you seen" is imbitween, making it a question about some freak
npc: "responce"
---------------------------------------------------------------------------------------------------
if there is a solution that aredy exsists on the website, please comment