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".
Much of what follows is identical to "Lemonade" earlier; the new material begins at Part 2.
"Lakeside Living"
A volume is a kind of value. 15.9 fl oz specifies a volume with parts ounces and tenths (optional, preamble optional).
A fluid container is a kind of container. A fluid container has a volume called a fluid capacity. A fluid container has a volume called current volume.
The fluid capacity of a fluid container is usually 12.0 fl oz. The current volume of a fluid container is usually 0.0 fl oz.
Liquid is a kind of value. The liquids are water, absinthe, and iced tea. A fluid container has a liquid.
Instead of examining a fluid container:
if the noun is empty,
say "You catch just a hint of [the liquid of the noun] at the bottom.";
otherwise
say "[The noun] contains [current volume of the noun in rough terms] of [liquid of the noun]."
To say (amount - a volume) in rough terms:
if the amount is less than 0.5 fl oz:
say "a swallow or two";
otherwise if tenths part of amount is greater than 3 and tenths part of amount is less than 7:
let estimate be ounces part of amount;
say "[estimate in words] or [estimate plus 1 in words] fluid ounces";
otherwise:
if tenths part of amount is greater than 6, increase amount by 1.0 fl oz;
say "about [ounces part of amount in words] fluid ounce[s]".
Before printing the name of a fluid container (called the target) while not drinking or pouring:
if the target is empty:
say "empty ";
otherwise:
do nothing.
After printing the name of a fluid container (called the target) while not examining or pouring:
unless the target is empty:
say " of [liquid of the target]";
omit contents in listing.
Instead of inserting something into a fluid container:
say "[The second noun] has too narrow a mouth to accept anything but liquids."
Definition: a fluid container is empty if the current volume of it is 0.0 fl oz. Definition: a fluid container is full if the current volume of it is the fluid capacity of it.
Understand "drink from [fluid container]" as drinking.
Instead of drinking a fluid container:
if the noun is empty:
say "There is no more [liquid of the noun] within." instead;
otherwise:
decrease the current volume of the noun by 0.2 fl oz;
if the current volume of the noun is less than 0.0 fl oz, now the current volume of the noun is 0.0 fl oz;
say "You take a sip of [the liquid of the noun][if the noun is empty], leaving [the noun] empty[end if]."
Part 2 - Filling
Understand the command "fill" as something new.
Here we want Inform to prefer full liquid sources to other containers when it chooses an end to a player's unfinished or ambiguous command. And so:
Understand "fill [fluid container] with/from [full liquid source]" as filling it with. Understand "fill [fluid container] with/from [fluid container]" as filling it with.
Both grammar lines point to the same ultimate outcome; the purpose of specifying both is to tell Inform to check thoroughly for full liquid sources before falling back on other fluid containers when making its decisions.
Understand "fill [something] with/from [something]" as filling it with.
Filling it with is an action applying to two things. Carry out filling it with: try pouring the second noun into the noun instead.
Understand "pour [fluid container] in/into/on/onto [fluid container]" as pouring it into. Understand "empty [fluid container] into [fluid container]" as pouring it into.
Understand "pour [something] in/into/on/onto [something]" as pouring it into. Understand "empty [something] into [something]" as pouring it into.
Pouring it into is an action applying to two things.
Check pouring it into:
if the noun is not a fluid container, say "You can't pour [the noun]." instead;
if the second noun is not a fluid container, say "You can't pour liquids into [the second noun]." instead;
if the noun is the second noun, say "You can hardly pour [the noun] into itself." instead;
if the liquid of the noun is not the liquid of the second noun:
if the second noun is empty, now the liquid of the second noun is the liquid of the noun;
otherwise say "Mixing [the liquid of the noun] with [the liquid of the second noun] would give unsavory results." instead;
if the noun is empty, say "No more [liquid of the noun] remains in [the noun]." instead;
if the second noun is full, say "[The second noun] cannot contain any more than it already holds." instead.
Carry out pouring it into:
let available capacity be the fluid capacity of the second noun minus the current volume of the second noun;
if the available capacity is greater than the current volume of the noun, now the available capacity is the current volume of the noun;
increase the current volume of the second noun by available capacity;
decrease the current volume of the noun by available capacity.
Report pouring it into:
say "[if the noun is empty][The noun] is now empty;[otherwise][The noun] now contains [current volume of the noun in rough terms] of [liquid of the noun]; [end if]";
say "[the second noun] contains [current volume of the second noun in rough terms] of [liquid of the second noun][if the second noun is full], and is now full[end if]."
Understand the liquid property as describing a fluid container. Understand "of" as a fluid container.
And now we add our liquid source kind, which will represent lakes, absinthe fountains, and any other infinite supplies of liquid we might need. Note that 3276.7 is the largest possible number of fluid ounces available to us.
A liquid source is a kind of fluid container. A liquid source has a liquid. A liquid source is usually scenery. The fluid capacity of a liquid source is usually 3276.7 fl oz. The current volume of a liquid source is usually 3276.7 fl oz. Instead of examining a liquid source: say "[The noun] is full of [liquid of the noun]."
Carry out pouring a liquid source into something: now the current volume of the noun is 3276.7 fl oz.
We want filling things from liquid sources to work the same way as usual, with the distinction that a) the liquid source never depletes in quantity (hence the carry-out rule resetting its fullness); and b) we should report the results a bit differently as well:
After pouring a liquid source into a fluid container:
say "You fill [the second noun] up with [liquid of the noun] from [the noun]."
On the other hand, pouring liquids into a liquid source needs to work completely differently from pouring liquids into anything else. Let's say we're going to allow any liquid at all to be dumped into rivers and streams (environmental protections evidently are not very well-enforced in this scenario):
Instead of pouring a fluid container into a liquid source:
if the noun is empty, say "[The noun] is already empty." instead;
now the current volume of the noun is 0.0 fl oz;
say "You dump out [the noun] into [the second noun]."
A couple of minor refinements:
Swimming is an action applying to nothing. Understand "swim" or "dive" as swimming.
Instead of swimming in the presence of a liquid source:
say "You don't feel like a dip just now."
Before inserting something into a liquid source: say "[The noun] would get lost and never be seen again." instead.
Part 3 - Scenario
The Lakeside is a room. The Lakeside swing is an enterable supporter in the Lakeside. "Here you are by the lake, enjoying a summery view."
The glass is a fluid container carried by the player. The liquid of the glass is absinthe. The current volume of the glass is 0.8 fl oz.
The pitcher is a fluid container in the Lakeside. The fluid capacity of the pitcher is 32.0 fl oz. The current volume of the pitcher is 20.0 fl oz. The liquid of the pitcher is absinthe.
The lake is a liquid source. It is in the Lakeside.
The player wears a bathing outfit. The description of the bathing outfit is "Stylishly striped in blue and white, and daringly cut to reveal almost all of your calves, and quite a bit of upper arm, as well. You had a moral struggle, purchasing it; but mercifully the lakeshore is sufficiently secluded that no one can see you in this immodest apparel."
Instead of taking off the outfit: say "What odd ideas come into your head sometimes!"
Test me with "fill glass / empty absinthe into lake / fill glass / swim / drink lake / drink / x water / x lake".