Numbered Disambiguation Choices and Approaches problem

If you’re reading this topic, you probably know what Numbered Disambig. Choices (NDC) does.

Approaches is Emily Short’s extension that lets players type ‘go to (so and so)’ and, if they’ve visited so-and-so before, they’ll path-find their way there.

I found that NDC doesn’t print the choice numbers when Inform needs to ask the player which of a number of similar sounding locations they want to go to on behalf of Approaches. And I would like it to do this. However, it does print the numbers (with Approaches in the project) in other contexts.

The attached demo shows that NDC will print the choice numbers when asking about whether to drop a ‘green apple’ or ‘green pear’, but doesn’t print numbers when asking about whether to go to a ‘big hall’ or a ‘big corridor’.

That said, the extension has numbered these choices behind the scenes, because you can still respond by typing ‘1’ to go to the big hall.

Include Numbered Disambiguation Choices by Aaron Reed.
Include Approaches by Emily Short.

The player is in entryway.

the player carries green apple and green pear.

Big hall is north of entryway. Big corridor is south of entryway.

Test me with “n/s/s/n/drop green/1/go to big/1”.

This isn’t going to solve your problem, but I’m pretty sure that what’s going with “1” taking you to big hall is not that the extension has numbered the choices behind the scenes, but something like this issue: When you type “1” it reruns the command as “go to 1 big,” which for some reason gets fed into the choose-something-automatically mechanism rather than the disambiguation mechanism.

To see this, try typing “2”–instead of getting big corridor, you’ll get “You can’t use multiple objects with that verb.” That’s because the disambiguation response is getting processed as “go to 2 big.”

However! I think the problem is simply that Numbered Disambiguation Choices assigns disambiguation ids to things, and rooms aren’t things. I tossed in some crude code that just copied the relevant parts of Numbered Disambiguation Choices with “room” instead of “thing” and it seemed to work:

Every room has a number called disambiguation id. The disambiguation id of something is usually 0.  
 
Understand the disambiguation id property as describing a room. 

Before printing the name of a room (called macguffin) while asking which do you mean (this is the Numbered Disambiguation Choices preface disambiguation rooms with numbers rule):
	if disambiguation-busy is false:
		now disambiguation-busy is true;
		add macguffin to the list of disambiguables, if absent;
		now the disambiguation id of macguffin is the number of entries in list of disambiguables;
		say "" (A);
		say "[the number of entries in list of disambiguables]";
		say ") " (B).

After printing the name of a room while asking which do you mean (this is the Numbered Disambiguation Choices cleanup disambiguation-busy flag for rooms rule):
	now disambiguation-busy is false.

Thanks a lot matt. Right, your additions for rooms seem to do the trick.

I take it it doesn’t matter that we’ve now got one line saying ‘Understand the disambiguation id property as describing a room’ and another saying ''Understand the disambiguation id property as describing a thing" ? I’ve never used the ‘Understand the such-and-such property’ construction before. When I look at the docs for it (17:15) I see that I’d usually do that sort of distinguishing by typing something along the line of ‘Understand ‘broken’ as the flowerpot when flowerpot is broken.’

-Wade

The current Github code of Counterfeit Monkey uses a modified version of Numbered Disambiguation Choices with room disambiguation support.

Before this was added, the game would give a run-time error if the player typed, say, 2 when the game asked “Which do you mean, Long Street North or Long Street South?”

2 Likes

Thanks! I transplanted the modified version into my project and it works for option 2s.

-Wade

Great! Note that the extension currently has a hard limit of 15 numbered options, but this can be increased by adding more “disvalues”.

I figured that would be the case. But I’ve got a feeling that if I let 15 things ever get into the same round of ‘Which do you mean?’ I am probably deserving of whatever I subsequently get.

-Wade

Oh, and I guess you figured out that the “Numbered Disambiguation Choices reset disambiguation id when no numbers in command” rule needs to be replaced with the commented-out version below it. Otherwise I don’t think it will compile at all.

EDIT: I pushed a commit that should fix this. Now the modified extension should be usable by others out-of-the-box.

By the way, there is another rule in the CM code that is meant to fix the problem matt w mentioned above with choosing 1.

1 Like

It would be great to put the improved version of NDC in i7/extensions. Feel free to if you have the time!

Done!

1 Like