"What Not To Wear"
Section 1 - Overlying and Underlying
We start by borrowing some of the same ideas from the Bogart example.
Underlying relates various thing to various things. The verb to underlie (it underlies, they underlie, it is underlying, it is underlaid) implies 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] is in the way." instead.
Carry out taking off:
now the noun is not underlaid by anything.
Report taking off something:
say "You are now wearing [a list of uppermost things worn by the player]." instead.
Definition: a thing is uppermost if it is not under something opaque.
Here we've expanded on the previous ideas of 'uppermost' because it is possible for an upper layer to reveal what lies beneath: a tie, a clear plastic trenchcoat, an open-knit sweater, etc. We'll make such items transparent.
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
begin;
say "(first removing [the impediment])[command clarification break]";
silently try taking off the impediment;
if the noun underlies the impediment, stop the action;
end while;
Overlying relates various things to various things. The verb to overlie (it overlies, they overlie, it is overlying) implies the overlying relation.
Covering relates a thing (called A) to a thing (called B) when the number of steps via the overlying relation from A to B is greater than 0. The verb to cover (it covers, they cover, it is covering, it is covered) implies the covering relation.
Before wearing something when something which covers the noun is worn by the player:
while the player wears something (called the impediment) which covers the noun
begin;
say "(first removing [the impediment])[command clarification break]";
silently try taking off the impediment;
if the player is wearing the impediment, stop the action;
end while.
Carry out wearing:
repeat with hidden item running through things worn by the player
begin;
if the noun covers the hidden item, now the hidden item underlies the noun;
end repeat.
Instead of looking under something which is worn by the player:
if something (called the underwear) underlies the noun, say "You peek at [the underwear]. Yup, still there.";
otherwise say "Just you in there."
Instead of taking inventory:
say "You're carrying [a list of things carried by the player][if the player wears something]. You are wearing [a list of uppermost things worn by the player][end if]."
Section 2 - Regional Coverage
Here we draw in the idea that different clothes go over different areas of the body, and that they should be in competition with each other only if both sets of clothes belong at the same level over the same body area.
Before wearing something:
let N be the layering depth of the noun;
repeat with item running through things worn by the player
begin;
if the layering depth of the item is N and the item covers a body-part which is covered by the noun
begin;
say "(first taking off [the item])[command clarification break]";
silently try taking off the item;
if the player wears the item, stop the action;
end if;
end repeat.
This may seem like overkill, but it allows us to create garments that cover different subsets of the body -- pants and shirt vs. a dress, for instance.
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)
begin;
let N be the number of steps via the overlying relation from the chosen garment to the base;
end if;
decide on N.
To help with modeling, we'll give everyone body parts, broken down according to their relevance to clothing:
A body-part is a kind of thing. A torso, a seat, a head, pair of legs, and pair of feet are kinds of body-part.
If we wanted to allow gloves, we might put in hands as well; but this is enough for now.
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.
And now we make some categories of clothing:
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, and a shirt are kinds of thing.
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, and a shirt are usually wearable.
It would be nice to be able to say "now every pair of socks overlies every pair of feet", but this involves too many implicit loops for Inform to deal with at once; so we are forced on a somewhat less elegant solution:
When play begins:
repeat with item running through pairs of socks
begin;
now item overlies every pair of feet;
end repeat;
repeat with item running through pairs of shoes
begin;
now item overlies every pair of socks;
end repeat;
repeat with item running through pairs of underpants
begin;
now item overlies every seat;
end repeat;
repeat with item running through pairs of pants
begin;
now item overlies every pair of underpants;
end repeat;
repeat with item running through foundation garments
begin;
now item overlies every torso;
end repeat;
repeat with item running through shirts
begin;
now item overlies every foundation garment;
end repeat;
repeat with item running through jackets
begin;
now item overlies every shirt;
now item overlies every dress;
end repeat;
repeat with item running through hats
begin;
now item overlies every head;
end repeat;
repeat with item running through dresses
begin;
now item overlies every foundation garment;
now item overlies every pair of underpants;
end repeat;
Section 2 - The Scenario
The Dressing Room is a room.
The player carries 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 woolly socks are a pair of socks.
The D'Orsay pumps and the brown leather boots are pairs of shoes.
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 camisole, the corset, and the plunge bra are foundation garments.
The cocktail dress is a dress.
The bolero, the cashmere shrug, and the sheer wrap are jackets. The shrug and the wrap are transparent.
Test me with "wear capris / wear jeans / i / wear thong / i / wear dress / wear corset / wear dress / i / wear wrap / i / wear boots / wear pumps / i".
|