Custom Articles, Listing Contents, and Printed Names

I would like to be able to set it so some (or all) items appear with the indefinite article the first time you see them and the definite article thereafter. So you would be able to say “A dog is truffling around the bushes” the first time you see the dog and “The dog is truffling around the bushes” thereafter.

(Actually, it’d be better to say “The dog is still truffling around the bushes,” but that seems like even more work!)

I can get that to work OK with things that are explicitly mentioned in the room description:

A thing can be undiscussed or previously discussed. A thing is usually undiscussed.

To say a-the (item - thing):
	if item is undiscussed:
		say "[an item]";
		now item is previously discussed;
	otherwise if item is previously discussed and item is improper-named:
		say "[the item]";
	otherwise:	
		say "[printed name of item]".
	
To say A-The (item - thing):
	if item is undiscussed:
		say "[An item]";
		now item is previously discussed;
	otherwise if item is previously discussed and item is improper-named:
		say "[The item]";
	otherwise:	
		say "[printed name of item]".

Test room is a room. "The test room. You can see [a-the carved door] leading west." A sword is in Test room. Bob is a man in Test room.
A carved door is a door. The carved door is scenery. The carved door is west of Test room and east of Other room. A chandelier is scenery in Other room. Some sand is scenery in Other room. The description of Other room is "[A-The chandelier] hangs from the ceiling. [A-The sand] crunches underfoot." Jane is a woman in Other room.

Test me with "w/e/w".

But, as you can tell by running the test script, it doesn’t work for the sword. So I’d like to be able to get my custom a-the article into lists. But the lists are created by some deep I6 magic, and I don’t know how to change them.

I’ve tried to do this by fiddling with the rule for printing the name of a thing while listing contents. The first problem is that I can’t simply say “[a-the item]” in a rule for printing the name of item, because it will call an infinite loop. So I’ve tried to do this by setting a flag that checks whether we’re calling the rule from within itself, and if so using “[printed name of the item]” instead of “[a-the item]”. But the results are odd – I’ve left in debugging interjections:

A thing can be article-fixed or article-unfixed. A thing is usually article-unfixed. After reading a command: Now every article-fixed thing is article-unfixed. Before listing contents: now every article-fixed thing is article-unfixed. Rule for printing the name of a thing (called item) while listing contents: if item is article-fixed: say "boop! [printed name of item]"; otherwise: say "(bong!)"; now item is article-fixed; say "[a-the item] (bing!)".

This yields:

As you can see, the code after “otherwise” runs for Bob but not for the sword. As far as I can tell, this happens because the code that prints the indefinite article for the sword itself runs by the rule for printing the name of the sword without printing the name of the sword, and thus silently sets the sword to article-fixed. Since Bob doesn’t have an indefinite article, the rule runs as expected (but it isn’t any use, since Bob doesn’t have an article). Fiddling around with the text substitution “[indefinite article of item]” seemed to yield similar results. And in any case, I haven’t suppressed the “a” in front of sword, which is what I’d really like to do.

How can I achieve the desired behavior? I suspect the answer is either “hack the I6” or “rewrite the relevant listing behavior from the ground up in I7.” Also, can anyone explain exactly what is happening?

Ah! I think I see how to get at least most of the desired behavior. I just need to add “suppressing all articles” to every “list the contents of” phrase in the Standard Rules – that’s the print standard inventory rule, the describe what’s on scenery supporters rule, the you-can-also-see rule, and the use initial appearances in room descriptions rule. And to fiddle with another list in the you-can-also-see rule.

Still curious about the general behavior of indefinite articles, though; does the rule for printing the name of the object get called whenever Inform wants to print the indefinite article?

ETA: Darnit, it still isn’t working for the examine supporters and examine containers rules, and I think I have to delve into Custom Library Messages to change those.

I’m pretty sure it does.

Perhaps you could try something along these lines?

The indefinite article of a thing is "[if undiscussed]a[otherwise]the". After printing the name of a thing (called item) when the item is undiscussed: now the item is previously discussed.
(The code for the indefinite article would have to be much more complex, of course.)

Changing the indefinite article to “the” is much better, Felix! Thank you.

Here’s what I have now, which I think may avoid some of the complexities:

[code]A thing can be variably-articled. A thing is usually variably-articled.

After printing the name of a variably-articled improper-named thing (called item) when the indefinite article of item is not “the”: now the indefinite article of item is “the”.[/code]

You can use the “variably-articled” flag to make sure some things never switch to “the,” and you don’t disturb the usual indefinite-article behavior.

Does this look like it’ll work to you?