[I7] Another asking about question.

I can’t get this to work because I’m missing the proper code.
What I want is an NPC giving the same response when I SHOW a thing to him, when i ASK him ABOUT the thing, and when I ANSWER him THAT the thing.

Here’s some example code that doesn’t work. The part between brackets gives an error, the part about Asking about does nothing. ATM I can only show things to.

[code]Before showing an Object listed in the Table of Shows to NPC:
say “’[Analisys entry].’”;
stop the action.

Instead of asking NPC about something:
if the second noun is an Object listed in the Table of Shows: <— or “noun”
say “’[Analisys entry].’”;
else:
continue the action.

[Instead of answering NPC that something:
if the topic understood is an Object listed in the Table of Shows:
say “’[Analisys entry].’”;
else:
continue the action.][/code]

The table has ofc the Object column with named objects and the Analisys column with some text.

Thank you!

There is no second noun in the action of asking it about (only a topic understood – as in answering it that); that is why the rule has no effect.

I don’t know if there is a way to convert a snippet to the object the text of the snippet is may be a name of.

You could of course write new syntax for the showing it to action (or for some set of new actions), like

[code]Understand “ask [someone] about [something]” as showing it to (with nouns reversed).
Understand “ask about [something]” as showing it to.

Understand “answer [someone] that [something]” as showing it to (with nouns reversed).
Understand “answer [something]” as showing it to.

Understand “[something]” as showing it to.

Rule for supplying a missing second noun while showing something to: now the second noun is NPC.[/code](It won’t trap the "NPC, " syntax though.)

Can I hardwire it like this?

Understand "NPC, [something]" as Answering NPC that something.

Anyway: that is a trick but a very clever one. Thanks. Will try it later.

The problem is Inform won’t let you write understand texts with commas inside. Perhaps there is a way round it, but then it wouldn’t be any obvious way; I know that the issue has come up on the forum before.

I think Eric Eve’s conversation extensions had a way of handling it. I’ve tackled the problem in a couple different ways. Check out my Speech Motivations extension, which was originally inspired by Dr. Eve’s extensions:

eyeballsun.org/i/Speech%20Motivations.i7x

The comma is difficult, but I work around it by parsing the topic understood using my Disambiguation Override extension:

Check answering someone that (this is the convert answering it that to exclaiming rule): Let the subject matter be the most likely match between the topic understood and "[any known thing]"; if the subject matter is not nothing, instead try exclaiming the subject matter to the noun;

The extension is in the same folder, here:

eyeballsun.org/i/Disambiguation%20Override.i7x

It provides some utilities for making sure everything works out nicely when you try to match a topic against an object - including a means of finding out which objects matched, and a method of preventing weird “which do you mean” questions.

Great, Captain! I will look at it!