Ignoring words not in the parser Word Group

Started by Johanas, Fri 26/02/2010 13:57:11

Previous topic - Next topic

Johanas

Hi, quick code question.

I'm trying to make a game with a text parser and I was wondering if it was possible to ignore words that the user inputs that are not in the word group? basically I want something that takes an unknown word and sets it's word group number to 0.

here's the pseudo-code
Code: ags

  if (Parser.SaidUnknownWord()) {
    UnknownWord = 0;
    }


Something like that


Bascally if someone types "look at carpet" and there is no word for carpet the get the message:
"there's not much to see"
instead of:
"Please use another word for carpet"

Thanks for your help

Pumaman

I'm not sure if I quite understand what you're trying to do, but could you do a Replace on the input string to replace the unknown word with a blank string, and then run it through ParseText again?

Ali

#2
This is probably not of interest to you, but I put together a simple module to allow more natural dialogue through the text parser. A thread about it is here

It ignores everything except keywords and the presence of more than one keyword. It can also use a chatterbot trick of returning the user's input to them to simulate a broader vocabulary.

There's a simple demo, here. However, it would need a lot more dialogue writing to make a convincing character, and this only has a very limited set of responses.

EDIT: Thanks magintz!

magintz

Quote from: Ali on Wed 03/03/2010 18:14:03
This is probably not of interest to you, but I put together a simple module to allow more natural dialogue through the text parser. A thread about it is here

I kept getting errors visiting that link but I assume you're referring to the Conversation Simulation Module if anyone has similar problems with the clicky-clicky :)
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

Johanas

Hey, got it sorted. I was using a text parser tutorial I found in the forums and it had alot more functionality than I wanted.

I just removed the line:
Code: ags
else if (Parser.SaidUnknownWord()) {
  Display("Please use another word for '%s'.", Parser.SaidUnknownWord()); 
}


Thanks for the help anyway

SMF spam blocked by CleanTalk