I peeked ahead, and it looks like this is one of the largest chapters for a while, with the very biggest chapter being Advanced Phrases.
Chapter 8 - Change
Section 8.1 is Change of Values that Vary. The whole idea of this chapter is that we alter the basic worldstate or mechanics, as opposed to what we did in the last chapter which is just completely replace mechanics or use what is in place.
In this section we learn to use ‘now’ to set variables:
The prevailing wind is a direction that varies. The prevailing wind is northwest.
Instead of waiting when the prevailing wind is northwest:
say "A fresh gust of wind bowls you over.";
now the prevailing wind is east.
They point out that the type matters in Inform, so since we called the prevailing wind a direction, we can only use ‘now’ to set it to other directions, not numbers or rooms or texts.
Constants cannot be changed. This gives an error:
Colour is a kind of value. The colours are blue, red and mauve.
After pulling the psychedelic lever:
now blue is mauve.
Section 8.2 is Changing the Command prompt. I’ve seen a few people do this recently!
You change it pretty easily:
When play begins: now the command prompt is "What now? ".
and you can even put variable text in there:
When play begins: now the command prompt is "[time of day] >".
Section 113 is Don Pedro’s revenge, a complex example where you are given partially filled sentences as the command prompt, like so:
Table of Random Prompts
| position | prompt |
|---|---|
| boxed | "So securely boxed-in that you can really only parry or thrust, you try to " |
| boxed | "Trapped between your barrels, you decide to " |
| perched | "Able to slice at your attackers but not to advance or retreat, you choose to " |
| perched | "Perched up here with the advantage of height (but little mobility), you attempt to " |
| free | "Out on the open deck with no impediments, free to advance or retreat, you decide to " |
When play begins: reset the prompt.
Every turn: reset the prompt.
To reset the prompt:
sort the Table of Random Prompts in random order;
repeat through the Table of Random Prompts:
if the position entry is the placement of the player:
now the command prompt is prompt entry;
stop.
Section 8.3 is Changing the Status Line. I’ve done this a lot in the past (I found a neat way to use Javascript to play music or display images in response to the status line, so it’s important in several of my games).
You just say Now the left hand status line is "" or Now the right hand status line is "".
The default value for the right hand status line is blank (or the score and turn count if scoring is on), while the default value for the left hand status line is “[player’s surroundings]”, which is either the location, or in darkness, or in an opaque container.
Example 114 is Politics as Usual:
When play begins:
now the right hand status line is "[map region of the location]".
Washington is west of Idaho.
Red is a region. Blue is a region. Idaho is in red. Washington is in blue.
I wondered when I saw this what would happen in my game where I have nested regions, but there’s a note that says it prints the smallest region available if there is ambiguity.
Example 115 uses the useful extension ‘Basic Screen Effects’ by Emily Short:
Rule for constructing the status line:
center "[location]" at row 1;
rule succeeds.
Section 9.4 is change of either/or properties. There’s not much special here, we just use ‘now’:
Instead of waiting when the oaken door is closed:
say "There is a slow, creaky click! sort of noise as the door swings open, apparently all by itself.";
now the oaken door is open.
It just mentions that you set a property that is already set (like making an open door open), just nothing happens, but if you try to give something a property is shouldn’t have (like making a number examined), it throws up an error.
Example 16 is “Vitrine”:
The smart window can be transparent. The smart window is transparent.
Carry out switching off the window: now the window is transparent.
Carry out switching on the window: now the window is opaque.
Section 8.5 is Change of properties with values. This is almost identical to the last one; we still use the same format:
now the printed name of the Closet is “Suddenly Spooky Closet”
The game just checks to make sure that you’re putting in a value of the appropriate type, and that the object has that kind of value associated with it.
The only thing in this section that doesn’t use the ‘now’ format is ‘change’ for changing exits of a room (due to like a landslide or a hidden door or something):
change the east exit of the Closet to the Tsar's Imperial Dining Salon
You can also change an exit to ‘nothing’ if it gets closed off:
change the west exit of the Closet to nowhere
Example 117 is Thirst:
The player carries a waterskin. The waterskin can be full, partly drained, or empty. The waterskin is full. Understand "water" as the waterskin.
Instead of drinking the waterskin when the waterskin is empty:
say "There is no water left."
Instead of drinking the waterskin: if the waterskin is partly drained, now the waterskin is empty; if the waterskin is full, now the waterskin is partly drained; say "You drink a long draught."
Example 118 is Thirst 2, which includes a campfire:
There’s a lot here, but there’s one part that’s especially useful for new people I think (having some stuff disappear while other stuff appears):
Instead of burning the whole kindling:
if the tinder is not flaming:
say "You need the tinder to be flaming, first.";
otherwise:
now the tinder is nowhere;
now the kindling is nowhere;
move the campfire to the location;
say "You succeed in lighting yourself a proper campfire.";
now the printed name of Campsite is "By The Campfire".
Section 8.6 is “Whose property”. This is something I didn’t realize for a while, that if some object is currently being referenced, you can omit its name:
The West Ballroom is a room. "A handsome sweep of chequered floor beckons the eye into the [printed name]."
So we don’t have to say ‘printed name of the west ballroom’ here, it just prints it itself.
This works but I’m not sure if it works in action definitions, which is where I’ve tried it the most and had it fail the most.
Section 8.7 is ‘moving things’. I always use ‘now the ___ is in ___’, but this is a different notation that I think affects rules differently. I often wish there was a nice way to move people from one room to another or from a container to its larger room without inform printing the new room’s description (if anyone has a nice answer let me know!)
Here we go:
move the genie's lamp to Aladdin's Cave;
or…
oh my gosh…
it’s…it’s right here…I…
move the player to Aladdin's Cave, without printing a room description
I could cry right now…this is everything to me…
We can also say ‘printing an abbreviated room description’ which only prints the description if the player has been their before, and is only when moving the player.
We can move things to people (which makes it carried):
move the genie's turban to Aladdin;
Or we can make it worn, but not with move:
now the genie's turban is worn by Aladdin;
Section 8.8 is Moving Backdrops.
Backdrops are secretly just scenery that is moved from room to room, following the player.
But nominally we have it ‘in’ a cluster of rooms at once, and can move it that way.
So we can move a backdrop called ‘stream’ to a region with either of these commands:
move the stream to the Lower Level;
now the stream is in the Lower Level;
Or we can move the backdrop with a command describing rooms:
A room can be wet or dry. A room is usually dry. The Rock Pool is wet.
move the stream backdrop to all wet rooms;
However, backdrops only update when you move, so this doesn’t work to make a backdrop appear in the player’s location. You can fix this with the following command:
update backdrop positions;
Finally, backdrops can go nowhere or everywhere:
After sleeping:
say "It's a bright new day!";
now the stars are nowhere.
After waiting:
say "Darkness falls rapidly here.";
now the stars are everywhere.
Example 120 is Orange Cones.
The traffic is a backdrop. It is not scenery.
When play begins:
move the traffic backdrop to all accessible roads.
A line of orange cones are a thing.
Definition: a road is accessible if the orange cones are not in it.
After dropping the orange cones in a road:
say "With steely determination you begin to lay out the orange cones, blocking access to this segment of street. This produces honking and swearing -- but you persevere.";
update backdrop positions.
After taking the orange cones:
say "You go around taking up the orange cones, and within moments the traffic begins to flow into the street again.";
update backdrop positions.
I’ve never scene a backdrop that was declared not to be scenery; cool! It seems to allow it to be seen and have an initial appearance.
Section 8.9 is Moving the Player.
We’ve learned two ways to move the player:
move the player to the Bodleian Library;
now the player is in the Bodleian Library;
[T]acking on the option “without printing a room description”, remembering to add the comma, omits the description which would otherwise be produced. A compromise is to use the option “printing an abbreviated room description”: this gives a full description if the player has never been here before, but only a brief one if it is a familiar scene.
You can also move the player viewpoint, which I love to do!
now the player is Bob
This can cause some issues with reporting rules:
But that means that at the end of the action, the player is no longer the actor - that is, no longer the person who began the action; and consequently, Inform won’t use the report rulebook to say what has just happened. It’s a strange business, moving into another body.
Example 121 is Terror of the Sierra Madre.
Teresa is a woman in the Hay-Strewn Corridor. "Teresa stands opposite you[if Teresa carries something], her fingers wrapped tightly around [a list of things carried by Teresa][end if]." Teresa carries a bulb of garlic and a cross.
Maleska is a man in the Hay-Strewn Corridor. "Maleska watches you from eyes entirely black." Maleska carries a skull.
The player is Maleska. Understand "Maleska" as Maleska.
Now the Corridor contains just two people, and we arrive on the scene as Maleska, with only Teresa facing us.
Every turn:
if the player is Maleska, now the player is Teresa;
otherwise now the player is Maleska.
When you are someone, the printed name of that person is “yourself”. You can fix it with this:
Rule for printing the name of Teresa: say "Teresa".
Rule for printing the name of Maleska: say "Maleska".
Section 8.10 is Removing things from play
This is a useful section. It just says you can put stuff nowhere, either at the beginning:
The lamp is nowhere.
or in the middle of the game:
now the lamp is nowhere;
The old phrase was ‘remove ___ from play’, but that is now deprecated! You can’t remove rooms, doors, or the player, but can remove backdrops.
The opposite of nowhere is ‘somewhere’, and the two can be referred to as ‘on-stage’ or ‘off-stage’.
if the gold coin is somewhere, ...
if the gold coin is nowhere, ...
if the gold coin is on-stage, ...
if the gold coin is off-stage, ...
This is really core stuff, and I use this all the time. Before I understood it, I had a room called ‘Limbo’ and put everything in it, but not anymore (although I did do that in my Dialog game).
Example 122 is Beverage Service:
Instead of drinking a potion (called the drink):
now the drink is nowhere;
say "You quaff [the drink]. It goes down beautifully."
Example 123 is Spring Cleaning:
A thing can be tough or fragile. A thing is usually tough.
Instead of attacking something fragile:
say "You smash [the noun] to smithereens!";
now the noun is nowhere.
Example 124 is Extra Supplies:
This is a fantastic example where you want to model a supply of limitless items, but only allow the player to take one at a time. Whenever anyone wants to create 100s of indistinguishable objects, this is the better option much of the time. I’ll reproduce the whole thing:
The Supply Closet is a room. A supply of red pens is in the Supply Closet. Understand "pen" as the supply of red pens when the red pen is not visible.
There is a red pen.
Instead of taking the supply of red pens:
if the red pen is off-stage:
move the red pen to the player;
say "You help yourself to a fresh red pen.";
otherwise:
say "You're only allowed one pen at a time. The department secretary is very strict."
South of the Supply Closet is the Furnace Room. The incinerator is a thing in the Furnace Room. It is a container. "The incinerator is here, working full blast."
After inserting something into the incinerator:
now the noun is nowhere;
say "A fiery blast consumes [the noun]!"
Section 8.11 is “Now”. We’ve used the ‘now’ command in every other section, so I’m not sure why this is here…it just gives a bunch of examples:
now the score is 100;
now the player is Kevin;
now the front door is open;
now Mr Darcy is wearing the top hat;
now all the doors are open;
now all of the things in the sack are in the box;
It says we can’t be impossible or vague, and says we have three ways of doing things with conditions:
S. - The relation holds at the start of play.
if S, ...; - Does the relation hold right now?
now S; - Make the relation hold from now on.
Example 125 is Bee Chambers, making a random maze (which is described as a bad idea):
A Bee Chamber is a kind of room.
Bee1, Bee2, Bee3, Bee4, Bee5, Bee6, Bee7, Bee8, Bee9, and Bee10 are Bee Chambers.
When play begins:
now right hand status line is "[number of visited rooms]/[number of rooms]";
repeat with place running through Bee Chambers:
now a random Bee Chamber is mapped north of place;
now a random Bee Chamber is mapped northwest of place;
now a random Bee Chamber is mapped west of place;
now a random Bee Chamber is mapped southwest of place;
now a random Bee Chamber is mapped south of place;
now a random Bee Chamber is mapped southeast of place;
now a random Bee Chamber is mapped east of place;
now a random Bee Chamber is mapped northeast of place;
now a random Bee Chamber is mapped above place;
now a random Bee Chamber is mapped below place;
now a random Bee Chamber is mapped inside place;
now a random Bee Chamber is mapped outside place.
The next, Example 126 Hatless, shows a pitfall of pre-game randomization:
A hat is a kind of thing. A hat is always wearable. Definition: a person is hatless if he is not the player and he does not wear a hat.
The indigo bowler, the polka-dotted fedora, the pink beret, and the scarlet cloche are hats.
When play begins:
now every hat is worn by a random hatless person.
This picks a random person and puts every hat on them!
So instead you should type:
When play begins:
now every hatless person wears a random hat.
Except that that gives one hat to everyone (one at a time)
so finally:
When play begins:
repeat with item running through hats:
now the item is worn by a random hatless person.
This is our first example of ‘repeat with item running through…’ that shows up in the main part of a small example, that I can remember. It was probably part of a bigger example earlier.
Example 127 is Technological Terror:
Carry out shooting something with something:
say "ZAP! [The noun] twinkles out of existence! [if something is part of the noun][The list of things which are part of the noun] clatter to the ground! [end if][paragraph break]";
now every thing which is part of the noun is in the location;
now the noun is nowhere.
Section 8.12 is increasing and decreasing. I struggled with this a lot before; this is just arithmetic. Inform’s format is a little clunky, but so is Dialog’s. How is TADS at math?
Here are some ways of increasing things:
now the score is the score plus six;
increase the score by 8;
increase the time of day by 5 minutes;
or decreasing things:
decrease the score by 6;
decrease the carrying capacity of the player by 10;
There is also an equivalent of the ‘++’ from C:
increment the score; just increases the score (or whatever variable you type) by 1.
decrement the score; does the same.
8.13 is Checking on whereabouts. This section is mainly a list of examples:
if the genie's lamp is in Aladdin's Cave ...
if Aladdin is not in Aladdin's Cave ...
if Aladdin's Cave contains the genie's lamp ...
if the genie's lamp is carried by Aladdin ...
if Aladdin is carrying the genie's lamp ...
if Aladdin does not have the genie's lamp ...
if the table supports the genie's lamp ...
if the table is supporting the genie's lamp ...
if the genie's lamp is supported by the table ...
if the genie's lamp is on the table ...
if the genie's lamp is on top of the table ...
if the genie's lamp is in the cupboard ...
if the genie's lamp is contained in the cupboard ...
if the genie's lamp is inside the cupboard ...
if the genie's lamp is within the cupboard ...
if the wick is part of the genie's lamp ...
The following are equivalent:
if the genie's lamp is carried by the player ...
if the genie's lamp is carried ...
So if we want to check it being carried by anybody, not just the player, we need something else (probably ‘carried by anybody’, is my guess).
Section 8.14 is More Flexible Descriptions of whereabouts. It’s the same thing but allows generic kinds, or nouns or kinds modified by adjectives, instead of specific things:
if the genie's lamp is carried by a woman ...
if the genie's lamp is inside the closed cupboard ...
Section 8.15 is ‘Calling names’
This is a:
majorly important section
This is when you want to vaguely describe an object and then use a name for it later:
if somebody is in an adjacent room (called the Hiding Place), say "You hear distant breathing from [the Hiding Place]."
Instead of waiting when a woman (called the kidnapper) is holding an animal (called the pet), say "How can you think of rest when, somewhere out there, [pet] has been cruelly kidnapped by [the kidnapper]?"
You have to place this parenthetical clause (phrase?) directly after its antecedent:
if something (called the penitential object) held by the player is hotis allowed, but not
if something held by the player (called the penitential object) is hot
Example 128 is Higher Calling:
Before going through a closed door (called the blocking door):
say "(first opening [the blocking door])[line break]";
silently try opening the blocking door;
if the blocking door is closed, stop the action.
Section 8.16 is Counting Things. I usually use this for lists and stuff. You just say ‘the number of [description of things]’ and it gives you a number. Like:
the number of edible things carried
the number of things on the table
the number of people in the Dining Room
I use ‘the number of’ 34 times in my game, for instance here:
To decide what lightcolor is currentcolor:
if the number of switched on light-switches is 3, decide on white;
if the number of switched on light-switches is 2:
if green-switch is switched off, decide on magenta;
if blue-switch is switched off, decide on yellow;
if red-switch is switched off, decide on cyan;
if red-switch is switched on, decide on red;
if blue-switch is switched on, decide on blue;
if green-switch is switched on, decide on green;
decide on black;
You can also count weird things, like:
the number of non-recurring scenes
but not ‘the number of numbers’.
Section 8.17 is Looking at containment by hand
holder of (object) … object
This phrase produces the container, supporter, carrier, wearer or room in which the object resides.
This section delves into lists. There are a few phrases here I’ve never used (heck, I’ve never used ‘the holder of’ at all!):
first thing held by (object) … object
This phrase produces the first of the list of things held by the object. Example:
first thing held by Baroness Orczynext thing held after (object) … object
This phrase produces the next item of the list of things held by something. Example: suppose Baroness Orczy is carrying a lapdog and a string of pearls.
next thing held after the lapdogis then the string of pearls.
This seems kind of weird, honestly. How do you know when to stop? If you were in a repeat through loop, you wouldn’t be using this phraseology anyway. Just seems weird…
Section 8.18 is randomness!
a random (name of kind) between (arithmetic value) and (arithmetic value) … value
or:
a random (name of kind) from (arithmetic value) to (arithmetic value) … value
or:
a random (name of kind) between (enumerated value) and (enumerated value) … value
or:
a random (name of kind) from (enumerated value) to (enumerated value) … value
This phrase produces a uniformly random value in the range given. Examples:
a random number from 10 to 99 a random time from 2:31 PM to 2:57 PM
When you create values, it implicity orders them, so you can do this:
A cloud pattern is a kind of value. The cloud patterns are cumulus, altocumulus, cumulonimbus, stratus, cirrus, nimbus, nimbostratus.
Then a random cloud pattern between stratus and nimbus can only be stratus, cirrus, or nimbus.
I occasionally use the next one, although I deplore randomness in my games in general:
if a random chance of 2 in 3 succeeds, ...
Instead of waiting when a random chance of 15 in 100 succeeds: ...
To fix the random number generator to a specific random seed for testing:
When play begins, seed the random-number generator with 1234.
(or replace 1234 with some other positive number).
Lots of examples!
Example 129 is Do Pass Go:
Check rolling when the noun is not the pair of dice: say "Not something you can roll." instead.
Carry out rolling:
now the pair of dice is in the holder of the actor;
now the first die of the pair of dice is a random number from 1 to 6;
now the second die of the pair of dice is a random number from 1 to 6.
This is just a segment, but notice how when you roll them they are in ‘the holder of the actor’. This is so if you roll dice while on a platform, it stays on the platform, or if in a cage, it stays in the cage.
Example 130 is Lanista part 1. This is basic combat!:
Instead of attacking someone:
let the damage be a random number between 2 and 10;
say "You attack [the noun], causing [damage] points of damage!";
decrease the current hit points of the noun by the damage;
if the current hit points of the noun is less than 0:
say "[line break][The noun] expires, and is immediately carried away by the Arena slaves!";
now the noun is nowhere;
end the story finally;
stop the action;
let the enemy damage be a random number between 2 and 10;
say "[line break][The noun] attacks you, causing [enemy damage] points of damage!";
decrease the current hit points of the player by the enemy damage;
if the current hit points of the player is less than 0:
say "[line break]You expire!";
end the story.
Example 131 is Weathering, which I print in its entirety:
A cloud pattern is a kind of value. The cloud patterns are cumulus, altocumulus, cumulonimbus, stratus, cirrus, nimbus, nimbostratus.
The Mount Pisgah Station is a room. "The rocky peak of Mt. Pisgah (altitude 872m) is graced only by an automatic weather station. The clouds, close enough almost to touch, are [a random cloud pattern]. Temperature: [a random number from 7 to 17] degrees, barometric pressure: [950 + a random number from 0 to 15] millibars."
Example 132 is Uptown Girls:
Every turn when a random chance of 1 in 3 succeeds:
reset passerby;
choose a random row in the Table of Atmospheric Events;
say "[event entry][paragraph break]"
Table of Atmospheric Events
event
"Slowly [a passerby] strolls by, turning to look at you as she passes."
"Some [passerby] nearly bumps into you."
"You dodge to avoid [a passerby]."
"You weave around [a passerby], who has stalled to look into a window."
"There's a ruckus as one of the ubiquitous taxis nearly collides with [a passerby] crossing the street."
"[The passerby] beside you waves to a friend across the street."
"To your left, [a passerby] drops her purse, and swears as she retrieves it."
Hair color is a kind of value. A person has hair color. the hair colors are red-headed, brunette, blonde.
Height is a kind of value. A person has height. The heights are tall, medium-height, short.
Grooming is a kind of value. A person has grooming. The groomings are messy and tidy.
To reset passerby:
now the hair color of the passerby is a random hair color;
now the height of the passerby is a random height;
now the grooming of the passerby is a random grooming.
There’s also a neat trick with tables at the end of this example, which I have not reproduced.
Finally, 8.19 is Random Choice of things:
a random visited room
a random scene
Often when there is one thing of a kind in a room and I want to great it, I say ‘let X be a random ____ in the location’. Sincere there is only one ____ in the location, this will always pick exactly that one.
For instance, I have this in my current game:
Instead of giving something to frankenstein:
if the noun is oncefrankheld:
let current be a random thing carried by Frankenstein;
say "'Hmm, fine, I'll take it back,' says Frankenstein.
He grabs [the noun] from you and hands you [the current].";
now current is carried by the player;
now the noun is carried by Frankenstein;
otherwise:
let current be a random thing carried by Frankenstein;
say "Frankenstein says, 'Ooh, what's this? Is it valuable?'
He grabs [the noun] from you and hands you [the current].";
now current is carried by the player;
now the noun is carried by Frankenstein;
Back to the text:
say "You can see [number of adjacent rooms] way[s] from here; how about [random adjacent room]?"
If there are no adjacent ways, it prints You can see 0 ways from here; how about nothing?
Example 133 is Candy:
Toxicity is a kind of value. The toxicities are safe and poisonous. A piece of candy has a toxicity. A piece of candy is usually safe.
When play begins:
now a random piece of candy is poisonous.
Example 134 is Zork II (not the whole game! Just the Carousel Room):
Instead of going from the Carousel Room:
move the player to a random adjacent room.