Cycling through piece conditions

Regarding your original question/suggestion:

Unfortunately, Inform isn’t able to compare to variables in that manner, at least not without some help (see also this thread):

"In Pieces"

The lab is a room.

A piece is a kind of thing.
a piece can be irrelevant, placed or reserved.

Foo is an irrelevant piece in the lab.
Bar is a placed piece in the lab.

Chapter Hack

To decide whether (O - object) has (P - L valued property) set to (V - value of kind L):
	(- (GProperty(OBJECT_TY, {O}, {P}) == {V}) -).

To decide what list of Ks is (full list - list of values of kind K) filtered by (P - L valued property) being (V - value of kind L):
	let the filtered list be a list of Ks;
	repeat with item running through the full list:
		if the item has P set to V, add the item to the filtered list;
	decide on the filtered list.

To say (P - a sayable value) in upper case:
	let T be "[P]";
	say "[T in upper case]".

chapter pie

pieing is an action out of world.

understand the command "pie" as something new.

understand "pie" as pieing.

carry out pieing:
	repeat with Q running through piece conditions:
		let L be the list of pieces filtered by the property piece condition being Q;
		if the number of entries in L is not zero:
			say "[Q in upper case] PIECES:[line break]";
			repeat with P running through L:
				say "[P] ([Q]) [location of P].";
	the rule succeeds.

Producing:

>pie
IRRELEVANT PIECES:
Foo (irrelevant) lab.
PLACED PIECES:
Bar (placed) lab.