Inform 7 Home Page / Documentation
§14.9. Verbs as values
Each verb known to Inform is actually a value of the kind "verb". To refer to a verb as a value, we have to put the word "verb" in front, as in these examples:
the verb contain, the verb might, the verb provoke
all of which appear in the Standard Rules.
Two adjectives are provided for use with verbs: "modal" (or "non-modal") to pick out verbs like might, could, should, and so on; and "meaningful" (or "meaningless") to pick out verbs which have a defined meaning as an Inform relation. For example, in the Standard Rules, the verb contain is meaningful, the verb might is modal, and the verb provoke is meaningless.
If V has a meaning as a relation of objects, then "meaning of V" produces that relation. For example,
showme the meaning of the verb contain;
showme the meaning of the verb provoke;
produces:
"meaning of the verb contain" = relation of objects: containment relation
"meaning of the verb provoke" = relation of objects: equality relation
As this demonstrates, if a verb has no meaning, or its meaning doesn't relate to objects, we get just the equality relation.
In fact, Inform even defines a verb "to mean": it's meaningful, and its meaning is the meaning relation. Thus:
if the verb mean means the meaning relation...
is true. More usefully, we can search our vocabulary like this:
the list of verbs meaning the containment relation
which, unless any non-Standard Rules definitions have been added, produces:
list of verbs: {verb contain}
Note that the meaning relation can't be changed at run-time: it is not clear what it would even mean to do something like -
now the verb contain means the wearing relation;
with the story already started, so this will produce a problem message.
say "[adapt (verb)]"
Adapts the given verb to the current story tense and story viewpoint. For example, "you [adapt the verb provoke]" might produce "you provoke".
say "[adapt (verb) from (narrative viewpoint)]"
Adapts the given verb to the current story tense but the given viewpoint. For example, "he [adapt the verb provoke from the third person singular]" might produce "he provokes".
say "[adapt (verb) in (grammatical tense)]"
Adapts the given verb to the given tense but the current story viewpoint. For example, "you [adapt the verb provoke in the past tense]" might produce "you provoked".
say "[adapt (verb) in (grammatical tense) from (narrative viewpoint)]"
Adapts the given verb to the given tense and viewpoint. For example, "we [adapt the verb provoke in the future tense from the first person plural]" might produce "we will provoke".
say "[negate (verb)]"
Adapts the given verb to the current story tense and story viewpoint, giving it a negative sense. For example, "you [negate the verb provoke]" might produce "you do not provoke".
say "[negate (verb) from (narrative viewpoint)]"
Adapts the given verb to the current story tense but the given viewpoint, giving it a negative sense. For example, "he [negate the verb provoke from the third person singular]" might produce "he does not provoke".
say "[negate (verb) in (grammatical tense)]"
Adapts the given verb to the given tense but the current story viewpoint, giving it a negative sense. For example, "you [negate the verb provoke in the past tense]" might produce "you did not provoke".
say "[negate (verb) in (grammatical tense) from (narrative viewpoint)]"
Adapts the given verb to the given tense and viewpoint, giving it a negative sense. For example, "we [negate the verb provoke in the future tense from the first person plural]" might produce "we will not provoke".
Note that the verb doesn't have to be named explicitly for use by the adapt or negate phrases, so for example:
To decide which text is the rendering of (V - verb) (this is my rendering):
decide on "[negate V in the past perfect tense]".
When play begins:
showme my rendering applied to the list of meaningful verbs.
produces:
"my rendering applied to the list of meaningful verbs" = list of texts: {"had not had", "had not related", "had not meant", "had not provided", "had not contained", "had not supported", "had not incorporated", "had not enclosed", "had not carried", "had not held", "had not worn", "had not been able to see", "had not been able to touch", "had not concealed", "had not unlocked"}
Lastly, we can get at three other useful parts of a verb, too. These aren't adaptive, of course: a verb only has one infinitive form.
say "[infinitive of (verb)]"
Produces the infinitive of the given verb. Note that this is without a "to": for example, "[infinitive of the verb carry]" is "carry", not "to carry".
say "[past participle of (verb)]"
Produces the past participle of the given verb. For example, "[past participle of the verb carry]" is "carried". Warning: because modal verbs like "should" or "might" are defective in English, this will produce odd results on them - "shoulded" and "mighted", for example.
say "[present participle of (verb)]"
Produces the present participle of the given verb. For example, "[present participle of the verb carry]" is "carrying". Warning: because modal verbs like "should" or "might" are defective in English, this will produce odd results on them - "shoulding and "mighting", for example.
|
ExampleHistory Lab
We create phrases such as "the box we took" and "the newspaper Clark looked at" based on what has already happened in the story.
|
|
The examples Variety and Narrative Register show how verbs can be associated with particular actions. Here, we use the same principle so that we can report to the player what was last done to a particular object, either by the player or by someone else.
To do this, we need to use the idea of stored actions from the Advanced Actions chapter.
"History Lab"
Section 1 - Procedure
An object has an action called the last action.
Describing relates various verbs to various action names. The verb to describe means the describing relation.
To take is a verb. The verb take describes the taking action.
To drop is a verb. The verb drop describes the dropping action.
To look at is a verb. The verb look at describes the examining action.
To examine is a verb. The verb examine describes the examining action.
After an actor doing something to something:
if a verb describes the action name part of the current action:
now the indefinite article of the noun is "the";
now the last action of the noun is the current action;
continue the action.
After printing the name of something (called item):
if the last action of the item is not waiting and the last action of the item is not the current action:
let chosen action-name be the action name part of the last action of the item;
let chosen actor be the actor part of the the last action of the item;
if a verb describes the chosen action-name:
let the chosen verb be a random verb that describes the chosen action-name;
say " [if the chosen actor is the player][we][else][chosen actor][end if] [adapt chosen verb in past tense]";
Section 2 - Scenario
Lab is a room. It contains a box. The box contains a newspaper. Clark is a man in the Lab.
A persuasion rule:
persuasion succeeds.
Test me with "x box / look / x newspaper / look / clark, x newspaper / clark, get box / clark, drop box / look / take box / i / smell box / i".
Notice that smelling the box does not change the box's description because we haven't gotten around to defining a smell or sniff verb.
|
ExampleRelevant Relations
An example of how to create room descriptions that acknowledge particular relations using their assigned verbs, rather than by the heavily special-cased code used by the standard library.
|
|
Suppose that we wanted authors to be able to indicate which relations should or should not be included in room descriptions, and have the system dynamically honor that instruction.
Inform already knows about verbs for describing supporting, containment, carrying, and wearing, so we could write a set of instructions to handle such cases. To do this, we're using the "writing a paragraph about" activity, which is described in the chapter on activities.
The following uses what is, strictly speaking, a piece of internal machinery not really intended for public use: a variable called "prior named object" which keeps track of what noun other words should agree with. It is not safe to use this variable except to clear it: "now the prior named object is nothing". In a few situations, this prevents glitches in adaptive text.
"Relevant Relations"
Section 1 - Procedure
Rule for writing a paragraph about something (called item):
now the current paragraph is { };
say "[one of][regarding item]There [are] [an item] here[or][We] [can see] [an item] here[at random]. [run paragraph on]";
follow the descriptive rules for the item;
repeat with new item running through the current paragraph:
now the prior named object is nothing;
if new item is not the item:
follow the descriptive rules for the new item;
say paragraph break.
Rule for writing a paragraph about someone (called chosen person):
now the current paragraph is { };
say "[one of][regarding chosen person][The chosen person] [are] here[or][We] [can see] [a chosen person] here[at random]. [run paragraph on]";
follow the descriptive rules for the chosen person;
repeat with new item running through the current paragraph:
now the prior named object is nothing;
if new item is not the chosen person:
follow the descriptive rules for the new item;
say paragraph break.
The descriptive rules are an object-based rulebook.
Definition: a container is see-through:
if it is transparent:
yes;
if it is open:
yes;
no.
A descriptive rule for a see-through container (called item) (this is the describe contents rule):
describe the containment relation for item.
A descriptive rule for a supporter (called item):
describe the support relation for item.
A descriptive rule for a person (called item):
describe the wearing relation for the item.
A descriptive rule for a person (called item):
describe the carrying relation for the item.
The current paragraph is a list of things that varies.
Before printing the name of something (called mentioned target) while writing a paragraph about something:
add the mentioned target to the current paragraph, if absent.
To describe (R - a relation of objects) for (item - a thing):
if a thing to which item relates by R is a thing:
say "[The item with pronoun] [verb rendering applied to a random verb that means R] [the list of things to which item relates by R with indefinite articles]. [run paragraph on]"
To decide which text is the rendering of (V - verb) (this is verb rendering):
decide on "[adapt V]".
To say (T - a thing) with pronoun:
if T is the prior named object:
say "[regarding T][They]";
else:
say "[The T]"
Section 2 - Scenario
The Space Elevator is a room. "Mercifully, there aren't any windows. The ability to see how far up you are would almost certainly make you ill."
The luggage rack is a supporter in the Space Elevator. The suitcase is a closed openable container on the luggage rack. The bouquet is on the luggage rack.
Clark is a man in the Space Elevator. Clark is carrying a box of cupcakes. Clark is wearing a t-shirt. The description of the box of cupcakes is "They're the latest confection from Red Velvet Planet, the Martian bakery."
Persuasion rule: persuasion succeeds.
We can if we like then add alternate names for these relations that will be randomly swapped in some of the time. For instance:
To sport is a verb. The verb to sport means the wearing relation.
To hold up is a verb. The verb to hold up means the support relation.
Test me with "clark, drop the box / look / clark, take the suitcase / look / clark, get bouquet".
One might, hypothetically, imagine going even further than this and simply designating relations as either "important" or "unimportant" -- perhaps changing the relation's designation at runtime. Relations are not themselves allowed to have properties, however.