Custom inventory

I added this to your code to get a better view of what’s happening:

A thing has a number called times printed.	

Before printing the name of a thing (called X) while taking inventory:
	say "([times printed of X])";
	now times printed of X is times printed of X + 1.

Before printing the plural name of a thing (called X) while taking inventory:
	say "([times printed of X])";
	now times printed of X is times printed of X + 1.

That gives us this:

Test
An Interactive Fiction by Colleen Boye
Release 1 / Serial number 160405 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD

airport
You can see a coin here.

>i
The clothing you are wearing: 
  a (1)coat
The (1)coat pockets contain: 
  a (1)train ticket
  two (0)pens [new items]
You are also wearing: 
  a pair of (0)binoculars [new item]
You are carrying: 
  a (1)wrong suitcase (closed)

>i
The clothing you are wearing: 
  a (3)coat
The (3)coat pockets contain: 
  a (3)train ticket
  two (1)pens
You are also wearing: 
  a pair of (1)binoculars
You are carrying: 
  a (3)wrong suitcase (closed)

>i
The clothing you are wearing: 
  a (5)coat
The (5)coat pockets contain: 
  a (5)train ticket
  two (2)pens
You are also wearing: 
  a pair of (2)binoculars
You are carrying: 
  a (5)wrong suitcase (closed)

We can see that the objects with default articles have their names printed twice each time that we take inventory.

After some investigation, I found this thread that explains what’s going on.

The thread’s author, Taryn Michelle, packaged the workaround as an extension called Print Stage Detection. I did a quick comparison of the I6 PrefaceByArticle code in the extension with the version generated by I7 6M62, and it appears to be identical other than the article_choosing stuff that Taryn added.

So, I’d suggest grabbing and installing the extension, at which point you can do:

Include Print Stage Detection by Taryn Michelle.

After printing the name of an unchecked thing (called X) while taking inventory:
	say " [bracket]new item[close bracket]";
	if the print-stage is name-printing:
		now X is checked.

[unchecked groups of items]
After printing the plural name of an unchecked thing (called X) while taking inventory:
	say " [bracket]new items[close bracket]";
	if the print-stage is name-printing:
		now X is checked.

This is the output:

Test
An Interactive Fiction by Colleen Boye
Release 1 / Serial number 160405 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD

airport
You can see a coin here.

>test me
(Testing.)

>[1] i
The clothing you are wearing: 
  a coat [new item]
The coat pockets [new item] contain: 
  a train ticket [new item]
  two pens [new items]
You are also wearing: 
  a pair of binoculars [new item]
You are carrying: 
  a wrong suitcase [new item] (closed)

>[2] take coin
Taken.

>[3] i
The clothing you are wearing: 
  a coat
The coat pockets contain: 
  a train ticket
  two pens
You are also wearing: 
  a pair of binoculars
You are carrying: 
  a coin [new item]
  a wrong suitcase (closed)

>[4] open suitcase
You open the wrong suitcase, revealing someone else's clothing.

>[5] i
The clothing you are wearing: 
  a coat
The coat pockets contain: 
  a train ticket
  two pens
You are also wearing: 
  a pair of binoculars
You are carrying: 
  a coin
  a wrong suitcase
The wrong suitcase contains someone else's clothing [new item].

>

Here’s the full code:

"Test" by Colleen Boye

Include Print Stage Detection by Taryn Michelle.

[clothing and inventory management]

[separating clothes from other worn things]
A garment is a kind of wearable thing.
Definition: a thing is a non-garment if it is not a garment.
[manually suppresses listing contents of certain things]
A container can be interesting or uninteresting. A container is usually interesting.

A person has a number called rule count.

[emphasizing new items by printing a note after them]
A thing can be checked or unchecked. A thing is usually unchecked.

After printing the name of an unchecked thing (called X) while taking inventory:
	say " [bracket]new item[close bracket]";
	if the print-stage is name-printing:
		now X is checked.

[unchecked groups of items]
After printing the plural name of an unchecked thing (called X) while taking inventory:
	say " [bracket]new items[close bracket]";
	if the print-stage is name-printing:
		now X is checked.

[When play begins:
now every visible thing enclosed by the player is checked.]

[lists the contents of a container]
Pedantically listing something is an activity on things.
Rule for pedantically listing a thing (called X):
	if X is open or X is transparent:
		if X contains something and X is interesting:
			if X contains exactly one thing:
				say "[The X] [contain] ";
				list the contents of X, giving brief inventory information;
				say ".[line break]";
			otherwise:
				say "[The X] [contain]: [line break]";
				list the contents of X, with newlines, indented, giving brief inventory information, with extra indentation.

[custom way of listing inventory]
Instead of taking inventory: 
	if the number of things enclosed by the player is 0, say "You are empty-handed." instead;
	if the player wears a garment: 
		now all things enclosed by the player are unmarked for listing; 
		now all garments worn by the player are marked for listing; 
		say "The clothing you are wearing: [line break]"; 
		list the contents of the player, with newlines, indented, with extra indentation, giving brief inventory information, listing marked items only;
	[contents of clothing containers listed individually]
	repeat with X running through garments worn by the player:
		carry out the pedantically listing activity with X;
		[containers enclosed by clothing]
		repeat with Y running through interesting containers enclosed by X:
			carry out the pedantically listing activity with Y;
	if the player wears a non-garment: [binoculars, etc]
		now all things enclosed by the player are unmarked for listing; 
		now every non-garment worn by the player is marked for listing; 
		say "You are also wearing: [line break]"; 
		list the contents of the player, with newlines, indented, with extra indentation, giving brief inventory information, listing marked items only;
	[contents of worn non-clothing containers listed individually]
	repeat with X running through non-garment things worn by the player:
		carry out the pedantically listing activity with X;
		[containers enclosed by non-clothing]
		repeat with Y running through interesting containers enclosed by X:
			carry out the pedantically listing activity with Y;
	if the player carries something: 
		now all things enclosed by the player are unmarked for listing; 
		now all things carried by the player are marked for listing; 
		say "You are carrying: [line break]"; 
		list the contents of the player, with newlines, indented, giving brief inventory information, with extra indentation, listing marked items only;
	[lists contents of carried containers individually]
	repeat with X running through things carried by the player:
		carry out the pedantically listing activity with X;
		[containers enclosed by carried objects]
		repeat with Y running through interesting containers enclosed by X:
			carry out the pedantically listing activity with Y.
	[now every visible thing enclosed by the player is checked.]

[example]
The airport is a room.
The player is in the airport.

The coat is a garment.
The pockets are part of the coat. They are plural-named. They are a container.
Rule for printing the name of the pockets while taking inventory: say "coat pockets".
A train ticket is in the pockets.
A pen is a kind of thing.
There are two pens in the pockets.

The binoculars are a wearable thing. They are plural-named. The indefinite article of the binoculars is "a pair of".	

The wrong suitcase is a closed, opaque, openable container.
A thing called someone else's clothing is in the wrong suitcase.

The player wears the coat. The player wears the binoculars. The player carries the wrong suitcase.

In the airport is a coin.

test me with "i/take coin/i/open suitcase/i".