Listwriter and inventory

Hey everyone!

An interesting point was raised over on the Discord forums. While taking inventory, we sometimes want to partition the inventory list, such as with the Bogart example. We want the benefit of the listwriter when it comes to things like listing objects contained, “providing light/open”, activities hooking into that functionality, and so on.

My natural inclination would be to split the list in two. However, since the inventory function actually calls the I6 layer, there’s no natural way to do that. The only list we can print is the children of the object passed into the listwriter, meaning we would have to rewrite the listwriter.

My current solution was this. It feels… really hacky.

There is a room.

The player wears a vest.
The box is an openable container. A key is in the box. The player carries the box.

The print standard inventory rule does nothing.

Carry out taking inventory (this is the print extended inventory rule):	
	if the player wears something:
		say "[We] [are] wearing:[line break]" (A);
		now everything worn by the player is marked for listing;
		list the contents of the player, with newlines, indented, including contents, giving inventory information, with extra indentation, listing marked items only;
		now everything worn by the player is not marked for listing;
		say line break,
	if the player carries something:
		now everything carried by the player is marked for listing;
		say "[We] [are] carrying:[line break]" (B);
		list the contents of the player, with newlines, indented, including contents, giving inventory information, with extra indentation, listing marked items only;
		now everything carried by the player is not marked for listing;
	otherwise:
		say "[We] [are] carrying nothing." (C);

So my question then becomes, is it profitable (or even viable) to retool the list-writing system to take a list of objects rather than an object? What are the implications?

3 Likes

Your “hacky” solution solves the problem. That’s what marked for listing is intended for. Declare victory and move on.

That said, there are several other hooks into the list writer, including

say “[list of (description of objects)]”
say “[is-are a list of (description of objects)]”
say “[is-are a list of (description of objects) including contents]”

These all wind up calling WriteListOfMarkedObjects(), which, as you might guess, sets marked for listing appropriately and then goes into the regular list-writer. (Except that it’s not limited to children of a specific object.)

4 Likes