Problem with conversations/tables

My problem is with my conversations. I have them all set up as “ASK [SOMEONE] ABOUT [SOMETHING].”

My issue is that it works fine, as long as the “SOMETHING” is an item that’s visible. If not (for example, if it’s in another room), the parser defaults to the “otherwise” response below.

I can get around this by removing the brackets around each topic, but then the player must type exactly what’s in quotes, allowing for no shorter version of the topic.

I’m sure I’m missing something obvious, but whatever it is escapes me.

Here’s a simplified example I wrote that is similar to what I’m actually trying to do to. In my actual tables, I have all of the topics in brackets, but I wanted to show examples of topics with and without brackets to make my issue clearer.

[b][size=150]The kitchen is a room.
The dining room is east of the kitchen.

Bob is a man in the kitchen.
The big blue book is in the kitchen.
The big green bike is in he kitchen.
The big red chair is in the living room.
The big black couch is in the living room.

Before asking Bob about something:
if the topic understood is a topic listed in the Table of Bob’s Replies, say “[Bob entry][line break]” instead;
otherwise say “He doesn’t seem interested.” instead;

Table of Bob’s Replies
Topic Bob
“[the big blue book]” “‘It’s a good book.’”
“the big green bike” “‘It’s a pretty green.’”
“[the big red chair]” “‘It’s red, ain’t it?’”
“the big black couch” “‘Comfy.’”[/b]
[/size]

Here is a transcript of my interactions w/ Bob:

[i][size=150]kitchen
You can see Bob and a big blue book here.

Ask Bob about big blue
“It’s a good book.”

Ask Bob about big green
He doesn’t seem interested.

Ask Bob about the big green bike
“It’s a pretty green.”

Ask Bob about big red
He doesn’t seem interested.

Ask Bob about the big black couch
“Comfy.”[/size][/i]

How do I get my characters to both react to something that’s not visible and also to accept shorter names for those items? I feel like the issue is with the phrase “topic understood,” but I don’t know how to fix it if it is.

Thanks!

My initial reaction is that your rule involves asking about “something” which means an actual “thing” and not a text topic. Inform wants to match the entire text in a topic, unlike standard parser disambiguation where it can infer nouns from their adjectives. All of your topics are actual objects implemented in the game world, perhaps making your “topic” column a “thing” column (without the brackets) might work?

Also if you want to be able to ask about something not in scope, the phrasing should be something like “Before asking Bob about any thing.”

(I’m not the guy who uses tables a lot, so someone else please feel free to correct this if I’m wrong.

This is kind of a weird behavior of text tokens in topics. I don’t think there’s any obvious way to get Inform to be able to parse a topic token like “[big blue book]” when the book is not in scope. A little background on that here.

One way to solve this might be to add all the relevant things to scope when asking it about, which I think can be done without putting them in scope for other actions. But you’d have to loop over all the relevant things to do it.

Maybe a better way to do this, as Hanon says, would be to define a new action that works on the ASK verb but that takes a thing rather than a topic as indirect object. Then you can have that action accept objects out of scope. Eric Eve’s Conversation Framework and related extensions use this, but a simple implementation might look like this:

Quizzing it about is an action applying to one thing and one visible thing. Understand "ask [someone] about [any thing]" as quizzing it about.

“Visible thing” means that the second noun doesn’t have to be touchable (it’s actually less restrictive than just saying “a thing”). The “[any thing]” token tells the parser not to bother with scope restrictions but just to check every thing in the game as a possible second noun. I think this action has to have a different name than “asking,” though maybe that’s just to avoid confusion.

Then you could make a table with a column of things instead of topics, and look up Bob’s replies there.

If you want some of the conversation topics to be real text rather than strings, that’ll work too. If you type “ASK BOB ABOUT XYZZY” when xyzzy isn’t a thing in the game, the parser will first try to find a thing called xyzzy, and when that fails, redirect this to the asking Bob about “xyzzy” action.

Thanks, both of you. I’m working on what you said now. I’ll post again soon.

Thanks to both of you! It’s working now!

I was able to use what you both said about scope (a concept I was unfamiliar with) to solve my problem. I’m nearing the end of my program and this solution was the path of least resistance at this point. Thanks again to both of you. When starting my next program, I may try the other solutions you offered.

As a follow-up for the future, if you take a look at Eric Eve’s Conversation systems, he solved a lot by making conversation topics actual off-stage objects that can be referred to, avoiding the need to break down random text the player might type in. If you want to use ask/tell in a game and you’re not specifically wanting to work it out in a special custom way, his extension suite can keep authors from needing to re-invent the wheel.