Chapter 14 - Adaptive text and responses
Nice, after being in the weeds in the last few highly technical sections, this is a chapter that is not to hard to understand and is very useful.
IF is second person present, but we can change any of that. The main things we change are:
story viewpoint
story tense
In my current game, I have a murder mystery area where you interrogate people, and in their flashbacks they speak in first person past tense. At first it was hard to write all the responses but once I figured out this adaptive text stuff it was great.
The viewpoint is one of the following:
first person singular
second person singular
third person singular
first person plural
second person plural
third person plural
The tense is one of:
past tense
present tense
future tense
perfect tense
past perfect tense
The main thing to realize is only the main rules are automatically adapted. If you want your text to adapt, you have to make it that way.
For instance:
The Taj Mahal is a room. "You stand and admire the Taj Mahal."
When play begins:
now the story viewpoint is first person plural;
now the story tense is past tense.
prints out:
Taj Mahal
You stand and admire the Taj Mahal.
>e
We couldn't go that way.
It doesn’t automatically convert your message ‘you stand’. You have to write it in past tense yourself (or, as we’ll see in a bit, write it in an adaptive way).
Here are our first examples of adaptive text:
say [here] says ‘here’ in present tense and ‘there’ otherwise;
say [now] says ‘now’ in present and ‘then’ otherwise.
Section 14.2 is Adaptive text.
How do we write text if we don’t know the number of things?
For instance, the following code (from the text) has a mistake I’ve made many times:
Instead of taking: say "[The noun] is pinned down by Dr Zarkov's force field."
The problem with this is that if ‘the noun’ is plural or yourself it looks messed up:
> GET ME
You is pinned down by Dr Zarkov's force field.
> GET CONDENSERS
The condensers is pinned down by Dr Zarkov's force field.
You can adapt it like this:
Instead of taking: say "[The noun] [are] pinned down by Dr Zarkov's force field."
The [are] adapts to match whatever was in brackets earlier.
Now this I knew, and I used this a lot. I also knew you could define new verbs to adapt using the ‘is a verb’ construction we’ll see later. What I didn’t know is that Inform audomatically adapts any built in verb:
"[The noun] [carry] too much static charge."
including with negative versions:
"[The noun] [cannot touch] the ionizer terminal."
These adaptive features really make Inform shine (as compared to, for instance, standard python or other programming languages that aren’t text-focused).
This doesn’t work if you don’t put the noun in brackets.
"The condensers [are] working." won’t adapt.
And it doesn’t recognize that two brackets together make a plural:
"[The condensers] and [the V-ray] [are] smashed by Voltan's birdmen." prints ‘is’ instead of ‘are’. You can get around this with lists:
"[The list of things on the bench] [are] smashed by Voltan's birdmen."
No examples yet!
Section 14.3 is More on adapting verbs.
You can just say something is a verb like this:
To retrofit is a verb.
and inform adapts it.
I thought this was a separate construction from relation verbs from last chapter, but apparently it’s the same thing internally, just not attached to a relation.
Defined this way without meaning, it won’t work in code, but works in text like this:
"[The actor] [retrofit] the Mecha-Mole."
The weird thing is I thought we had to write [adapt the verb retrofit], which is what I have in my code.
So I have this:
To mark is a verb.
say "[We] [adapt the verb mark] [the noun] with [the second noun].";
now the noun is marked;
But it sounds like the ‘adapt the verb’ part is unnecessary.
You can use this in ‘actor’ rules like this:
say "[The actor] [put] [the noun] on [the second noun]."
Example 245 is Fun with participles:
Describing relates various verbs to various action names. The verb to describe means the describing relation.
To look around is a verb. The verb look around describes the looking action.
To stand about is a verb. The verb stand about describes the waiting action. To look bored is a verb. The verb look bored describes the waiting action. To waste time is a verb. The verb waste time describes the waiting action.
To jump is a verb. To leap is a verb. To pirouette is a verb. The verb jump describes the jumping action. The verb leap describes the jumping action. The verb pirouette describes the jumping action.
A person has an action name called the current idle. The current idle of a person is usually the waiting action.
Rule for writing a paragraph about someone (called chosen person) when a verb describes the current idle of the chosen person:
say "[The chosen person] [are] here, [present participle of a random verb that describes (the current idle of the chosen person)]."
After Clark doing something when a verb describes (the action name part of the current action):
say "'Fine, have it your way!' Clark exclaims. 'But I have [past participle of a random verb that describes (the action name part of the current action)] for the last time!'";
rule succeeds.
Example 246 is Variety:
Describing relates various verbs to various action names. The verb to describe means the describing relation.
To take is a verb. To acquire is a verb. To get is a verb.
The verb take describes the taking action. The verb acquire describes the taking action. The verb get describes the taking action.
To drop is a verb. To put down is a verb. To discard is a verb. The verb drop describes the dropping action. The verb put down describes the dropping action. The verb discard describes the dropping action.
To sniff is a verb. To smell is a verb. The verb sniff describes the smelling action. The verb smell describes the smelling action.
To jump is a verb. To leap is a verb. To pirouette is a verb. The verb jump describes the jumping action. The verb leap describes the jumping action. The verb pirouette describes the jumping action.
After an actor doing something when the noun is nothing and a verb describes (the action name part of the current action) (this is the apply random verbs to describing nounless actions rule):
say "[The actor] [verb rendering applied to a random verb that describes (the action name part of the current action)].";
rule succeeds.
Variety 2 is like variety 1 but also mentions the change in your state:
After an actor doing something to something when a verb describes (the action name part of the current action) (this is the apply random verbs to describing actions rule):
let current action name be the action name part of the current action;
if a random chance of 1 in 2 succeeds and the current action name is a related action listed in the Table of Action Results:
choose a row with the related action of current action name in the Table of Action Results;
let R be the relation entry;
let subject be the actor;
let chosen object be the noun;
say "[The subject] [are] now [present participle of a random verb that means R] [the chosen object].";
else:
say "[The actor] [verb rendering applied to a random verb that describes (the action name part of the current action)] [the noun].";
rule succeeds.
Example 248 is Narrative Register:
THis is a very complex example that has a table of verbs and actions with a list of tags/registers for the verb and a blank column called ‘relevance’. A register is selected at random and then every verb with that register is given a point of relevance. Then, when speaking, a random high-relevance word is chosen.
I can only suppose The Mary Jane of Tomorrow included a system like this (but more complex), as it had procedural generation that included ‘registers’ like ‘speaking in french’, ‘politeness’, etc. Honestly a truly great game.
Section 14.4 is adapting text about the player.
Inform’s responses automatically adapt to the tense and story viewpoint. They do this by using adaptive text for subjects.
[We] is the standard thing to use, I think because it varies the most in declension (whereas ‘you’ is the same in nominative and accusative).
So you can write:
"[We] [carry] the Queen's warrant."
and it will adapt to ‘You carry’ or ‘we carried’ or ‘i will carry’, etc.
These are the versions of ‘us’ we can use:
"[We]" or "[we]"
"[Us]" or "[us]"
"[Our]" or "[our]"
"[Ours]" or "[ours]"
"[Ourselves]" or "[ourselves]"
Section 14.5 is Adapting Text rferring to other things
This is for adapting stuff besides the player.
You can do this with [They] if we proceed this with [regarding the noun]:
Instead of examining in the Netherworld:
say "[regarding the noun][They] [have] no clear outline in this misty netherworld."
This is used if we haven’t just printed the name of something with a text substitution. If we have, we don’t need ‘regarding the noun’, like this:
"[We] [have] a look at [the noun], but [they] [are] just too big."
This can print all of the following:
I had a look at Peter Rabbit, but he was just too big.
You have a look at the chessmen, but they are just too big.
We have a look at ourselves, but we are just too big.
There’s also the impersonal ‘it is’ or ‘there is’:
"[We] [take] [the noun]. [It] [rain] harder."
Specifically, we can adapt:
"[It's]" or "[it's]"
"[There's]" or "[there's]"
And if you have a number (for instance, a variable called ‘dud count’):
"Honestly, [dud count][regarding the dud count] of these [are] broken."
Section 14.6 is Adapting demonstratives and possessives
This is if you want to say ‘You can’t reach that!’ but have the possibility of saying ‘those’ instead if it’s plural.
You just say [those], with a [regarding the noun] if we haven’t printed the name of the object recently:
"[We] really [are not] tall enough to reach [regarding the noun][those]."
You can also print the possessive of a noun:
“[regarding the noun][Possessive] height [are] just too great.”
I’ve never used this! Nice.
You can use ‘regarding’ for multiple items matching a description:
say "Every possession is a worry. I wonder if [regarding things carried by the player][they] still [look] okay in your pocket?"
Upper case [Those] is assumed to be nominative and lower case [those] is assumed to be accusative. If you need one of them specifically you can type it like this:
"[those in the nominative]"
"[Those in the accusative]"
Example 249 is Olfactory settings:
Instead of eating something inedible, say "[The noun] [don't] seem likely to agree with [us] at all. [We][']d be wiser to leave [regarding the noun][them] alone."
Instead of touching something: say "[regarding the noun][Those] [are] all prickly."
Instead of smelling something: say "[Our] nose [regarding nothing][are] too weak to get much smell from [regarding the noun][those]."
Instead of smelling the bouquet: say "[regarding the noun][They]['re] lovely."
Instead of tasting something:
say "Whew, [regarding the noun][are] [those] ever nasty!"
Section 14.7 is Can, could, may, might, must, should, would.
These can be used like so:
"[can V]" or "[cannot V]" or "[can't V]"
"[could V]" or "[could not V]" or "[couldn't V]"
"[may V]" or "[may not V]" or "[mayn't V]"
"[might V]" or "[might not V]" or "[mightn't V]"
"[must V]" or "[must not V]" or "[mustn't V]"
"[should V]" or "[should not V]" or "[shouldn't V]"
"[would V]" or "[would not V]" or "[wouldn't V]"
where you replace ‘V’ with a verb that inform knows. If it doesn’t know it, just say ‘to whatever is a verb’.
You can do complex stuff like "[Fred] [might not discombobulate] so easily."
Section 14.8 (this is really an examples-light chapter, but it’s clear so it’s fine) is Adapting contractions.
To contract ‘to be’ and ‘to have’ at the end of other words, do “['re]” and “['ve]”:
"[We]['ve] got rhythm. [We]['re] cool."
This can produce stuff like:
“I’ve got rhythm. I’m cool.”, or “He’ll have rhythm. He’ll be cool.”, or “You had got rhythm. You were cool.” (The contractions don’t appear in the past tense; but the spacing fixes itself automatically.)
Inform 7 has a few special substitutions only really used in the rules, like [They're] hardly portable, which is almost exactly lik [They]['re] but:
the singular would be “It’s hardly portable” not “That’s hardly portable”.)
Here are 4 other things Inform knows:
"[aren't]"
"[don't]"
"[haven't]"
"[won't]"
Code like this:
Instead of taking something:
say "[The noun] [are] pinned down by Dr Zarkov's force field. [They] [aren't] free to move. [They] [can't] move. [They] [won't] move. [They] [haven't] a chance to move. Anyhow, [they] [don't] move."
can make text like this:
The condensers are pinned down by Dr Zarkov's force field. They aren't free to move. They can't move. They won't move. They haven't a chance to move. Anyhow, they don't move.
You were pinned down by Dr Zarkov's force field. You weren't free to move. You couldn't move. You wouldn't move. You hadn't a chance to move. Anyhow, you didn't move.
Section 14.9 is Verbs as values.
You can make verbs be considered values by putting ‘the verb’ in front of it:
the verb contain.
If you use ‘showme the meaning of…’ it produces output like this:
"meaning of the verb contain" = relation of objects: containment relation
"meaning of the verb provoke" = relation of objects: equality relation
Here ‘provoke’ would be something we defined earlier. If it has no relation on its own it jus tprints equality relation.
Inform itself uses the verb to ‘mean’, with meaning being the meaning relation. So you can have something like this:
the list of verbs meaning the containment relation
which produces the following:
list of verbs: {verb contain}
Here are some other things you can type:
say "[adapt (verb)]"
This adapts the verb to the story viewpoint. I mentioned this earlier; maybe it’s only useful when [we] has not yet been printed?
You can also adapt from a different viewpoint or tense:
say "[adapt (verb) from (narrative viewpoint)]"
or
say "[adapt (verb) in (grammatical tense)]"
This is great! I had to write something in past tense in just one phrase so I was changing the whole story viewpoint for one rule. This is much nicer.
You can combine them both:
"we [adapt the verb provoke in the future tense from the first person plural]"
You can negate things in the current tense:
say "[negate (verb)]"
(this would be like ‘adapt not verb’, which wouldn’t work)
You can combine that with the above stuff too:
"we [negate the verb provoke in the future tense from the first person plural]"
(It’s like the last chapter was the mathematician’s chapter and this chapter is the English professor’s chapter).
These constructions work for a verb variable:
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.
This produces (remembering that ‘meaningful’ means ‘this verbs is connected to a relation’):
"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"}
We can also say ‘infinitive of’, ‘past participle of’, and ‘present participle of’.
Some of these are bad for defective verbs (giving results like ‘mighted’ or ‘shoulding’).
Example 250 is History Lab:
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]";
Example 251 is Relevant Relations. This example uses forbidden tech:
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.
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
There’s a lot I don’t understand here but I don’t feel compelled to learn it. For instance, why do we set current paragraph to {} and then run through it? It must have changed…how? It’s just a weird example.
Section 14.10 is responses. The stuff in this section is vital (to me) for making a good game.
Inform automatically has built in responses:
EAST
You can’t go that way.
JUMP
You jump on the spot.
These responses have names. In the standard rules, something might say:
Carry out taking inventory (this is the print empty inventory rule):
if the first thing held by the player is nothing,
say "[We] [are] carrying nothing." (A) instead.
Then the name of the message at the bottom is “empty inventory rule response (A)”. If you write your own rules in an extension, you should name your rules in this format so others can change them.
With that name, you can print them:
print empty inventory rule response (A)
or we can print them like this:
say "Hmm: [text of print empty inventory rule response (A)]"
Section 14.11 is Changing the text of responses, which is what players will want to do to make their game cool:
The print empty inventory rule response (A) is "Your hands are, like, totally empty. Lame."
You can even change this dynamically (hmm I didn’t realize that!):
now the print empty inventory rule response (A) is "Your hands ...";
In my personal experience and for my personal tastes, changing all the rule responses (or at least the 30 or so most common ones) really makes or breaks the atmosphere in a game. Most of a parser game is typing in errors as you explore the boundaries of a world or just mess up. The standard responses then become the main bulk of your ‘story’.
Unfortunately, I don’t always change them myself, as my faithful testers can woefully attest (sorry testers!)
To see all the names of responses in the game just type RESPONSES ALL and copy them. If you’ve never seen a rule, don’t change it; if you have, change it to make it fit your game (is my advice).
Example 252 is Responsive:
When play begins:
now print empty inventory rule response (A) is "[We] [have] absolutely nothing.".
Sectoin 14.12 is The RESPONSES testing command, which I just mentioned. You can type RESPONSES which lists the sets of possible responses, and then you can pick from them with something like:
> RESPONSES 1
Standard Rules:
block vaguely going rule response (A): "You'll have to say which compass direction to go in."
print the final prompt rule response (A): "> [run paragraph on]"
...
So, this is a ‘core chapter’ that is easy to understand. Pretty wild coming after ‘relations’, which was highly technical and not something most players will use. I love chapter 14.
The next chapter is math, which should be fun.