A person can wear any (portable) thing which has the "wearable" property. (This property seldom needs to be quoted because it is deduced automatically from sentences like "Trevor wears a red hat.")
In most traditional IF, clothing is only used when it is exceptional in some way. That is, we ignore the three to eight different garments most people are wearing at any given time - the everyday clothes which people wear without thinking about them - and only simulate the unexpected extras: a borrowed jaunty red hat, a radiation-proof space suit, and so on.
These unusual garments turn up only occasionally in play and usually one at a time, so Inform does not normally provide rules to restrict how much or little is worn, or in what unlikely combinations. Get Me to the Church on Time categorises clothing by body area (trousers for lower body, shirts for upper); Bogart by layer, distinguishing underwear from outer garments. What Not To Wear combines both into a general-purpose system adequate for most kinds of clothing situations.
See Kitchen and Bathroom for a simple mirror implementation, which could be adapted to reflect what the player is currently wearing
Hayes Code is a somewhat stripped down version.
Clothes are normally single things which have no function other than display and concealment, but Being Prepared gives them pockets which act as containers, and Some Assembly Required allows clothes to be stitched together from pieces of cloth.
|  Example What Not To Wear A general-purpose clothing system that handles a variety of different clothing items layered in different combinations over different areas of the body. | |
We now have the mechanisms in place to do some fairly sophisticated renaming of objects. For instance:
"Some Assembly Required"
Garment type is a kind of value. The garment types are vest, t-shirt, polo shirt, mandarin blouse, button-down, shell, experiment.
Every turn:
assign identities.
When play begins: assign identities.
To assign identities:
repeat with item running through torsos:
reassess item.
To reassess (item - a torso):
if the number of things which are part of the item is 0:
now garment type of the item is vest;
rule succeeds;
if exactly two short sleeves are part of the item:
if a collar is part of the item,
now garment type of the item is polo shirt;
otherwise now garment type of the item is t-shirt;
rule succeeds;
if exactly two long sleeves are part of the item:
if a collar is part of the item,
now garment type of the item is button-down;
otherwise now garment type of the item is mandarin blouse;
rule succeeds;
if a collar is part of the item and the number of sleeves which are part of the item is 0, now garment type of the item is shell;
otherwise now garment type of the item is experiment.
Before cutting something which is worn by the player:
try taking off the noun.
Instead of cutting something when something is part of the noun:
say "You cut up [the noun], snipping off [a list of things which are part of the noun].";
now every thing which is part of the noun is in the holder of the noun.
Instead of cutting something which is part of something:
say "You carefully snip [the noun] free.";
now the player carries the noun.
Rule for printing the name of a torso: say "[garment type]".
A torso is a kind of thing. A torso is always wearable. Understand "shirt" or "blouse" as a torso. A torso has a garment type. Understand the garment type property as describing a torso. A sleeve is a kind of thing. A short sleeve is a kind of sleeve. A long sleeve is a kind of sleeve. A collar is a kind of thing.
Understand "sew [something] to [something]" as affixing it to. Affixing it to is an action applying to two things. Carry out affixing something to something: now the noun is part of the second noun. Report affixing something to something: assign identities; say "You sew [the noun] on, creating [a second noun]." Understand the command "stitch" as "sew".
Instead of affixing something to something when the second noun is worn: say "You're wearing [the second noun]!"
Instead of affixing a torso to something:
if the second noun is a torso, say "Couture for Siamese twins is a daring field, but a bit of a niche market.";
otherwise try affixing the second noun to the noun.
Instead of affixing a sleeve to something when at least two sleeves are part of the second noun: say "[The second noun] already sports [a list of sleeves that are part of the second noun]."
Instead of affixing a collar to something when a collar is part of the second noun: say "[The second noun] already sports [a list of collars that are part of the second noun]."
Instead of examining something when something is part of the noun: say "Stitched to [the noun] [is-are a list of things which are part of the noun]."
Here is where the issue of precedence arises. We want to encourage Inform to select a cuttable object that is part of something else, rather than one of the spares:
Definition: a thing is removable if it is part of something. Understand "cut [removable thing]" as cutting.
The Boutique is a room. "Still festively strewn with the confetti and streamers of the Grand Opening party, and still almost totally customer-free."
The player carries a torso. The player carries three short sleeves. The player carries two long sleeves. The player carries two collars.
Test me with "sew collar to shirt / i / sew short sleeve to shirt / g / i / x polo shirt / cut collar / i / cut shirt / sew long sleeve to shirt / i / sew long sleeve to shirt / i / sew collar to shirt / g / i / wear button-down".
|