Clothes formations that don't make sense

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.