Using multiple items as one topic in a table of replies

Hi there,

I am fairly new to using tables in Inform 7 and I was wondering how one can use items as topics, so that the player can “ask man about golden watch” and get a reply. I figured I can use the [thing] token:

[code]Table of Answers
Topic Answer
“[bourbon]” “Yes, you are encouraged to drink as much as you like”
“[crystal glass]” “I filled it up for you, I can fill it up again”
“[bedside table]” “Mi casa es tu casa”
“[refrigerator]” “Mi queso es tu queso”
“[drawer]” “Mi casa es tu casa”
“[cupboard]” “Mi casa es tu casa”

Instead of asking Colin about a topic listed in the Table of Answers:
say “’[Answer entry],’ Colin replies.”[/code]
The good thing with this is that, if I have already included an

Understand "fridge" as the refrigerator

I can “ask Colin about fridge” and still get the right answer.

The problem is that I don’t know how to combine multiple items in order to get the same answer (eg “Mi casa es tu casa”) without repeating the reply for each different item row. The structure “topic/topic/topic” or “topic” doesn’t seem to work with [tokens].

I am also wondering whether I could use more general rules, along the lines of:

Instead of asking Colin about a container

Any advice?

Thanks,
Giannis

I think you could add another column of “things”, then “instead of asking Colin about a thing in the table of answers…”

I’m not the table guy, but that might work.

Also check out Eric Eve’s “Conversation Responses” extension which lets you write “After quizzing bob about the” “After imploring bob for the…” to see if it might help you. It rearranges the asking about and telling about actions, so make sure it doesn’t destroy the work you have.

Mmm, I tried it but it doesn’t work. I think what complicates things is that “ask it about” refers to “some text” as the second noun and not a thing.

I did try this, though, which doesn’t give an error message, but doesn’t work either:

[code]Table of Answers
Item Answer
crystal glass “I filled it up for you, I can fill it up again”
bedside table “Mi casa es tu casa”
refrigerator “Mi queso es tu queso”

Instead of asking Colin about something:
if the second noun is an item listed in the table of answers:
say “Colin seems perplexed.”[/code]
Instead of getting “Colin seems perplexed,” I get a line break.

Also, multiple entries, like

crystal glass or bedside table

don’t work.

Actually, I don’t know what I did before, but I just figured that this is working:

[code]Table of Answers
Topic Answer
“[bourbon]” “Yes, love, you are encouraged to drink as much as you like”
“[crystal glass]” “I filled it up for you, I can fill it up again”
“[refrigerator]” “Mi queso es tu queso”
“[cupboard]” or “[bedside table]” or “[drawer]” “Mi casa es tu casa”

Instead of asking Colin about a topic listed in the table of answers:
say “Colin says, ‘[Answer entry].’”
[/code]
So, disregard this part of my question.

I am still puzzled about how I can get something along the lines of

Instead of asking Colin about a container

though.

Any ideas?

Thanks!
G.

Try

After asking Colin about a container:
That will make the action succeed but not show any report rules, and you can hook other actions to it as you need to. Or

Check asking Colin about a container: [do stuff] instead.

That will make the action fail and not process any other asking rules.

[code]colinstress is a number that varies.

After asking Colin about a container:
say “[one of]Why are you asking me that?[or]You know I hate containers![or]I WILL KILL YOU FOR MENTIONING CONTAINERS![stopping]”;
increase colinstress by 1;
if colinstress is 3:
try colin attacking the player.[/code]

I get the feeling that if you want to deal with asking someone about a noun in a sophisticated way, it’s best to make a new action that applies to things rather than topics. It won’t eliminate your original asking action; any ASK command that can’t be understood in terms of an existing thing will get redirected to the original “ask [someone] about [text]” understand line. So:

[code]Lab is a room.

Colin is a man in the lab. A table is in the lab. A beaker is a container on the table.

Querying it about is an action applying to one thing and one visible thing. Understand “ask [someone] about [something]” as querying it about.

Instead of querying Colin about a container, say “Colin says, ‘[The second noun] can contain things.’”

Instead of querying Colin about something, try asking Colin about “[second noun]”.

Instead of asking Colin about “table”, say “Colin says, ‘Hmm, the table.’”

Instead of asking Colin about “pumpkin”, say “What pumpkin?”[/code]

(Hanon, I don’t think what you suggest will work without a new action, because the asking it about action doesn’t have a second noun so Inform expects a topic rather than “a container” there.)

Another trick is to make off-stage objects that represent topics.

[code]A subject is a kind of thing.

world peace is a subject.[/code]

All of the above sound like good alternatives.

I am currently experimenting with:

[code]A beverage is a kind of thing. A beer is a kind of beverage. A bourbon is a kind of beverage.

After asking Colin about “[a beverage]”:
say “Colin grins, ‘Yes, love, you are encouraged to drink as much as you like.’”[/code]
It seems to be working, although it only works for visible beverages. E.g. in my code, bourbon is visible, while beer is closed in a fridge. When I open the fridge, I can ask Colin and get a reply. If I close the fridge again, I get no reply. This is a bit problematic, since if the player has seen the beer, they are entitled to ask about it…

If you want it to work for any beverage anywhere in the model world, try this:

After asking Colin about "[any beverage]": say "Colin grins, 'Yes, love, you are encouraged to drink as much as you like.'"

If you want to restrict it to beverages that have already been mentioned, you can add an adjective:

[code]Kitchen is a room. Colin is a man in kitchen.

A beverage is a kind of thing. A beer is a kind of beverage. A bourbon is a kind of beverage. A beverage can be known or unknown. After printing the name of a beverage (called drink): now the drink is known.

After asking Colin about “[any known beverage]”:
say “Colin grins, ‘Yes, love, you are encouraged to drink as much as you like.’”

The fridge is a closed openable container in the kitchen. One beer is in the fridge.[/code]

Eric Eve’s Epistemology extension will handle keeping track of objects that are known to you in this way.

Thanks Matt, that’s really helpful!

A funny thing happened, though, as soon as I listed “[any beverage]” under “Topics” in the table of replies: every other thing that was included as a topic in the form of “[refrigerator]” etc. stopped working and I get the “no reply” response.

Does this mean that it is not possible to list “[any kind]” along with a specific “[thing]” in the same column, as I’ve done here?

[code]Table of Colin’s Answers
Topic Answer
“[any beverage]” “Knock yourself out”
“[crystal glass]” “I filled it up for you, I can fill it up again”
“[cupboard]” or “[bedside table]” or “[drawer]” “Mi casa es tu casa”
“[refrigerator]” or “[kitchen]” “Mi queso es tu queso”

Instead of asking Colin about a topic listed in the Table of Colin’s Answers:
say “Colin says, ‘[Answer entry].’”
[/code]
I then tried to make two separate tables, one for [thing]s and one for [any kind]s, but I got the same results.

What works is separating the two cases, by adding a separate “instead” rule for [any beverage]:

[code]Table of Colin’s Answers
Topic Answer
“[crystal glass]” “I filled it up for you, I can fill it up again”
“[refrigerator]” or “[kitchen]” “Mi queso es tu queso”
“[cupboard]” or “[bedside table]” or “[drawer]” “Mi casa es tu casa”

Instead of asking Colin about a topic listed in the Table of Colin’s Answers:
say “Colin says, ‘[Answer entry].’”

Instead of asking Colin about “[any beverage]”:
say “Colin says, ‘Yep, just knock yourself out, luv.’”[/code]

So, yes, my question is why doesn’t the previous table work?

Thank again!

After torturing myself trying out several things, I will go for Matt’s solution (querying it about). Thanks, again, Matt.

Nevertheless, here is one last question on tables. Below are two variations of the same code. The only difference is the topic entry of the table. In the first, it is ’ “[refrigerator]” or “[kitchen]” ’ and the code runs okay. In the second, replacing kitchen with bed, I get an error message.

What is the difference? Does it have to do with them being different kinds of things?

First:

[code]The Studio is a room.

The refrigerator is in the Studio. It is fixed in place. The refrigerator is an openable and closed container.

The kitchen is scenery in the Studio.

The bed is scenery and a supporter in the Studio.

Colin is a man in the studio.

Table of Colin’s Answers
Topic Answer
“[refrigerator]” or “[kitchen]” “‘Mi queso es tu queso,’ says Colin. Small pause. ‘OK, my Spanish can be pathetic, I know.’”

After asking Colin about a topic listed in the Table of Colin’s Answers:
say “[Answer entry][paragraph break]”.[/code]

Second:

[code]The Studio is a room.

The refrigerator is in the Studio. It is fixed in place. The refrigerator is an openable and closed container.

The kitchen is scenery in the Studio.

The bed is scenery and a supporter in the Studio.

Colin is a man in the studio.

Table of Colin’s Answers
Topic Answer
“[refrigerator]” or “[bed]” “‘Mi queso es tu queso,’ says Colin. Small pause. ‘OK, my Spanish can be pathetic, I know.’”

After asking Colin about a topic listed in the Table of Colin’s Answers:
say “[Answer entry][paragraph break]”.[/code]

What error message?

The error message is: