Matching with "[sometext]" and definite article


I’m having a small problem with matching strings with ask/tell types of situations. I have a conversation topics set up thusly:

Understand "dog/hound/mutt" as "[dog]".

After asking the man about "[dog]":
       say "A fine hound, that.".

The problem I’m having is the article “the”. I can’t seem to figure out how to make both “ask man about dog” and “ask man about the dog” match. I’ve tried matching the string “the” and cutting it in ask/tell situations, but apparently I haven’t had the command right.

Any help here? And yes, I’m aware of Eric Eve’s great conversation extensions, but this is a largish conversation tree I don’t have the time to convert to using them at this point :slight_smile:

I suppose the safe but tedious way would be this:

Understand "dog/hound/mutt" or "the dog/hound/mutt" as "[dog]". Understand "cat/kitten/pussycat" or "the cat/kitten/pussycat" as "[cat]". etc.
Or while you’re at it:

Understand "a/an/the/some/my/his/her/its/their/this/that/these/those" as "[the]". Understand "dog/hound/mutt" or "[the] dog/hound/mutt" as "[dog]". Understand "cat/kitten/pussycat" or "[the] cat/kitten/pussycat" as "[cat]". etc.

Yep, oh dear - I hoped there was some easier way that I had just overlooked.

An easier way would be to add new grammar lines for the actions:

Understand "ask [someone] about the [text]" as asking it about. Understand "tell [someone] about the [text]" as telling it about.


And that’s exactly the kind of elegant way I’ve been racking my brain to find. Cheers! Sometimes you just get so blind to the code :slight_smile:

Okay, this actually is a little bit tangential to the issue, but something I’ve been wondering - I know how to use the Understand “xxx” as “[yyy]” types of substitutions, but this is not something I would’ve come up with intuitively when studying the language, ie. I don’t understand how that actually works codewise.

I mean, I’ve thought “blabla [yaddayadda]” is something that essentially calls a function yaddayadda that does something: either a “to say yadda yadda” or something that’s built in, like making a new paragraph. I don’t really get how the Understand-matching fits to that, though. Is it a procedure? What kinds of things can you attach to a [yaddayadda]?

If there’s someone who doesn’t mind explaining this in technical terms I’d be much obliged!

A line such as ‘Understand “dog/hound/mutt” as “[dog]”.’ translates into a ‘General Parsing Routine’ that matches words from the player’s command with the relevant words in the game’s dictionary.
This routine is called by rules that contain the “[dog]” token.

A line such as ‘To say yadda: say “yaddayaddayadda”.’ translates into a routine that prints the relevant text.
That routine is called by the phrase ‘say yadda’ for which ’ “…[yadda]…” ’ is just syntactic sugar.

Maybe I’m missing something but couldn’t you just specify the article “the dog is an animal” to clear this up?

The problem is that when the player writes ‘Ask Guy about the dog’, the parser never tries to match the words “the dog” against the dog or any other object in the game. (This is to let you ask people about things that are not in the game at all.) Instead, the rule ‘after asking the man about dog’ tries to match the words “the dog” from the player’s input literally against the given topic ‘dog’ from the rule; and since “the dog” looks different from mere ‘dog’, it decides there is no match.

Since nobody else in this thread has mentioned it, I should point out that if you use Eric Eve’s conversation extensions, this whole problem just dissolves. If you use these extensions, you CAN ask or tell about in-game objects, and the parser operates normally with respect to adding articles to nouns.