I7: cycling through things that are part of an item

I have code to hint individual items. It rejects you if you haven’t seen that item yet. The problem is, I don’t quite have all cases down. The code below works for that (maybe someone would want to use it themselves,) but it brought up another question.

NW corner is a room. the player is in NW corner.
NE corner is east of NW corner.
SE corner is south of NE corner.
SW corner is west of SE corner.
NW corner is north of SW corner.
description of a room is usually "The southbeast [if southbeast is touchable]is[else]isn't[end if] around."

The southbeast is a backdrop. It is in SW corner and SE corner.

The nose is part of the southbeast.

a thing has a truth state called touched-yet.

every turn:
	repeat with X running through touchable things:
		if X is touchable:
			if touched-yet of X is false, say "You just discovered [the X].";
			now touched-yet of X is true;
	repeat with X running through backdrops:
		repeat with YY running through things enclosed by X:
			say "[if touched-yet of X is true]You've[else]You haven't[end if] discovered [the X].";

The problem is the “through things enclosed by X” line here. I’d think I’d get a status on whether or not you’ve discovered the beast’s nose, but it doesn’t pop up. The same seems to apply for doors, etc.

What is the precise wording that works, here?

It looks to be just a bug in your code: the final line has [the X] where it should have [the YY].

touched-yet of X is true in the same line is perhaps also intended to check YY as well.

Also touched-yet isn’t really a good name; this is more of a seen or known flag, as currently implemented.

For actual touching, there’s already handled for things. This is automatically set whenever a portable thing is first picked up, then never cleared (unless the rules explicitly say so). (This is what causes the initial appearance to stop being shown.)

Finally, you might want to consider implementing this as an attribute (a thing can be known or unknown) – apart from reading a bit better (if X is known), this also lets you use it in descriptive phrases (repeat with X running through touchable unknown things).

I think you can even just say something like now every touchable unknown thing is known, although I haven’t tested that recently.