A.L.O.N.E. — 8 of 25

Kris Harris

Release 1

Chapter 2 - What Not To Wear

Section 1 - Overlying and Underlying

[We start by borrowing some of the same ideas from the Bogart example, but we're also going to make a kind called "garment-element". This kind will include both garments (objects of clothing) and body parts (things that can be covered by clothing); using it allows us to restrict the way our underlying and overlying relations apply, which will make them a bit faster at run-time.]

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 (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; silently try dropping the noun.

Report taking off something:

say "You take off [the noun] and toss it on the floor. You 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.

[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:

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 (it overlies, they overlie, it is overlying) implies 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 (it covers, they cover, it is covering, it is covered) implies 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 "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 garments worn by the player][end if]."