Clothes formations that don't make sense

I’m making a game… bet you couldn’t have guessed that. and my game is telling me what the player is wearing underneath their top clothes. which shouldn’t happen.

so i’m gonna push a looooooooooooooooooooooooooooooooooot of code here for anyone who wants to read it and help me find out why it’s going crazy.

if i take the clothes off and put them on again, it’s fine. and the code works. but it’s starting the play with it that messes it up.

oh and “try silently” wearing all the clothes in the correct putting-them-on order doesn’t work in the when play begins thing. same result: it mentions my boxers while it shouldn’t be mentioning them at all.

i think it’s because i start wearing them at the same time, and the game just clips them together.

you guys ready for my clothing code? well, “my”… i got most of it out of the documentation.

[code]Section clothing

A garment-element is a kind of thing.

Underlying relates various garment-elements to various garment-elements with fast route-finding. The verb to underlie means the underlying relation. The verb to be under implies the underlying relation.

Check taking off:
if the noun underlies something (called the impediment) which is worn by the player, say “[The impediment] [are] in the way.” instead.

Carry out taking off:
now the noun is not underlaid by anything.

Report taking off something:
say “[We] [are] now wearing [a list of uppermost things worn by the player].” instead.

Definition: a garment-element is uppermost if it is not under something opaque.

Before taking off something which underlies something which is worn by the player:
while the noun underlies something (called the impediment) which is worn by the player:
say “(first removing [the impediment])[command clarification break]”;
silently try taking off the impediment;
if the noun underlies the impediment, stop the action.

Overlying relates various garment-elements to various garment-elements. The verb to overlie means the overlying relation.

Covering relates a garment-element (called A) to a garment-element (called B) when the number of steps via the overlying relation from A to B is greater than 0. The verb to cover means the covering relation.

Before wearing something when a garment which covers the noun is worn by the player:
while the player wears a garment (called the impediment) which covers the noun:
say “(first removing [the impediment])[command clarification break]”;
silently try taking off the impediment;
if the player is wearing the impediment, stop the action.

Carry out wearing:
repeat with hidden item running through things worn by the player:
if the noun covers the hidden item, now the hidden item underlies the noun.

Instead of looking under something which is worn by the player:
if something (called the underwear) underlies the noun, say “[We] [peek] at [the underwear]. Yup, still there.”;
otherwise say “Just [us] in there.”

[
Instead of taking inventory:
say "
[if the player carries something][We]['re] carrying [a list of things carried by the player][else][We]['re] empty-handed[end if][if the player wears the satchel][if the player carries something] and [else] but [end if] you have your trusty satchel with you[end if][if the player wears something that is not the satchel]. [We] [are] wearing [a list of uppermost garments worn by the player][end if]."
]

Instead of taking inventory:
say "[We]['re] ";
if the player carries something:
if the player carries the switchblade:
if the switchblade is open:
say “wielding your trusty switchblade”;
otherwise:
say “holding your trusty switchblade in one hand, safely folded up and closed,”;
otherwise:
say “carrying [a list of things carried by the player][no line break]”;
otherwise:
say “empty-handed[no line break]”;
if the player wears the satchel:
if the player carries something:
say " and ";
otherwise:
say " but ";
say “you have your trusty satchel with you[no line break]”;
if the player wears something that is not the satchel:
say “. [We] [are] wearing [a list of uppermost garments worn by the player].”;
otherwise:
say “.”;
if the player wears the satchel:
try examining the satchel;
let x be the number of things in the satchel;
if x is greater than 10:
say “Wow. You’re hauling around a ton of crap.”;

To peek is a verb.

Before wearing something:
let N be the layering depth of the noun;
repeat with item running through things worn by the player:
if the layering depth of the item is N and the item covers a body-part which is covered by the noun:
say “(first taking off [the item])[command clarification break]”;
silently try taking off the item;
if the player wears the item, stop the action.

To decide what number is the layering depth of (chosen garment - a thing):
let N be 0;
if the chosen garment covers a body-part (called base):
let N be the number of steps via the overlying relation from the chosen garment to the base;
decide on N.

A body-part is a kind of garment-element. A torso, a seat, a head, a neck, pair of legs, and pair of feet are kinds of body-part.

One head is part of every person. One torso is part of every person. One pair of legs is part of every person. One pair of feet is part of every person. One seat is part of every person. One neck is part of every person.

A garment is a kind of garment-element. A garment can be transparent. A pair of pants, a pair of underpants, a foundation garment, a pair of socks, a pair of shoes, a jacket, a hat, a dress, neckwear, bril, and a shirt are kinds of garment.

The plural of pair of pants is pairs of pants. The plural of pair of underpants is pairs of underpants. The plural of pair of socks is pairs of socks. The plural of pair of shoes is pairs of shoes.

A pair of pants, a pair of underpants, a foundation garment, a pair of socks, a pair of shoes, a jacket, a hat, a dress, neckwear, bril, and a shirt are usually wearable.

When play begins:
now every pair of socks overlies every pair of feet;
now every pair of shoes overlies every pair of socks;
now every pair of underpants overlies every seat;
now every pair of pants overlies every pair of underpants;
now every foundation garment overlies every torso;
now every jacket overlies every shirt;
now every jacket overlies every dress;
now every hat overlies every head;
now every dress overlies every pair of underpants;
now every dress overlies every foundation garment;
now every neckwear overlies every neck;

Instead of taking off a pair of pants in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a pair of underpants in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a foundation garment in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a dress in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a shirt in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

There are worn white sneakers, some white socks, some capris, some jeans, a corset, a plunge bra, a thong, boy-shorts, black satin D’Orsay pumps, brown leather boots, a camisole, a cocktail dress, a bolero, a cashmere shrug, a sheer wrap, and a linen tunic.

[The player wears some boxers, some white socks, a sleeveless shirt, some jeans, worn white sneakers and a blue shirt.]

The player carries a blue shirt, some jeans, a sleeveless shirt, worn white sneakers, some white socks and some boxers.

[Hi. Just to point out that changing the order in which i mention them doesn’t solve my issue. sadly.]

Some boxers are pairs of underpants.
Some woolly socks and some white socks are a pair of socks.
The worn white sneakers, D’Orsay pumps and the brown leather boots are pairs of shoes.
The skimpy thong, the thong and the boy-shorts are pairs of underpants.
The capris and the jeans are pairs of pants.
The tunic is a shirt.
The sleeveless shirt is a shirt.
The push-up bra, the camisole, the corset, and the plunge bra are foundation garments.
The cocktail dress is a dress.
The thin white nightgown is a dress. The thin white nightgown is transparent.
The blue shirt, bolero, the cashmere shrug, and the sheer wrap are jackets. The shrug and the wrap are transparent.

The description of the thin white nightgown is “It’s basically see-through.”

understand “gown” and “nightie” as nightgown.[/code]

I think the problem is that your underlying relationships (socks underlie shoes, etc.) are only getting set when the player executes a wearing action, so they’re not set at the beginning of play. Restore the “The player wears…” declaration and try this:

When play begins: repeat with first item running through things worn by the player: repeat with hidden item running through things worn by the player: if the first item covers the hidden item, now the hidden item underlies the first item.

This should set the underlying relationship properly for the things the player wears initially. (Make sure this rule comes after the rule that sets the “covering” relationship.)

(Also, the shirt covers the boxers? I find that unintuitive.)

also, I get

before the start of the game… any way to not get that?

If I’m wearing a shirt and boxers, and nothing else, the boxers will be visible to others (i.e. not covered by the shirt). For that reason I tend not to go outside wearing only a shirt and boxers.

I suppose it depends on the size of the particular clothing but that’s how I’d expect it to work intuitively as a player.

Oh I get it now. Good point. That doesn’t happen now? I don’t see where shirts overlay the oonterpantz.

When play begins: now every pair of socks overlies every pair of feet; now every pair of shoes overlies every pair of socks; now every pair of underpants overlies every seat; [underpants over sitting biology] now every pair of pants overlies every pair of underpants; [pants over underpants] now every foundation garment overlies every torso; now every jacket overlies every shirt; now every jacket overlies every dress; now every hat overlies every head; now every dress overlies every pair of underpants; now every dress overlies every foundation garment; now every neckwear overlies every neck;

Are you doing a “Try wearing item” kind of loop at the start of the game? You shouldn’t need to do that.

Here’s the code I currently have, which is just yours with the changes I mentioned (and a couple things to make it compile–I defined a location and the satchel and switchblade):

[spoiler][code]Section clothing

A garment-element is a kind of thing.

The switchblade is a thing. The switchblade can be open.
The satchel is a thing.

Underlying relates various garment-elements to various garment-elements with fast route-finding. The verb to underlie means the underlying relation. The verb to be under implies the underlying relation.

Check taking off:
if the noun underlies something (called the impediment) which is worn by the player, say “[The impediment] [are] in the way.” instead.

Carry out taking off:
now the noun is not underlaid by anything.

Report taking off something:
say “[We] [are] now wearing [a list of uppermost things worn by the player].” instead.

Definition: a garment-element is uppermost if it is not under something opaque.

Before taking off something which underlies something which is worn by the player:
while the noun underlies something (called the impediment) which is worn by the player:
say “(first removing [the impediment])[command clarification break]”;
silently try taking off the impediment;
if the noun underlies the impediment, stop the action.

Overlying relates various garment-elements to various garment-elements. The verb to overlie means the overlying relation.

Covering relates a garment-element (called A) to a garment-element (called B) when the number of steps via the overlying relation from A to B is greater than 0. The verb to cover means the covering relation.

Before wearing something when a garment which covers the noun is worn by the player:
while the player wears a garment (called the impediment) which covers the noun:
say “(first removing [the impediment])[command clarification break]”;
silently try taking off the impediment;
if the player is wearing the impediment, stop the action.

Carry out wearing:
repeat with hidden item running through things worn by the player:
if the noun covers the hidden item, now the hidden item underlies the noun.

Instead of looking under something which is worn by the player:
if something (called the underwear) underlies the noun, say “[We] [peek] at [the underwear]. Yup, still there.”;
otherwise say “Just [us] in there.”
[/code][/spoiler]

And here’s the output, with a lot of giant text-dumps to show what relations there are:

So for some reason, the boxers wind up underlying the blue shirt when both are worn, even though the blue shirt doesn’t overlie the boxers. Let me poke around…

OK, I’m pretty sure this is happening because the blue shirt overlies the cocktail dress and the cocktail dress overlies the boxers. (Same thing for the thin white nightgown.) Since “cover” is defined in terms of the overlying relation, and you can get from the shirt to the boxers in two steps via the overlying relation, this is messing things up.

…blech. You have to have some kind of notion of what body parts your clothes go on, so the shirt which goes on the torso doesn’t cover the boxers which go on the seat, but the cocktail dress which covers the torso and seat does cover the boxers which go on the seat. But I’m having too much trouble implementing this now.

Oh, and here’s something that will be obnoxious to implement: The blue shirt should cover the cocktail dress for purposes of when you take off the dress you have to take off the shirt first, but if you’re only wearing the dress and the shirt, the dress should show up in your inventory. You can still see the skirt of the dress, after all. (Perhaps you should also be able to take the dress off if you’re wearing the shirt.) Maybe the way to implement this is, when you have to do a check of what you’re wearing (in response to “inventory” or “x me” or when you take something off), you should loop through every body part and make a list of what the outermost visible thing that covers that body part is. So if the dress is the outermost thing that covers your seat, you can see it even if the dress is covered by the blue shirt. But if you’re wearing the blue shirt and a maxi-skirt over the dress (suppose for a moment this is possible), then you couldn’t see the dress, because the maxi-skirt would be the outermost thing that covers the seat and the shirt would be the outermost thing that covers the torso.

That might require a refactor, though–you’d have to give every piece of clothing a direct relationship to the body-parts so you could tell which body-parts they ultimately cover.

Matt, what about a dress and a trenchcoat?

also, can we negative? like, the underpants do not underlay the shirt? something to that effect?

Dress and trenchcoat might conceivably depend on the length of the trenchcoat and the dress–either might or might not cover your legs, I think. On this page it looks like just about every dress/trenchcoat combination has the dress shorter than the coat (but you can see the dress because the coat is open), except for a couple where the fringe pokes out.–I’ll tell you what, when you’re asking me for fashion advice something has gone wrong.

You can do things like “Carry out wearing the blue shirt: Now the underpants do not underlie the blue shirt” but they won’t be particularly useful in this case–since you’re setting the underlying relation whenever the player puts something on you’d have to put all those clauses in your rules for wearing, and it would be tiresome. I think it would definitely be a better idea to do something with a special relationship between clothes and body-parts, and then check that in the clause that sets the underlying relationship.

Here’s what I have (I had to add “every shirt overlies every torso” as well as “every shirt swaddles every torso”):

[spoiler][code]Section clothing

A garment-element is a kind of thing.

The switchblade is a thing. The switchblade can be open.
The satchel is a thing.

A body-part is a kind of garment-element. A torso, a seat, a head, a neck, pair of legs, and pair of feet are kinds of body-part.

One head is part of every person. One torso is part of every person. One pair of legs is part of every person. One pair of feet is part of every person. One seat is part of every person. One neck is part of every person.

A garment is a kind of garment-element. A garment can be transparent. A pair of pants, a pair of underpants, a foundation garment, a pair of socks, a pair of shoes, a jacket, a hat, a dress, neckwear, bril, and a shirt are kinds of garment.

The plural of pair of pants is pairs of pants. The plural of pair of underpants is pairs of underpants. The plural of pair of socks is pairs of socks. The plural of pair of shoes is pairs of shoes.

A pair of pants, a pair of underpants, a foundation garment, a pair of socks, a pair of shoes, a jacket, a hat, a dress, neckwear, bril, and a shirt are usually wearable.

Underlying relates various garment-elements to various garment-elements with fast route-finding. The verb to underlie means the underlying relation. The verb to be under implies the underlying relation.

Check taking off:
if the noun underlies something (called the impediment) which is worn by the player, say “[The impediment] [are] in the way.” instead.

Carry out taking off:
now the noun is not underlaid by anything.

Report taking off something:
say “[We] [are] now wearing [a list of uppermost things worn by the player].” instead.

Definition: a garment-element is uppermost if it is not under something opaque.

Before taking off something which underlies something which is worn by the player:
while the noun underlies something (called the impediment) which is worn by the player:
say “(first removing [the impediment])[command clarification break]”;
silently try taking off the impediment;
if the noun underlies the impediment, stop the action.

Overlying relates various garment-elements to various garment-elements. The verb to overlie means the overlying relation.

Covering relates a garment-element (called A) to a garment-element (called B) when the number of steps via the overlying relation from A to B is greater than 0 and A and B clash. The verb to cover means the covering relation.

Swaddling relates various garment-elements to various garment-elements. The verb to swaddle means the swaddling relation.

To decide whether (A - a garment-element) and (B - a garment-element) clash:
repeat with limb running through body-parts that are swaddled by A:
if B swaddles limb, yes;
no.

To decide whether (A - a garment-element) really covers (B - a garment-element):
if A covers B and A and B clash, yes;
no.

Before wearing something when a garment which covers the noun is worn by the player:
while the player wears a garment (called the impediment) which covers the noun:
say “(first removing [the impediment])[command clarification break]”;
silently try taking off the impediment;
if the player is wearing the impediment, stop the action.

Carry out wearing:
repeat with hidden item running through things worn by the player:
if the noun really covers the hidden item, now the hidden item underlies the noun.

Instead of looking under something which is worn by the player:
if something (called the underwear) underlies the noun, say “[We] [peek] at [the underwear]. Yup, still there.”;
otherwise say “Just [us] in there.”

[
Instead of taking inventory:
say "
[if the player carries something][We]['re] carrying [a list of things carried by the player][else][We]['re] empty-handed[end if][if the player wears the satchel][if the player carries something] and [else] but [end if] you have your trusty satchel with you[end if][if the player wears something that is not the satchel]. [We] [are] wearing [a list of uppermost garments worn by the player][end if]."
]

Instead of taking inventory:
say "[We]['re] ";
if the player carries something:
if the player carries the switchblade:
if the switchblade is open:
say “wielding your trusty switchblade”;
otherwise:
say “holding your trusty switchblade in one hand, safely folded up and closed,”;
otherwise:
say “carrying [a list of things carried by the player][no line break]”;
otherwise:
say “empty-handed[no line break]”;
if the player wears the satchel:
if the player carries something:
say " and ";
otherwise:
say " but ";
say “you have your trusty satchel with you[no line break]”;
if the player wears something that is not the satchel:
say “. [We] [are] wearing [a list of uppermost garments worn by the player].”;
otherwise:
say “.”;
if the player wears the satchel:
try examining the satchel;
let x be the number of things in the satchel;
if x is greater than 10:
say “Wow. You’re hauling around a ton of crap.”;

To peek is a verb.

Before wearing something:
let N be the layering depth of the noun;
repeat with item running through things worn by the player:
if the layering depth of the item is N and the item covers a body-part which is covered by the noun:
say “(first taking off [the item])[command clarification break]”;
silently try taking off the item;
if the player wears the item, stop the action.

To decide what number is the layering depth of (chosen garment - a thing):
let N be 0;
if the chosen garment covers a body-part (called base):
let N be the number of steps via the overlying relation from the chosen garment to the base;
decide on N.

When play begins:
now every pair of socks overlies every pair of feet;
now every pair of socks swaddles every pair of feet;
now every pair of shoes overlies every pair of socks;
now every pair of shoes swaddles every pair of feet;
now every pair of underpants overlies every seat;
now every pair of underpants swaddles every seat;
now every pair of pants overlies every pair of underpants;
now every pair of pants swaddles every seat;
now every pair of pants swaddles every pair of legs;
now every foundation garment overlies every torso;
now every foundation garment swaddles every torso;
now every jacket overlies every shirt;
now every jacket swaddles every torso;
now every jacket overlies every dress;
now every hat overlies every head;
now every hat swaddles every head;
now every dress overlies every pair of underpants;
now every dress overlies every foundation garment;
now every dress swaddles every seat;
now every dress swaddles every torso;
now every neckwear overlies every neck;
now every neckwear swaddles every neck;
now every shirt overlies every torso;
now every shirt swaddles every torso;

Instead of taking off a pair of pants in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a pair of underpants in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a foundation garment in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a dress in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a shirt in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

There are worn white sneakers, some white socks, some capris, some jeans, a corset, a plunge bra, a thong, boy-shorts, black satin D’Orsay pumps, brown leather boots, a camisole, a cocktail dress, a bolero, a cashmere shrug, a sheer wrap, and a linen tunic.

The player wears a blue shirt, some jeans, a sleeveless shirt, worn white sneakers, some white socks and some boxers.

When play begins:
repeat with first item running through things worn by the player:
repeat with hidden item running through things worn by the player:
if the first item really covers the hidden item, now the hidden item underlies the first item.

[Hi. Just to point out that changing the order in which i mention them doesn’t solve my issue. sadly.]

Some boxers are pairs of underpants.
Some woolly socks and some white socks are a pair of socks.
The worn white sneakers, D’Orsay pumps and the brown leather boots are pairs of shoes.
The skimpy thong, the thong and the boy-shorts are pairs of underpants.
The capris and the jeans are pairs of pants.
The tunic is a shirt.
The sleeveless shirt is a shirt.
The push-up bra, the camisole, the corset, and the plunge bra are foundation garments.
The cocktail dress is a dress.
The thin white nightgown is a dress. The thin white nightgown is transparent.
The blue shirt, bolero, the cashmere shrug, and the sheer wrap are jackets. The shrug and the wrap are transparent.

The description of the thin white nightgown is “It’s basically see-through.”

understand “gown” and “nightie” as nightgown.

Boudoir is a room.[/code][/spoiler]

This seems to be solving the shirt-boxers problem, and if you put the dress on over the boxers you’ll see they cover up as they should. There’s still the blue shirt-dress problem, that if you have the blue shirt on over the dress you can’t see the dress. As I said that would probably have to be solved by refactoring the code so you repeat through body parts and find the outermost item of clothing that swaddles that part.

(Aside: Disambiguating the blue shirt and sleeveless shirt is annoying.)

One thing is that I wound up writing a phrase (“really covers”) for the condition that gets checked in When play begins and Carry out wearing. That way I can change it in one place without worrying about keeping them in sync–I wound up with a hard-to-track bug when I changed the When play begins condition in the wrong way.

i was almost considering scrapping the whole mechanic but now i’d feel guilty because you’ve already put in so much work. D:

matt w’s final solution is pretty similar to what I would have come up with. Just to test extreme cases, you should add the biohazard suit (which overlies everything else and swaddles every body part). I’m sure you can come up with a reason your game needs to include a biohazard suit!

Oh, go ahead and scrap it. I enjoy tinkering around with this stuff for its own sake.

Anyway, here’s the new try, which lets you see the dress under the shirt:

[spoiler][code]Section clothing

A garment-element is a kind of thing.

The switchblade is a thing. The switchblade can be open.
The satchel is a thing.

A body-part is a kind of garment-element. A torso, a seat, a head, a neck, pair of legs, and pair of feet are kinds of body-part.

One head is part of every person. One torso is part of every person. One pair of legs is part of every person. One pair of feet is part of every person. One seat is part of every person. One neck is part of every person.

A garment is a kind of garment-element. A garment can be transparent. A pair of pants, a pair of underpants, a foundation garment, a pair of socks, a pair of shoes, a jacket, a hat, a dress, neckwear, bril, and a shirt are kinds of garment.

The plural of pair of pants is pairs of pants. The plural of pair of underpants is pairs of underpants. The plural of pair of socks is pairs of socks. The plural of pair of shoes is pairs of shoes.

A pair of pants, a pair of underpants, a foundation garment, a pair of socks, a pair of shoes, a jacket, a hat, a dress, neckwear, bril, and a shirt are usually wearable.

Underlying relates various garment-elements to various garment-elements with fast route-finding. The verb to underlie means the underlying relation. The verb to be under implies the underlying relation.

Check taking off:
if the noun underlies something (called the impediment) which is worn by the player, say “[The impediment] [are] in the way.” instead.

Carry out taking off:
now the noun is not underlaid by anything.

Report taking off something:
say “[clothes-description of the player]” instead.

Definition: a garment-element is uppermost if it is not under something opaque.

Before taking off something which underlies something which is worn by the player:
while the noun underlies something (called the impediment) which is worn by the player:
say “(first removing [the impediment])[command clarification break]”;
silently try taking off the impediment;
if the noun underlies the impediment, stop the action.

Overlying relates various garment-elements to various garment-elements. The verb to overlie means the overlying relation.

Covering relates a garment-element (called A) to a garment-element (called B) when the number of steps via the overlying relation from A to B is greater than 0 and A and B clash. The verb to cover means the covering relation.

Swaddling relates various garment-elements to various garment-elements. The verb to swaddle means the swaddling relation.

To decide whether (A - a garment-element) and (B - a garment-element) clash:
repeat with limb running through body-parts that are swaddled by A:
if B swaddles limb, yes;
no.

To decide whether (A - a garment-element) really covers (B - a garment-element):
if A covers B and A and B clash, yes;
no.

Before wearing something when a garment which covers the noun is worn by the player:
while the player wears a garment (called the impediment) which covers the noun:
say “(first removing [the impediment])[command clarification break]”;
silently try taking off the impediment;
if the player is wearing the impediment, stop the action.

Carry out wearing:
repeat with hidden item running through things worn by the player:
if the noun really covers the hidden item, now the hidden item underlies the noun.

Instead of looking under something which is worn by the player:
if something (called the underwear) underlies the noun, say “[We] [peek] at [the underwear]. Yup, still there.”;
otherwise say “Just [us] in there.”

[
Instead of taking inventory:
say "
[if the player carries something][We]['re] carrying [a list of things carried by the player][else][We]['re] empty-handed[end if][if the player wears the satchel][if the player carries something] and [else] but [end if] you have your trusty satchel with you[end if][if the player wears something that is not the satchel]. [We] [are] wearing [a list of uppermost garments worn by the player][end if]."
]

Instead of taking inventory:
say "[We]['re] ";
if the player carries something:
if the player carries the switchblade:
if the switchblade is open:
say “wielding your trusty switchblade”;
otherwise:
say “holding your trusty switchblade in one hand, safely folded up and closed,”;
otherwise:
say “carrying [a list of things carried by the player][no line break]”;
otherwise:
say “empty-handed[no line break]”;
if the player wears the satchel:
if the player carries something:
say " and ";
otherwise:
say " but ";
say “you have your trusty satchel with you[no line break]”;
if the player wears something that is not the satchel:
say “. [clothes-description of the player]”;
otherwise:
say “.”;
if the player wears the satchel:
try examining the satchel;
let x be the number of things in the satchel;
if x is greater than 10:
say “Wow. You’re hauling around a ton of crap.”;

To peek is a verb.

Before wearing something:
let N be the layering depth of the noun;
repeat with item running through things worn by the player:
if the layering depth of the item is N and the item covers a body-part which is covered by the noun:
say “(first taking off [the item])[command clarification break]”;
silently try taking off the item;
if the player wears the item, stop the action.

To decide what number is the layering depth of (chosen garment - a thing):
let N be 0;
if the chosen garment covers a body-part (called base):
let N be the number of steps via the overlying relation from the chosen garment to the base;
decide on N.

When play begins:
now every pair of socks overlies every pair of feet;
now every pair of socks swaddles every pair of feet;
now every pair of shoes overlies every pair of socks;
now every pair of shoes swaddles every pair of feet;
now every pair of underpants overlies every seat;
now every pair of underpants swaddles every seat;
now every pair of pants overlies every pair of underpants;
now every pair of pants swaddles every seat;
now every pair of pants swaddles every pair of legs;
now every foundation garment overlies every torso;
now every foundation garment swaddles every torso;
now every jacket overlies every shirt;
now every jacket swaddles every torso;
now every jacket overlies every dress;
now every hat overlies every head;
now every hat swaddles every head;
now every dress overlies every pair of underpants;
now every dress overlies every foundation garment;
now every dress swaddles every seat;
now every dress swaddles every torso;
now every neckwear overlies every neck;
now every neckwear swaddles every neck;
now every shirt overlies every torso;
now every shirt swaddles every torso;

Instead of taking off a pair of pants in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a pair of underpants in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a foundation garment in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a dress in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

Instead of taking off a shirt in the presence of people who are not the player :
say “You do not wish to upset [list of visible people who are not the player].”

There are worn white sneakers, some white socks, some capris, some jeans, a corset, a plunge bra, a thong, boy-shorts, black satin D’Orsay pumps, brown leather boots, a camisole, a cocktail dress, a bolero, a cashmere shrug, a sheer wrap, and a linen tunic.

The player wears a blue shirt, some jeans, a sleeveless shirt, worn white sneakers, some white socks and some boxers.

When play begins:
repeat with first item running through things worn by the player:
repeat with hidden item running through things worn by the player:
if the first item really covers the hidden item, now the hidden item underlies the first item.

To decide which object is the outermost covering of (limb - a body-part):
let owner be a random person incorporating limb;
repeat with test item running through (garments worn by owner) that swaddle limb:
if test item underlies a garment that swaddles limb:
next;
decide on test item;
decide on nothing.

To say clothes-description of the player:
let clothes-list be a list of things;
repeat with limb running through body-parts incorporated by the player:
if the outermost covering of the limb is not nothing:
add the outermost covering of the limb to the clothes-list, if absent;
if clothes-list is empty:
say “[We] [are] wearing [our] birthday suit.”;
otherwise:
say “[We] [are] wearing [clothes-list with indefinite articles].”

[Hi. Just to point out that changing the order in which i mention them doesn’t solve my issue. sadly.]

Some boxers are pairs of underpants.
Some woolly socks and some white socks are a pair of socks.
The worn white sneakers, D’Orsay pumps and the brown leather boots are pairs of shoes.
The skimpy thong, the thong and the boy-shorts are pairs of underpants.
The capris and the jeans are pairs of pants.
The tunic is a shirt.
The sleeveless shirt is a shirt.
The push-up bra, the camisole, the corset, and the plunge bra are foundation garments.
The cocktail dress is a dress.
The thin white nightgown is a dress. The thin white nightgown is transparent.
The blue shirt, bolero, the cashmere shrug, and the sheer wrap are jackets. The shrug and the wrap are transparent.

The description of the thin white nightgown is “It’s basically see-through.”

understand “gown” and “nightie” as nightgown.

Boudoir is a room.[/code][/spoiler]

And some output:

(I guess it’s OK that you can take the jeans off from under the dress, if you’re going to wear jeans under a short dress anyway.)

This doesn’t allow for transparent clothes, though. To do that I’d have to, hmm, maybe change the “outermost covering” definition to yield a list of clothes, and have it be everything that covers that body-part and doesn’t underlie something opaque that covers the same body-part.

Anyway, it’s finicky. Definitely scrap it if it’s not essential to the experience.

A biohazard suit would ruin the story. o.o i don’t see how I could use something like that. I can’t explain that without spoilers.