Limiting objects listed for "Which do you mean"?

Note to those in charge of the forum: why can’t I search for the exact phrase “which do you mean”? Please fix this!

I’m having a bit of difficulty with the “which do you mean” activity.
I have a mechanism type, and each object of the mechanism type has 25 things which are part of it. Some are functional (buttons, levers, etc) and some are not (warning labels, rusty spots, etc).
I have a room with a blue machine, a red machine, a yellow machine and a green machine.
When I type in X MACHINE, what I want is this: Which do you mean, the blue machine, the red machine, the yellow machine or the green machine? But instead I get a list of all 100 elements which are a part of any machine: Which do you mean, then blue machine's blue button, the blue machine's red button, the blue machine's yellow button, the blue machine's warning label, the blue machine's left lever....and on and on and on and on... How do I accomplish this? I want to limit items listed in the “which do you mean” list to objects which are not a part of anything else.

I don’t know how much control the forum admins have over the terrible search function, but there’s alway’s Google’s ‘site:’ function, as in ‘ “which do you mean”’

I also don’t know how to limit objects listed in the way you’re asking about.

You should be able to do something like (untested - I probably have the exact wording wrong):

does the player mean doing something with something that is part of a machine: it is unlikely.

That should filter out the parts of the machine unless the player specifically refers to some part of the machine. I.e. x machine, should now work like you want, but x button should still list the buttons on each machine (because although the rules states that it’s unlikely, nothing else is more likely).

I tried this (and several variations) and it didn’t work. It looks like this decision only takes place after the “which did you mean” list is built.

Anyone have any other thoughts?
I’ve tried the “does all include” but that doesn’t affect this activity.

Perhaps I can just put a check in where if the list is more than 10 long, I’ll just block it and say “sorry, you’ll have to be more specific”. Anybody know how to catch and handle that?

I think the extension Disambiguation Control by Jon Ingold can be helpful.

(It does have documentation, it just doesn’t show up on the extensions site.)

That looks promising, I don’t know why I didn’t think to look among the extensions. Just another facepalm moment.
Thanks, I’ll let everyone know if this works for me.

It might also help if you posted your original code, or a slimmed-down fragment that reproduced the problem. Do you by any chance have a line like this?

Understand "machine" as a thing when the item described is part of a machine.

Jon Ingold’s Disambiguation control seems to be doing what I want, except I came up against this error:[code]> x machine
[** Programming error: tried to read from -->100 in the array “match_list”, which has entries 0 up to 99 **]

[** Programming error: tried to read from -->100 in the array “match_scores”, which has entries 0 up to 99 **]
What do you want to examine: 1) blue machine, 2) red machine, 3) yellow machine or 4) green machine?[/code]Anyone know if/how I can fix this? I tried looking in the extension to see where the length of these two arrays are set, but I can’t seem to find it, and I don’t know i6 code very well so I’d probably end up breaking it.

How are you assigning your parts? Because if I do this:

Engineering is a room.

A machine is a kind of thing. 
A button is a kind of thing.

A red machine, a blue machine and a green machine are machines in Engineering.

One button is a part of every machine.

I don’t have a problem:

You can see a red machine, a blue machine and a green machine here.

>x machine
Which do you mean, the red machine, the blue machine or the green machine?

>x red machine
You see nothing special about the red machine.

>x red machine's button
You see nothing special about the red machine's button.

Slightly off-topic: Which does bring up another question that I had before which is how it decides the names of part that are assigned with a “part of every x” and whether or not you can control how it does that. I encountered that when I had a head as part of every person and hair as part of every head. Then the hair becomes “Bob’s head’s hair” which is obviously stupid (the fix is not to worry about the hair being part of the head, unless you intend to separate the head from Bob at some point, it should be a problem).

Maybe fiddle with this bit:To decide which list of objects is the match list: let L be a list of objects; repeat with N running from 1 to 100: and change the 100 to 99?

You can’t. Or at least it is quite hardcoded into Inform.

For the Swedish I7 translation, I was trying to find a way to give such assembly parts names in Swedish. But there seems to be nothing in either the Standard Rules or the I6 Templates that is responsible for those names.

I found that line, and I changed the 100 to 500 (because the disambiguation was running through over 100 parts) and it didn’t change anything. When I’m back on my Inform machine I’ll try that.

The standard rules by default sets the MATCH_LIST_WORDS constant that determines the length of the match_list array by the use option ‘Use maximum things understood at once’ to ‘at least 100’. That’s probably the line you should change:

Use maximum things understood at once of at least 500.

That did the trick, thank you!
Now I’ve got my disambiguation control working perfectly, thanks!