§13.10. Defining new prepositions

The term preposition is used here, a little loosely, to mean anything which we add to the verb to be in order to talk about some relation or other. We have seen many examples already, such as:

To be in - The ball is in the box.
To be part of - The lever is part of the slot machine.

These are defined just the way verbs are. Compare the following:

Suspicion relates various people to one person.

The verb to suspect means the suspicion relation.

The verb to be suspicious of means the suspicion relation.

The result of this is that

Hercule Poirot suspects Colonel Hotchkiss.
Hercule Poirot is suspicious of Colonel Hotchkiss.

are exactly equivalent, and so are these two descriptions:

somebody who suspects Colonel Hotchkiss
somebody suspicious of Colonel Hotchkiss

While most prepositions are short ("in", "part of", "suspicious of"), they're free to be longer if need be ("inordinately far away from"): the limit is 30 words, which should be ample.

We can also define verbs as auxiliaries, like so:

The verb to be able to approach means the approachability relation.

Now we can ask if Poirot "can approach" Hotchkiss, and so on.


arrow-up.pngStart of Chapter 13: Relations
arrow-left.pngBack to §13.9. Defining new assertion verbs
arrow-right.pngOnward to §13.11. Indirect relations

*ExampleSwerve left? Swerve right? Or think about it and die?
Building a marble chute track in which a dropped marble will automatically roll downhill.

*ExampleBeneath the Surface
An "underlying" relation which adds to the world model the idea of objects hidden under other objects.

*ExampleThe Abolition of Love
A thorough exploration of all the kinds of relations established so far, with the syntax to set and unset them.

We have two things to keep track of with our layering clothing: what currently is covering something else; and what can cover something else. This implementation goes for a fairly simple treatment, assuming that each item of clothing will completely conceal those beneath it, and that we are not implementing entire sets of shirts, jackets, etc. But it will do for a demonstration.

paste.png "Bogart"

Section 1 - Clothing Behavior

First we make our relation to represent what *is* underneath another item:

Underlying relates one thing to various things. The verb to underlie means the underlying relation. The verb to be under implies the underlying relation.

And now we prevent taking a lower layer off before the thing that is worn over it:

Before taking off something which 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 something which is worn by the player, stop the action.

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 thing is uppermost if it is not under something.

That covers order of clothing removal, but we also want to restrict what can be worn on top of what else. This time we need Inform to have some idea of what customarily can be layered on top of what other clothing:

Overlying relates one thing to various things. The verb to overlie means 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 means the covering relation.

With these definitions, we can say that a jacket should go over a shirt and a shirt over an undershirt (say), and then Inform will know that a jacket will cover both shirt and undershirt.

Before wearing something when something (called the impediment) which covers the noun is worn by the player:
    while the player wears something 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:
    if the noun covers something (called the hidden item) worn by the player, 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 something]. [We] [are] wearing [a list of uppermost things worn by the player][end if]."

To peek is a verb.

Notice that our inventory only describes the things that the player can see as the upper layer of clothing.

Section 2 - The Scenario

The Trailer is a room. "A full-length mirror is the main amenity in here, and that suits you just fine." The full-length mirror is scenery in the Trailer. Instead of examining or searching the mirror, try taking inventory.

The player wears a fedora, a jacket, a shirt, some undershorts, an undershirt, some slacks, a pair of socks, and a pair of shoes.

The shirt underlies the jacket. The pair of socks underlies the pair of shoes. The undershorts underlie the slacks. The undershirt underlies the shirt.

The jacket overlies the shirt. The shoes overlie the socks. The slacks overlie the undershorts. The shirt overlies the undershirt.

Test me with "x mirror / remove fedora / remove jacket / remove shirt / remove slacks / remove undershirt / remove shoes / remove socks / remove shorts / remove undershorts".

If we further wanted to prevent the player from taking off clothes in inappropriate places, we might add something like this:

Instead of taking off something in the presence of someone who is not the player:
    say "[We] [are] far too modest to strip in public."

***ExampleBogart
Clothing for the player that layers, so that items cannot be taken off in the wrong order, and the player's inventory lists only the clothing that is currently visible.

We have two things to keep track of with our layering clothing: what currently is covering something else; and what can cover something else. This implementation goes for a fairly simple treatment, assuming that each item of clothing will completely conceal those beneath it, and that we are not implementing entire sets of shirts, jackets, etc. But it will do for a demonstration.

paste.png "Bogart"

Section 1 - Clothing Behavior

First we make our relation to represent what *is* underneath another item:

Underlying relates one thing to various things. The verb to underlie means the underlying relation. The verb to be under implies the underlying relation.

And now we prevent taking a lower layer off before the thing that is worn over it:

Before taking off something which 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 something which is worn by the player, stop the action.

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 thing is uppermost if it is not under something.

That covers order of clothing removal, but we also want to restrict what can be worn on top of what else. This time we need Inform to have some idea of what customarily can be layered on top of what other clothing:

Overlying relates one thing to various things. The verb to overlie means 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 means the covering relation.

With these definitions, we can say that a jacket should go over a shirt and a shirt over an undershirt (say), and then Inform will know that a jacket will cover both shirt and undershirt.

Before wearing something when something (called the impediment) which covers the noun is worn by the player:
    while the player wears something 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:
    if the noun covers something (called the hidden item) worn by the player, 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 something]. [We] [are] wearing [a list of uppermost things worn by the player][end if]."

To peek is a verb.

Notice that our inventory only describes the things that the player can see as the upper layer of clothing.

Section 2 - The Scenario

The Trailer is a room. "A full-length mirror is the main amenity in here, and that suits you just fine." The full-length mirror is scenery in the Trailer. Instead of examining or searching the mirror, try taking inventory.

The player wears a fedora, a jacket, a shirt, some undershorts, an undershirt, some slacks, a pair of socks, and a pair of shoes.

The shirt underlies the jacket. The pair of socks underlies the pair of shoes. The undershorts underlie the slacks. The undershirt underlies the shirt.

The jacket overlies the shirt. The shoes overlie the socks. The slacks overlie the undershorts. The shirt overlies the undershirt.

Test me with "x mirror / remove fedora / remove jacket / remove shirt / remove slacks / remove undershirt / remove shoes / remove socks / remove shorts / remove undershorts".

If we further wanted to prevent the player from taking off clothes in inappropriate places, we might add something like this:

Instead of taking off something in the presence of someone who is not the player:
    say "[We] [are] far too modest to strip in public."

We have two things to keep track of with our layering clothing: what currently is covering something else; and what can cover something else. This implementation goes for a fairly simple treatment, assuming that each item of clothing will completely conceal those beneath it, and that we are not implementing entire sets of shirts, jackets, etc. But it will do for a demonstration.

paste.png "Bogart"

Section 1 - Clothing Behavior

First we make our relation to represent what *is* underneath another item:

Underlying relates one thing to various things. The verb to underlie means the underlying relation. The verb to be under implies the underlying relation.

And now we prevent taking a lower layer off before the thing that is worn over it:

Before taking off something which 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 something which is worn by the player, stop the action.

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 thing is uppermost if it is not under something.

That covers order of clothing removal, but we also want to restrict what can be worn on top of what else. This time we need Inform to have some idea of what customarily can be layered on top of what other clothing:

Overlying relates one thing to various things. The verb to overlie means 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 means the covering relation.

With these definitions, we can say that a jacket should go over a shirt and a shirt over an undershirt (say), and then Inform will know that a jacket will cover both shirt and undershirt.

Before wearing something when something (called the impediment) which covers the noun is worn by the player:
    while the player wears something 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:
    if the noun covers something (called the hidden item) worn by the player, 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 something]. [We] [are] wearing [a list of uppermost things worn by the player][end if]."

To peek is a verb.

Notice that our inventory only describes the things that the player can see as the upper layer of clothing.

Section 2 - The Scenario

The Trailer is a room. "A full-length mirror is the main amenity in here, and that suits you just fine." The full-length mirror is scenery in the Trailer. Instead of examining or searching the mirror, try taking inventory.

The player wears a fedora, a jacket, a shirt, some undershorts, an undershirt, some slacks, a pair of socks, and a pair of shoes.

The shirt underlies the jacket. The pair of socks underlies the pair of shoes. The undershorts underlie the slacks. The undershirt underlies the shirt.

The jacket overlies the shirt. The shoes overlie the socks. The slacks overlie the undershorts. The shirt overlies the undershirt.

Test me with "x mirror / remove fedora / remove jacket / remove shirt / remove slacks / remove undershirt / remove shoes / remove socks / remove shorts / remove undershorts".

If we further wanted to prevent the player from taking off clothes in inappropriate places, we might add something like this:

Instead of taking off something in the presence of someone who is not the player:
    say "[We] [are] far too modest to strip in public."