Numbered Disambiguation Choices by Aaron Reed

This gives the following line:
ADVENTURE HERE>: x pamphlet
What do you want to examine: the 1) Third Pamphlet, the 2) First Pamphlet, the 3) Second Pamphlet, or the 4) fourth pamphlet?

Note that the order of the selections is not correct. How can I fix this? or is it not my problem?

Greg

I get the same output that you do. Interestingly, if you don’t include the extension, the standard “which do you mean” output from Inform shows the pamphlets in the expected order. This is a strong hint that somehow the extension’s code is juggling the items around in the process of listing them.

Beyond that … dunno.

Until there’s a fix, just say that your game is railing against the tyranny of numerical order. No privileged number ones for you.

It’s actually internal Inform code doing this, though I don’t have any real idea why. The line that causes it is this one, from Numbered Disambiguation Choices:

Understand the disambiguation id property as describing a thing.

If you want to see that this is so, add the following to the posted example code, and don’t include Numbered Disambiguation Choices:

Every thing has a number called disambiguation id. Understand the disambiguation id property as describing a thing.

Somehow, this causes Inform to rearrange the internal order by which it iterates through these objects during parsing routines, at least in this particular case. It doesn’t matter what the disambiguation id of the objects is–the simple existence of the understand line is enough to cause the change. I have no idea whether this should be considered a bug or not. Does Inform guarantee that objects will be printed in any certain order?

–Erik

I sort of think it might be possible to work around this by assigning things a numbered property and sorting the list of disambiguation choices in order of that property; but in order to do that we have to silence everything that gets printed while asking which do you mean, collect it into a list, sort that list, and then print the names on the disambiguation list with their numbers. I’ve figured out how to suppress printing the names of the disambiguees, and I think I know at what step of the process you should sort and print the list; but that still leaves this abomination:

Which do you mean, the , the , the  or the ?

So I’d need to suppress the articles and the punctuation. My most optimistic idea is that it might be possible to do this with Custom Library Messages; anyone who knows how, halp!

I suspect that that would require hacking the library. But if you’re just looking to do a proof of concept, you could use Text Capture to write the abomination to a buffer and then just throw it away. You can then rewrite the whole thing yourself at the appropriate time.

By the way, it isn’t necessary to have a property to store the numerical ordering. You can use a decide phrase to grab the I6 object number, which will reflect the creation order:

To decide which number is the object number of (O - an object): (- {O} -)

–Erik

Suddenly I feel motivated to start doing my actual work instead. (Seriously, thanks for the suggestion; I’ll look into it sometime.)

Well, I figure it’d be nice to let the author set it instead of relying on source text ordering; they could even dynamically reset it, if they wanted to.

Because of the code that Erik identified, Inform calls DECIMAL_TOKEN to check for a number that describes the pamphlet. DECIMAL_TOKEN in turn calls ParseTokenStopped and therefore ParseToken in which the match list (currently being built) has to be saved and restored. But the save and restore are in reversed order, so the match list is flipped before each new match is added. Hence, you get the list built up as [ First ], then [ First, Second ], and [ Second, First, Third ], and finally [ Third, First, Second, Fourth ]. Whether that’s a bug I don’t know, but I would encourage you to report it.

In the meantime, you could workaround the problem by patching up ParseToken, or more hackily by adding another reversal with code like Every thing has a number called hack. The hack of a thing is always -1. Understand the hack property as describing a thing.

M… It looks like I’m doomed to spend my life trying to sort out things that don’t matter. Just think, what if I get this order in order then add a few more pamphlets. After all, we zealots must just keep adding to the knowledge of you lesser beings! :laughing: