§12.2. The Status Line
The status line is the reverse-coloured bar along the top of the window during play, which conventionally, but not necessarily, shows the current location, the score (or sometimes the time of day) and the number of turns so far. It has been highly traditional since the early 1980s (Infocom's customer newsletter was for many years called "The Status Line"): it has become the visual identifier of IF. It plays the same role for IF that a header with chapter name and page number plays in a printed book.
The status line is ordinarily printed from two named pieces of text, the "left hand status line" and the "right hand status line". These can be changed during play, so for instance,
The examples below offer miscellaneous alternatives, and are fairly self-descriptive.
Suppose a game with a large map entirely subdivided into regions. We could define:
"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.
Test me with "e / w".
Note that, since regions can be stacked, we technically can be within more than one region at once. In the Port Royal example, for instance, the Tavern region is inside the Inland region. If there is any ambiguity, "the map region of the location" will be construed as "the smallest region that the location belongs to": so we would see "Tavern" rather than "Inland" in the status bar, when the player was in the Feathers or the Feathers Bedroom.
Some extra finesse would be necessary if the names of map regions were very long or if there were some rooms that were not considered to belong to any region at all.
|
ExampleWays Out
A status line that lists the available exits from the current location.
|
|
A not-uncommon device in games with large maps is a list of available exits printed in the status bar. We might do this so:
"Ways Out"
When play begins:
now left hand status line is "Exits: [exit list]";
now right hand status line is "[location]".
To say exit list:
let place be location;
repeat with way running through directions:
let place be the room way from the location;
if place is a room, say " [way]".
We may find that printing out full directions makes the status line unpleasantly crowded. Fortunately, it isn't hard to provide a set of abbreviations to use in this context:
Rule for printing the name of a direction (called the way) while constructing the status line:
choose row with a heading of the way in the Table of Abbreviation;
say "[shortcut entry]".
Table of Abbreviation
heading
|
shortcut
|
north
|
"N"
|
northeast
|
"NE"
|
northwest
|
"NW"
|
east
|
"E"
|
southeast
|
"SE"
|
south
|
"S"
|
southwest
|
"SW"
|
west
|
"W"
|
up
|
"U"
|
down
|
"D"
|
inside
|
"IN"
|
outside
|
"OUT"
|
Dome is a room. North of Dome is North Chapel. South of the Dome is South Chapel. West of the Dome is Western End. Quiet Corner is northwest of the Dome, north of Western End, and west of North Chapel. Loud Corner is east of North Chapel, northeast of Dome, and north of Eastern End. Eastern End is north of Dim Corner and east of Dome. Dim Corner is southeast of Dome and east of South Chapel. Ruined Corner is southwest of Dome, west of South Chapel, and south of Western End.
The church door is east of Eastern End and west of the Courtyard. The church door is a door.
Test me with "w / n / e / e / s / e".
Everywhere else, the names of directions will still be printed out in full in the usual way.
Occasionally we want to print something as our first screen and then pause the game. By default, Inform will print a rather odd status line, with "You" on the left side and "0" on the right. This is because the left hand status line is set to display the location, but (because we're not done with the when-play-begins rules) the player has not yet even been moved to a room.
We can tidy this up in the "starting the virtual machine" activity, by temporarily changing the status line content. We will not provide game-pausing code here, because that is easily done by extension; so:
"Blankness"
Include Basic Screen Effects by Emily Short.
When play begins:
say "take me home";
wait for any key;
say " yeah";
wait for any key;
say " yeah";
pause the game;
now the left hand status line is "[location]";
now the right hand status line is "[turn count]".
Before starting the virtual machine:
now the left hand status line is "";
now the right hand status line is "".
Paradise City is a room. The description of Paradise City is "The grass is green and the girls are pretty."
Quite a modest effect, but occasionally useful.
|
ExampleCapital City
To arrange that the location information normally given on the left-hand side of the status line appears in block capitals.
|
|
Not much is needed for this. The only noteworthy point is that it doesn't work by changing the LHSL to "[the player's surroundings in upper case]": it cannot do this because "the player's surroundings" is not a value. Instead, "[the player's surroundings]" is a text substitution sometimes printing the name of a room, sometimes printing "Darkness", and so on. We must therefore load it into a text first, and then apply "...in upper case".
"Capital City"
Capital City is a room. East is Lower Caissons. South of Lower Caissons
is San Seriffe. East of San Seriffe is a dark room.
To say the player's capitalised surroundings:
let the masthead be "[the player's surroundings]" in upper case;
say the masthead.
When play begins:
now the left hand status line is "[the player's capitalised surroundings]".
Test me with "e / s / e".
Making major changes to display features, such as the construction of the status line, sometimes requires that we rely on Inform 6 in bulk; here is how we might produce the Trinity-style status line, with the location centered at the top center of the screen.
"Corner of No and Where"
No is a room. Where is west of No.
Rule for constructing the status line:
print the location in the center of the status line;
rule succeeds.
To print the location in the center of the status line:
(- PrintCenteredStatus(); -).
Include (-
Array printed_text --> 64;
[ PrintCenteredStatus i j;
@set_cursor 1 0;
i = 0->33;
spaces(i);
@output_stream 3 printed_text;
print (name) location;
@output_stream -3;
j = (i - (printed_text-->0))/2;
@set_cursor 1 j;
print (name) location;
spaces j-1;
];
-)
Test me with "w / e".
In fact, as we've already seen, many extra modifications to the display behavior are possible using Basic Screen Effects.
|
ExampleGuided Tour
A status line that lists the available exits from the current location, changing the names of these exits depending on whether the room has been visited or not.
|
|
It may sometimes be helpful to prompt the player with a list of exits printed up in the status line. For instance, here is a status line that will print the names of nearby rooms, as well as all the doors the player can see:
"Guided Tour"
When play begins:
now left hand status line is "Nearby: [if a room is adjacent][the list of adjacent rooms][end if][if a room is adjacent and a door is visible] and [end if][if a door is visible][the list of visible doors][end if]";
now right hand status line is "".
Of course, we may not want to tell the player what glories are to be found in locations he hasn't yet explored.
Rule for printing the name of an unvisited room (called the target) while constructing the status line:
let aim be the best route from the location to the target;
say "something [aim]".
Even when we have seen a room, we might still want a reminder about how to get there:
After printing the name of a visited room (called the target) while constructing the status line:
let aim be the best route from the location to the target;
say " ([aim])".
We may also find that printing out full directions makes the status line unpleasantly crowded. Fortunately, it isn't hard to provide a set of abbreviations to use in this context:
Rule for printing the name of a direction (called the aim) while constructing the status line:
choose row with a heading of the aim in the Table of Abbreviation;
say "[shortcut entry]".
Table of Abbreviation
heading
|
shortcut
|
north
|
"N"
|
northeast
|
"NE"
|
northwest
|
"NW"
|
east
|
"E"
|
southeast
|
"SE"
|
south
|
"S"
|
southwest
|
"SW"
|
west
|
"W"
|
up
|
"U"
|
down
|
"D"
|
inside
|
"in"
|
outside
|
"out"
|
Everywhere else, the names of directions will still be printed out in full in the usual way. And now we give it a little map to work with:
Dome is a room. North of Dome is North Chapel. South of the Dome is South Chapel. West of the Dome is Western End. Quiet Corner is northwest of the Dome, north of Western End, and west of North Chapel. Loud Corner is east of North Chapel, northeast of Dome, and north of Eastern End. Eastern End is north of Dim Corner and east of Dome. Dim Corner is southeast of Dome and east of South Chapel. Ruined Corner is southwest of Dome, west of South Chapel, and south of Western End.
The church door is east of Eastern End and west of the Courtyard. The church door is a door.
Test me with "n / w / s".
Note that while this looks fine in some places, other locations exceed the limits of what the status-line can hold: if any given room is going to have a large number of exits, this kind of listing will almost certainly not fit. So apply cautiously.
If we want to lay out the status line in some other way than with left-hand and right-hand entries, it is possible to do this as well. Later we will learn about the "rule for constructing the status line", but here is a basic effect using this rule and an Inform extension included as part of the standard distribution, called Basic Screen Effects.
"Centered"
When play begins:
say "After months of boring through the Earth's crust in this metal-jawed vehicle, you break through..."
The Hollow Core is a room. "Truly a magnificent sight: the land curves up away from you in every direction, covered with the cities and fields of the Core People. Molten rock runs in the canals, bringing heat and light to every home.
At the center of the Earth hangs a dense black sun."
Include Basic Screen Effects by Emily Short.
Rule for constructing the status line:
center "[location]" at row 1;
rule succeeds.
Test me with "look".
Basic Screen Effects also provides a mechanism for building complicated status lines of more than one row. To read its documentation, we include the extension, press Go!, and then consult the contents index that results.