Disambiguating when the response introduces ambiguity

[code]A server is a kind of person. The soup-server is a server. The printed name of the soup-server is “soup server”. Understand “soup server” as the soup-server. The salad-server is a server. The printed name of the salad-server is “salad server”. Understand “salad server” as the salad-server.

The soup is in the Cafeteria. The salad is in the Cafeteria.[/code]

I already coded the server names with the dashes to avoid the parser getting confused when the player typed something like “x soup”, but how can I allow the player to answer “soup” to the question “Who do you mean, the soup server or the salad server?” without writing “Understand ‘soup’ as the soup-server” and screwing up “x soup” to begin with?

I think this should happen without any extra code from you. But presumably you have some way of referring to a server without specifying which one? (Otherwise you’ll never get the disambiguation message anyway).

I filled out your code as follows:

Cafeteria is a room.
The soup and the salad are things in Cafeteria.

A server is a kind of person.  Understand "server" as a server. 
The soup-server is a server. The printed name of the soup-server is "soup server". 
The salad-server is a server. The printed name of the salad-server is "salad server". 
Understand "soup server" as the soup-server. Understand "salad server" as the salad-server. 
The soup-server and the salad-server are in Cafeteria.

with this result:

Right, yes, I did have “understand ‘server’ as a server.”

I checked back in my skein to find the actual part that was messing up, so here’s a bit more detail with more of the actual non-placeholderized language in case stuff was getting lost:

[code]The street food is a thing in the Market. The printed name of the street food is “buns and soup”.
Understand “buns”, “bun”, or “soup” as the street food.

A vendor is a kind of person. Understand “vendor”, “vendors”, “merchant”, “merchants”, “sellers”, or “seller” as a vendor.
The description of a vendor is usually “Another day or night, [regarding the noun][those in the nominative] might be hawking [their] wares. Not tonight.”

The bun-vendor is a male vendor in the Market. The printed name is “bun vendor”. Understand “bun vendor” as the bun-vendor.
The soup-vendor is a female vendor in the Market. The printed name is “soup vendor”. Understand “soup vendor” as the soup-vendor.[/code]

Is what’s happening effectively that the parser is trying to use “soup sellers” and coming up with nothing that exists? Do I need to punch in all those alternatives for each vendor as well?

Yes.

So, do I need to create all the alternative phrasings for each vendor?

One thing you can do is have “soup” be understood as the soup seller, and use a Does The Player Mean rule to make it more likely that the player will mean doing something with the buns and soup, so when they say “soup” by itself it defaults to the buns and soup. (With the proviso that I often have trouble getting Does The Player Mean rules to do what I want.)

Would this sort of thing do what you want?

Understand "soup" as the soup-vendor when the asking which do you mean activity is going on.

Edit: no, having tested it, I see that it wouldn’t. The activity only prints a message; it stops too early for this to work.

You miiiight be able to get a similar effect by setting a flag during disambiguation:

[code]Processing disambiguation is a truth state that varies.

Understand “soup” as the soup-vendor when processing disambiguation is true.

Before asking which do you mean: now processing disambiguation is true. [this sets the flag when the question is printed]

First before doing anything: now processing disambiguation is false. [this resets the flag when a command is successfully understood]

Before printing a parser error: now processing disambiguation is false. [this resets the flag when a command is not successfully understood but it doesn’t go to disambiguation][/code]

But I didn’t check this, and I’m not sure that it works–in particular, I’m not positive I’ve caught every case where you need to reset the flag. Try with caution!

Idea! We can make the relevant tag a property of the vendor, and then use “understand… as referring to…”

[code]The Market is a room.

The street food is a plural-named thing in the Market. The printed name of the street food is “buns and soup”.
Understand “buns”, “bun”, or “soup” as the street food.

A vendor is a kind of person. Understand “vendor”, “vendors”, “merchant”, “merchants”, “sellers”, or “seller” as a vendor.

A vendor has some text called the disambiguation tag. Understand the disambiguation tag property as referring to a vendor.

The description of a vendor is usually “Another day or night, [regarding the noun][those in the nominative] might be hawking [their] wares. Not tonight.”

The bun-vendor is a male vendor in the Market. The printed name is “bun vendor”. Understand “bun vendor” as the bun-vendor. The disambiguation tag of the bun-vendor is “bun”.
The soup-vendor is a female vendor in the Market. The printed name is “soup vendor”. Understand “soup vendor” as the soup-vendor. The disambiguation tag of the soup-vendor is “soup”.[/code]

The thing about “Understand… as referring to” is that it means that the property can never be used by itself to refer to the thing in question; only in combination with other references. See §17.15 of Writing with Inform. “Understand… as describing” does let you use the property by itself, and that’s what I usually use, but this is a case where it’s useful to exclude that.

And as a bonus, it means you only have to write one Understand line–the rest is taken care of by setting the proper disambiguation tags.

That’s clever! And seems to work.

Sweet! I’ll give that a try later. (I’m about to board a plane, but I don’t need a wifi connection for Inform - just wanted to let you know I saw it :slight_smile: )

Edit: Yes, thank you, that works!