Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Johanas on Fri 26/02/2010 13:57:11

Title: Ignoring words not in the parser Word Group
Post by: Johanas on Fri 26/02/2010 13:57:11
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

  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
Title: Re: Ignoring words not in the parser Word Group
Post by: Pumaman on Sun 28/02/2010 16:55:49
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?
Title: Re: Ignoring words not in the parser Word Group
Post by: 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 (http://www.adventuregamestudio.co.uk/yabb/index.php?msg=414612;topic=32129.0;sesc=b61032cb448c670ec36d66099cb3b4ac)

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 (http://www.filefront.com/15731565/Dialogue_Parser_Demo.zip). 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!
Title: Re: Ignoring words not in the parser Word Group
Post by: magintz on Sat 06/03/2010 11:35:04
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 (http://www.adventuregamestudio.co.uk/yabb/index.php?action=post;msg=414612;topic=32129.0;sesc=b61032cb448c670ec36d66099cb3b4ac)

I kept getting errors visiting that link but I assume you're referring to the Conversation Simulation Module (http://www.adventuregamestudio.co.uk/yabb/index.php?msg=414612;topic=32129.0;sesc=b61032cb448c670ec36d66099cb3b4ac) if anyone has similar problems with the clicky-clicky :)
Title: Re: Ignoring words not in the parser Word Group
Post by: Johanas on Sun 07/03/2010 18:00:46
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:
else if (Parser.SaidUnknownWord()) {
  Display("Please use another word for '%s'.", Parser.SaidUnknownWord());
}


Thanks for the help anyway