8.20. Review of Chapter 8: Change

| Chapter 8: Change |

| 8.20. Review of Chapter 8: Change

1. Things that vary. A "variable" is a named value which changes as time goes by. In this chapter, we saw only one of the two sorts of variable: a value which exists throughout the whole game. For instance:

> The prevailing wind is a direction that varies.
> The current horse is an animal that varies.
> The last remark is some text that varies.
> The previous item is a thing that varies.

(In the chapter on Phrases we shall later see that is also possible to have named values that exist only temporarily, using the "let..." phrase.) A variable always has a kind - sometimes a kind of object, like "a direction" or "an animal" or "a thing", and sometimes a kind of value, like "some text" or "a number".

2. Now. We may change values using "now":

> now the prevailing wind is east;
> now the current horse is Comet;

Several pre-defined variables can be altered this way to affect the way the game appears or plays:

> now the command prompt is "And then? ";
> now the left hand status line is "[time of day]";
> now the right hand status line is "[score] / [turn count]";

But "now" is far more powerful:

> now the oaken door is closed;
> now the printed name of the Closet is "Scary Closet";
> now the brightness of the lamp is flickering;
> now the player is in the South Corridor;
> now the player wears the hat;
> now the oaken door is closed;

It is also able to give instructions for multiple items, using descriptions:

> now all the doors are open;
> now everything in the sack is in the box;
> now every woman loved by Brisco is angry;

3. Player. The "player" is a person that varies. Most source texts never say anything about who the player is, and then Inform creates a "yourself" person to be the player: someone of kind "person", not "man" or "woman", so that no gender is established, and who will be nondescript in appearance. We could instead specify any of the people in the source text to be the player:

> Lord Bowler is a man in the Pavilion. The player is Lord Bowler.

We can even switch to the point of view of a new protagonist during play:

> now the player is Lady Deep-Gulley;

The player's commands will then control this new character, wherever he or she may be. (Lord Bowler, no longer responding to commands, will remain where he was at the time of the switch unless we explicitly move him off-stage.)

4. Moving things around the map. We may move things (and the player) around the world with such phrases as

> move the hat to the wardrobe;
> move the player to the San Francisco;
> move the player to the Moon, printing an abbreviated room description;
> move the player to the North Hall, without printing a room description;
> remove the penny black from play;

We may also check whether something is outside the scope of the game with

> if the gold coin is off-stage, ...
> if the gold coin is on-stage, ...

A thing will be on-stage if its location is a room (that is, if Inform can find a room that directly or indirectly contains the item). Otherwise, it will be off-stage.

5. Checking locations. By default, things in Inform games relate to one another physically by

> to contain - containment relation
> to support - support relation
> to carry - carrying relation
> to wear - wearing relation
> to be part of - (reversed) incorporation relation
> to incorporate - incorporation relation
> to be adjacent to - adjacency relation
> to have - to either carry or wear, which we call the possession relation
> to enclose - an indirect containment/support/incorporation relation
> to hold - a direct containment/support/incorporation relation

(We have met these before in the chapter on Things, and will review them further in the Relations chapter.) We may check on the state of any of these relations like so:

> if the bottle contains whiskey, ...
> if the bar supports a ten-dollar gold piece, ...
> if the player carries a six-shooter, ...
> if Daisy is wearing a corset, ...
> if the Gilded Rod is part of the Time Orb, ...
> if the location is adjacent to the Train Yard, ...
> if a bounty-hunter has a warrant, ...
> if the Saloon encloses a gun-slinger, ...
> if Daisy is holding the infant Emperor of China, ...

The "holding relation" includes containment, support, incorporation, wearing, and carrying, all in a single idea; so it is sometimes convenient to be able to talk generically about the holder of something. In the preceding examples, for instance:

> the holder of the emperor = Daisy
> the holder of the Gilded Rod = the Time Orb

6. Callings. Since the descriptions used in these conditions can be open-ended, it is sometimes useful to keep track of what specific things were found, using the "(called...)" construction. Here we check for the existence of a certain kind of bounty-hunter, and remember his name if he exists:

> if a bounty-hunter (called the current bounty-hunter) has a warrant, say "[The current bounty-hunter] watches you suspiciously."

We can do the same thing in defining rules:

> Instead of attacking a dangerous man (called the victim) when the player is unarmed:
> say "You rush at [the victim], who knocks you down with a well-aimed swing."

When we use "(called ...)", we create a new value or thing that varies - this is an example of a value which lasts only for temporary usage, but it can be used in the rest of the rule currently being defined.

Previous | Contents | Next