Automated Verb Phrases
version 1/110416 by Ron Newcomb
- Example: * Poster Shopping - Replace Inform's default responses with tailored ones for a much-improved player experience.
- Example: ** We Said, Zie Said - "Creating new pronouns is easy," zie said. "Lightspeed travel is easy," zie said. Zie obviously knew little of what fifty-seven centuries of tradition could do to a people.
- Example: * All the Things Computers Don't Know - How to improve the "I only understood you as far as" response.
Section : Changing Tense and Viewpoint
This extension can change the tense and/or viewpoint of all of Inform's pre-packaged responses at once. It also allows replacing Inform's library messages in the same way as Default Messages by Ron Newcomb. We select the viewpoint and tense with the following lines. If we don't specify, first person past will be used.
The story tense is past tense.
The story viewpoint is third person feminine.
The possible values for the story viewpoint are:
third person masculine
third person feminine
first person plural
third person plural
For the story tense, the usual values are these.
A testing command, POV, prints the current viewpoint and tense, and can change them as well.
Adventures in Linguistics is in first person past tense.
>pov third person masculine
Adventures in Linguistics is now in third person masculine past tense.
He was carrying nothing.
>pov present tense
Adventures in Linguistics is now in third person masculine present tense.
He is carrying nothing.
Tense and viewpoint can be changed during play as well. Code-wise, viewpoint is easiest because only the pronouns used in the messages need change, and there's a very short list of pronouns in English.
Carry out becoming Lady Marion: now the story viewpoint is third person feminine.
In our own writing, these phrases say whichever pronoun is appropriate for the story viewpoint, the capitalization, and the role in the sentence. We use the first person plural not because it reads best, but because all ten cases are different, avoiding verbose circumlocutions like 'his-mine' or 'I in lowercase'.
Report wearing something: say "[We] donned [the noun]." instead.
Could print as any of these.
I donned the...
You donned the...
He donned the...
She donned the...
And so on. More complicated differences in writing can use "[if the story viewpoint is first person]" and the like.
Changing the story tense between present and past is a slightly trickier problem because there's many more verbs than pronouns, some verbs are highly irregular, and the verb must agree with the subject. First, the easy part.
When a flashback scene begins, now the story tense is past tense.
When a flashback scene ends, now the story tense is present tense.
For regular verbs, we only append one of the suffix phrases "[-s]", "[-es]", "[e-s]", or "[-ies]". (Note the hyphen: there are non-hyphenated versions in Inform and other extensions which are for nouns, not verbs.) An example of each of our verb suffixes:
Report waiting: say "[We] wait[-s]." instead.
Report searching: say "[We] search[-es] [the noun]." instead.
Report waving: say "[We] wav[e-s] back." instead.
Report spying: say "[We] sp[-ies] on [the noun]." instead.
For irregular verbs, we must explicitly tell Inform about them. This extension already defines several: are*, aren't*, have*, do*, go*, eat*, feel*, find*, get*, give*, hear*, put*, see*, take*, wear*, think*, and keep*. For example:
Report eating: say "[We] [eat*] [the noun]." instead.
That prints either "eat" or "ate", as appropriate. The others are used similarly.
We can add to this list as well, of course. In the following sample, we add "weave" and "say". We use the infinitive with an asterisk appended for the verb we'll use in our adaptable writing, and we list the other five forms in plain ol' text. (Well, we cheated with are* because it's so much more readable than be*, but be* is still recognized.)
Some irregular verbs are weave*, say*.
Table of Irregular Verbs (continued)
The order is very important here. Not only do the order of the asterisked verbs need come in the same order as their corresponding sets in the list, but the five forms in each set come in the same order as that of a relation from chapter 13.9 of the manual: "The verb to weave (he weaves, they weave, he wove, it is woven, he is weaving) implies the..." Not counting the initial infinitive form "to weave", the parenthesis enclose those five forms in the order: present singular, present plural, past, past participle, and present participle. Some words, like "said", fulfill multiple roles.
Occasionally we'll need to use one of "[are*]", "[have*]", or "[do*]" as a helping verb, not as the main verb. For this, these:
As an example, with 'decide' and 'wear' as the main verb:
say "[We] [have+] decided to soldier on."
say "[We] [are+] already wearing [our] uniform."
The first can produce:
I have decided to soldier on.
I had decided to soldier on.
He has decided to soldier on.
We had decided to soldier on.
And so on.
Subject-verb agreement is usually observed automatically because the last object printed is remembered for the verb's (or suffix'es) benefit, except in a case like this.
say "Time march[-es] on."
'Time' isn't an object, so the "[-es]" suffix would be considering some other object in the game, one that might be plural. To ensure it, "[=> (an object)]" can be used to silently inform the next verb or suffix what it's supposed to agree with. If no object is handy, "any third person singular" and "any third person plural" will suffice.
say "[=> any third person singular]Time march[-es] on."
This will now produce the appropriate:
Time marches on.
Time marched on.
Hence changing tense during play is a little trickier than changing viewpoint, but only because the computer isn't responsible for anything but the simple grammar we all take* for granted.
Section : Replacing Selective Responses
Inform comes pre-packaged with many messages for many situations. Although changing the story viewpoint and tense will automatically change these, much of writing interactive fiction boils down to providing fresh writing for the same interactive framework. If the story viewpoint and/or tense are never changed from second person present, then the smaller, similar extension Default Messages by Ron Newcomb also replaces responses, and by the same method: a table of three columns. The first column is for the action involved (or just the -- double hyphen for general messages), the second is a number (because many actions have many outcomes), and the final column is the response to the reader.
Table of custom library messages (continued)
library-action library-message-id library-message-text
-- 10 "(I beg your pardon, but I didn't catch your drift.)"
going action 2 "Marion saw nothing interesting [noun] of there."
taking action 1 "Marion had always wanted [a noun]!"
-- 28 "(I understood [library message verb] but not the rest of it.)"
There's a few variables that come in handy for certain messages. "The noun" and "the second noun" are of course available, as is "the number understood" and similar. The others are:
the person asked -- we cannot use "the actor" within our table, but this is identical.
library message verb -- this would be "take" for the taking action, "go" for the going action, etc. (More precisely, it is the entire command predicate typically used in "What do you want to take?" or "I only understood you as far as take them.")
library message pronoun -- when our reader uses a pronoun, this is the pronoun she used.
pronoun reference object -- the noun that the above pronoun refers to.
library message object, second library message object, library message amount -- effectively synonymous with the noun, the second noun, and the number understood for non-action messages.
library message action, library message number -- these are the variables that are compared to our two table columns. The first differs from the library message verb in that it has the present participle ("taking") rather than the root form ("take"). For actions which take two nouns, the preposition is also included ("giving it to").
The extension usually guesses correctly on line break issues, but for those cases where it adds an extra, the say phrase "[ignore library line break]" should cure it. It can be mixed-n-matched with the normal "[run paragraph on]" if need be.
(Table amendments, rather than continuations, may be used for actions to save some computer memory. See chapter 15.19 in the manual.)
Section : The Printing Library Message Activity
A new activity, "printing library message", is available for whatever purpose. It is an activity on numbers, though a "while" clause can attach an action's name to one of its rules. For messages that aren't attached to a particular action, use "misc messaging" as the action.
For printing library message 3 while taking: say "Er, nevermind."
For printing library message 10 while misc messaging: say "Please type something in."
We can create multiple tables that resemble the custom library messages table, and deem one of them the official table via a table-that-varies, "the default messages table."
Carry out Lady Marion following the player:
now the default messages table is the table of Lady Marion's observations.
Table of Lady Marion's observations
|--||10||"'Are you always so quiet, [player]?'"|
If the alternate table does not hold every message, we can leverage the activity to take corrective action in any number of ways. The activity's sole rule, "the standard library message rule," prints the corresponding library message for the situation, drawing it from the table referenced by the "default messages table". This rule is purposefully not placed last in the activity's 'for' rulebook so we can place rules both before and after it. We have a handful of phrases available to us to ease writing of new rules -- see the phrasebook of the index for the full list. But for the sake of example, the following rule closely resembles the standard rule, and we would likely list it before the standard rule, as it is quite unlikely Lady Marion will be commenting on out-of-world happenings.
For printing library message:
choose the library message corresponding to the library message action # library message number from the table of Lady Marion's observations;
if the chosen row is zero, make no decision;
say the library-message-text entry;
library line break.
The initial "choose the library message corresponding to (action name) # (number) from (table)" phrase does most of the work. Like other 'choose' phrases dealing with tables, it selects a row which later "..entry" phrases reference. The "chosen row" is a number -- the row it chose. Notably, it is zero if there is no corresponding message for that action and number combination in that table, allowing the rule to pass the situation to the next rule in the 'for' rulebook. Otherwise, after the say statement shows the message to the reader, "library line break if applicable" might tack on a "[line break]" unless the message itself used "[ignore library line break]".
For library messages which have a blank in their action column, we can use "the miscellaneous non-action" as the action. Unrelatedly, the action our player is currently attempting is named "the action in progress".
If no rule in the activity's 'for' phase makes a decision, a runtime error will result with the action & number of the missing message. In a release build, the reader is greeted only with silence.
Section : Miscellaneous Substitutions
Several say-phrases that this extension uses internally are useful for the author who needs multiple tenses or viewpoints in their story. For the pronoun appropriate to the story viewpoint, we use one of the following phrases.
Many of the following are similar to the extension Plurality.
"['s-'re]" - contraction for is-are-am
"[is-are of (an object)]"
"[n't]" - contraction for not
"[that-those-us of (an object)]"
"[That-those of (an object)]"
"[That's-They're of (an object)]"
"[it-them of (an object)]"
"[it-they of (an object)]"
"[It-They of (an object)]"
Any phrase beginning with the => arrow will print nothing, but will affect the next "[is-are]" or suffix.
"[=>don't]" or "[=>not]"
Finally, these touch-up a few miscellaneous messages.
"[moment]" for the final word in "at the moment/time"
"[here-there]" for the final word in "is here" vs "was there"
"[can]" for can/could
"[can't]" for can't/couldn't
None of the say phrases in this section are necessary for the author to learn, but they occasionally come in handy. New ones can be created by quizzing the story viewpoint and story tense, or by asking if something "acts plural" to determine is/are distinctions. "The prior named noun" is the last object to have its name printed.
To say 's-'ve:
if the story tense is in any past tense:
otherwise if the prior named noun acts plural:
Section : Verb Phrase Generation
The story tense can be temporarily set to one of these additional values.
continuous present tense
continuous past tense
continuous present-perfect tense
continuous past-perfect tense
To use these, prepend "[aux]" to the verb. It will print any helping (auxiliary) verbs needed.
say "[We] [aux]mov[e-s] far away."
That can produce:
He moved far away.
They had moved far away.
I am moving far away.
She could not move far away.
And so on. Irregular verbs do not need the "[aux]" phrase as they take care of it themselves.
say "[We] [eat*] often."
By setting up phrases in this way, we can describe a variety of situations that the work's interactivity might produce. The prose adapts not just on replaceable nouns, but verbs and tense -- time -- as well as others.
Words like "can" and "would" are called modal auxiliary verbs. Rather than trying to support all of them, a text variable called "could-would-should" inserts one. Normally empty, it understands can, could, can't, couldn't, will, would, won't, and wouldn't. Set the variable to any of those words and the extension will select the correct form between past and present tense, and affirmative and negative mode. (For future tense, use "will" in present. Future may be a tense semantically, but syntactically it's a mode.)
now could-would-should is "";
now could-would-should is "could";
now could-would-should is "won't";
Three truth states control the final modes. They default to false.
All of these various modes -- perfect and continuous aspect, could and would modes, passive voice, negative mode, and inquisitive mood -- are used up after a single use. It's assumed they are used within a larger prose generation system that will set or unset them as needed each time.
There are three more phrases intended mainly for questions: "[quax]", "[??]", and "[^]". To allow generating questions, prepend "[qaux]" to the subject just as "[aux]" is prepended to the verb. It's placed directly next to the word on its right, in case it doesn't need to say anything. At the other end of the sentence, "[??]" becomes a period or question mark, as appropriate. Finally, "[^]" capitalises the next word.
say "[^][qaux][we] [aux]want[-s] [the noun] greatly[??]"
say "But [qaux][we] [aux]want[-s] [the noun] at all[??]"
Irregular verbs don't need "[aux]" but everything else is game.
say "[Aux]Bob [eat*] much lately[??]";
Finally, more modal auxiliaries may be added.
Table of modal auxiliaries (continued)
(Ron Newcomb can be reached at email@example.com)