[I7] Trouble with new kinds as conversation topics [Solved]

Hello again. I feel like my questions here are getting less dumb as I learn, so this problem I’m stumped on now, which should be a piece of cake, has me pulling my hair out and writing ridiculous scenarios to model the problem.

The spoiler below holds a full example source text, but basically: I can’t ask NPCs about a new kind in a conversation table if the new kind is under containers or supporters.

Asking about a whatchamacallit:
thing > whatchamacallit > [e.g. either the gadget or gizmo] works;
asking about a box:
thing > container > box > [e.g. either the crate or the envelope] produces “there is no reply.”

What am I missing here?

Test game:

[spoiler][code]A box is a kind of container. A cardboard carton is a box.
Headgear is a kind of thing. A hat is a headgear.
A desk is a kind of supporter. A writing table is a desk.

Understand “cardboard box” as a box.
Understand “silly hat” or “beanie” or “helium-infused popsicle stick” as a hat.
Understand “writing table” as a desk.

The player wears a hat.
The player carries a cardboard carton.
A writing table is in the Testing chamber.

Table of Conversation3
Topic Reply
“[headgear]” “‘YOU HAVE A HAT.’”

Table of Conversation4
Topic Reply
“[box]” “‘YOU HAVE A BOX.’”

Table of Conversation5
Topic Reply
“[desk]” “DESK IS HERE.”

The testing chamber is a room. Igor is a man in the testing chamber. Persuasion rule: persuasion succeeds. The description of Igor is “He hasn’t been the same since the last experiment. He really needs to cover his brain – it’s making you hungry. Either way, you must help him recognize various items.”

Report Igor wearing the hat:
say “Igor puts the hat on his head. He’s not really wearing it, but it’s on there.”.

After asking Igor about a topic listed in the Table of Conversation3:
if the player is wearing the hat:
say “[reply entry]”;
if Igor is wearing the hat:
say “‘MARY HAD A LITTLE LAMB THAT… MARY HAD A LITTLE LAMB WHICH. HAD A LAMB.’” instead;
if the player is not wearing the hat:
say “‘FRIORGHIOIROBNNOGTHEPIRJGOITHRIOH’”.

After asking Igor about a topic listed in the Table of Conversation4:
if the player has the cardboard carton:
say “[reply entry]”;
if Igor has the cardboard carton:
say “‘I HAVE A BOX.’” instead;
if the player does not have the cardboard carton:
say “‘FRIORGHIOIROBNNOGTHEPIRJGOITHRIOH’”.

After asking Igor about a topic listed in the Table of Conversation5:
if the desk supports 0 things:
say “[reply entry]”;
if the desk supports 1 thing:
say “EVER HEAR TELL OF A SHOGGOTH?”

Test me with “ask Igor about beanie / ask Igor about writing table / ask Igor about cardboard carton”[/code][/spoiler]

If you change the topic entries to “[any box]”, “[any desk]”, and “[any headgear]” it works. But I’m not sure why!

Thank you yet again mattw.

With multiple named objects [ask somebody about top hat / ask somebody about beanie] this produces a “which do you mean” followed invariably by “there is no reply.”

Hmm, I can’t reproduce that. Can you post the full code again?

Sorry for the delay, but I’m exasperated with this.

[code]A hat is a kind of thing. A beanie is a hat. A top hat is a hat.

A beanie is carried by the player. A top hat is worn by the player.

A hat is a kind of thing. A beanie is a hat. A top hat is a hat.

A beanie is carried by the player. A top hat is worn by the player.

Understand “beanie” or “top hat” as a hat.

Table of Conversation3
Topic Reply
“[any hat]” “’[if the player is wearing the beanie]Lovely headpiece, that.[end if][if the player is wearing the top hat]Mighty fine article on your neck-stopper, Boss.’”

The testing chamber is a room. Igor is a man in the testing chamber.

After asking Igor about a topic listed in the Table of Conversation3:
if the player is wearing a hat:
say “[reply entry]”.

Test me with “ask Igor about beanie / the beanie”[/code]

I’m guessing this is the episode where my hapless assistant got brained with a spanner.

Edit: now that I’m more calm and less sober, maybe I should guess that it’s my attempt to redirect Understanding of the items to general hats.

Edit again: Yes, that was it. It was a line that’s followed my attempts to make these things work since way back when it did work in the real project’s second conversation table.

It’s all working.

Here’s what I should really be asking: while learning Inform, and if your coding aptitude was rather low, how would you keep calm?

Meditate and drink lots of hot chocolate! :laughing:

Unfortunately I think the new thing isn’t going to work as much as you want. Try this:

[code]A hat is a kind of thing. A hat is wearable. A beanie is a hat. A fedora is a hat.

A beanie is a hat. A fedora is a hat. The player wears the fedora. The player carries the beanie.

Understand “hat” as a hat.

Table of Conversation3
Topic Reply
“[any hat]” “’[if the player is wearing the beanie]Lovely headpiece, that.[end if][if the player is wearing the fedora]Mighty fine article on your neck-stopper, Boss.’”

The testing chamber is a room. Igor is a man in the testing chamber.

After asking Igor about a topic listed in the Table of Conversation3:
if the player is wearing a hat:
say “[reply entry]”.

Test me with “ask Igor about hat / the beanie”[/code]

In your original code, I suspect that “ask igor about hat” will work because “hat” will be taken to refer to the top hat. But if we change the top hat to a fedora, and include the line about understanding “hat” as a hat (which is necessary if the player is to be able to type in “hat” to refer to any hat), we get the disambiguation again. I think Inform is recognizing that more than one thing can match the [any hat] token, and then the disambiguation is getting messed up somehow.

Note also that no matter which hat you ask Igor about, you’re going to get an answer about the one you’re wearing.

It would probably help if someone who knew more about this decided to chime in, but it seems to me that you’re pushing against the grain here – if you want something to happen when you ask Igor about a thing that’s named in the game, and you want to be able to use all the machinery that lets the game understand various names for hats, then you should just define an action for asking people about things rather than topics. Or you could look at Eric Eve’s Conversation Framework, which will define that action for you.

None of the worthwhile answers involve the Internet, so if you’re reading this sentence, you’re already off-track :slight_smile:

Thank you for this thread, btw. Helped me with some problems I was facing in my own projects.

I think your fundamental problem is that, since the “asking it about” action is understood as “ask [someone] about [text]”, rather than “… about [something]”, the usual object disambiguation code is skipped entirely. That is, if you “ask Igor about asdfghjkl”, Inform will happily accept that command and start processing the action rules. At that point, your “after asking Igor about a topic listed in …” rule then does a kind of late disambiguation, running through the table rows and picking the first row that matches whatever the player asked about (which, if the topic is “[any hat]”, matches any text that could legitimately be understood as referring to a hat in your model world).

I think the cleanest solution here would be to define a new action that is understood as, say “ask [someone] about [any thing]” or perhaps “… about [something visible]”, and have it run through an item-based rather than a topic-based table. Or we could just reuse the existing “showing it to” action:

A hat is a kind of thing. A hat is usually wearable. Understand "hat" as a hat.

A beanie is a hat. A fedora is a hat. A top hat is a hat. The player wears the fedora. The player carries the beanie and the top hat.

Table of Conversation3
Item	Reply
beanie	"'Lovely headpiece, that.'"
fedora	"'Mighty fine article [if the fedora is worn]on your neck-stopper[else]you have there[end if], Boss.'"
top hat	"'That's pretty impressive, that is.'"

The testing chamber is a room. Igor is a man in the testing chamber. 

Instead of showing an item listed in the Table of Conversation3 to Igor:
	say "[reply entry] [paragraph break]".

Understand "ask [someone] about [something visible]" as showing it to (with nouns reversed).

Test me with "ask Igor about hat / the beanie"

And for a final touch, let’s add a DTPM rule to let a plain “hat” refer to the one the player is wearing, if any:

Does the player mean showing a hat to Igor when the player wears the noun: it is likely.

Thank you all. The [any (new kind)] code is refusing to acknowledge the item after it’s been generated in the game world, and I have no idea where that problem is coming from, so I imagine I’ll be trying all of these alternatives in the coming days.

I’ll put on a pot of hot chocolate.