Let’s keep moving.
Standard Rules: Actions 5
§44. Looking.
Looking happens so often that that I sometimes forget about it, but of course not all lookings are equal. There is no after looking, for instance, when a player looks while going.
Section 4 - Standard actions concerning the actor's vision
Looking is an action applying to nothing.
The looking action translates into Inter as "Look".
We’ll take the specification in bites, as its rather long. We’ve already gotten a taste of Inform’s approach to handling spatial immediacy, ie, checking to determine common ancestry between the player and a thing. Here, we are introduced to the concept of visibility levels. As a first consideration, a visibility-holder is the next “higher” object in the tree. For instance, if a chair sit on a podium in a classrom, the visibility-holder of the podium is the clasroom, and the visibility-holder of the chair is the podium.
The specification of the looking action is "The looking action describes the
player's current room and any visible items, but is made more complicated
by the problem of visibility. Inform calculates this by dividing the room
into visibility levels. For an actor on the floor of a room, there is only
one such level: the room itself. But an actor sitting on a chair inside
a packing case which is itself on a gantry would have four visibility levels:
chair, case, gantry, room. The looking rules use a special phrase, 'the
visibility-holder of X', to go up from one level to the next: thus the
visibility-holder of the case is the gantry.
The second consideration is the visibility level count.
The 'visibility level count' is the number of levels which the player can
actually see, and the 'visibility ceiling' is the uppermost visible level.
For a player standing on the floor of a lighted room, this will be a count
of 1 with the ceiling set to the room. But a player sitting on a chair in
a closed opaque packing case would have visibility level count 2, and
visibility ceiling equal to the case. Moreover, light has to be available
in order to see anything at all: if the player is in darkness, the level
count is 0 and the ceiling is nothing.
We’ve already seen the phrase produce a room description with going spacing conventions, but I deferred discussing it until now. This is an Inform 6 inclusion, and I’m not sure what it involves. I would rather see how these things play out in natural language, but perhaps that can’t always be helped. I suppose looking in these cases is handled more or less out of world, which would require some lower-level coding.
Finally, note that several actions other than looking also produce room
descriptions in some cases. The most familiar is going, but exiting a
container or getting off a supporter will also generate a room description.
(The phrase used by the relevant rules is 'produce a room description with
going spacing conventions' and carry out or report rules for newly written
actions are welcome to use this too if they would like to. The spacing
conventions affect paragraph division, and note that the main description
paragraph may be omitted for a place not newly visited, depending on the
VERBOSE settings.) Room descriptions like this are produced by running the
check, carry out and report rules for looking, but are not subject to
before, instead or after rules: so they do not count as a new action. The
looking variable 'room-describing action' holds the action name of the
reason a room description is currently being made: if the player typed
LOOK, this will indeed be set to the looking action, but if we're
describing a room just reached by GO EAST, say, it will be set to the going
action. This can be used to customise carry out looking rules so that
different forms of description are used on going to a room as compared with
looking around while already there."
The specification explains what most of the action variables for looking are for, but abbreviated form allowed goes unmentioned. That is a shame, since it seems unique in that its value is never set explicitly with a now abbreviated form allowed is phrase. It’s never mentioned on this forum, either. This appears to be a separate check from evaluating whether brief or superbrief use options are in force, which also occurs while looking with phrases like if set to sometimes abbreviated room descriptions.
The looking action has an action name called the room-describing action.
The looking action has a truth state called abbreviated form allowed.
The looking action has a number called the visibility level count.
The looking action has an object called the visibility ceiling.
The determine visibility celling rule appears to set action variables that are produced by a handful of phrases invoking I6 code. I think looking is, so far, the action most obscured by I6. I think “obscured” sounds more critical than I mean. I don’t mean it that way! I suppose it is only obscure if you don’t understand Inform 6.
Setting action variables for looking (this is the determine visibility ceiling
rule):
if the actor is the player, calculate visibility ceiling at low level;
now the visibility level count is the visibility ceiling count calculated;
now the visibility ceiling is the visibility ceiling calculated;
now the room-describing action is the looking action.
§45. Carry out.
No checks here, just getting right to the thing.
First, a palate-cleanser for a later printing the locale description of something, since room descriptions can mention things.
Carry out looking (this is the declare everything unmentioned rule):
repeat with item running through things:
now the item is not mentioned.
I’ll break this next rule into chunks. First, printing room headings while in darkness:
Carry out looking (this is the room description heading rule):
say bold type;
if the visibility level count is 0:
begin the printing the name of a dark room activity;
if handling the printing the name of a dark room activity:
say "Darkness" (A);
end the printing the name of a dark room activity;
A subtle distinction: rooms are typically proper-named, but things closed opaque containers are not:
Correction: I had things backwards.
otherwise if the visibility ceiling is the location:
say "[visibility ceiling]";
otherwise:
say "[The visibility ceiling]";
Finally, if the player is in/on something that is not the visibility ceiling, the Standard Rules will print in parentheses the name of the visiblity-holder of the player. This is an exhaustive loop: if things are in or on other things, each will be accounted for. For instance:
lab is a room.
platform is an enterable supporter in lab.
box is an enterable container on platform.
chair is an enterable supporter in box.
the player is on chair.
produces
Welcome
An Interactive Fiction
Release 1 / Serial number 260812 / Inform 7 v10.1.2 / Dlab (on chair) (in box) (on platform)
>
Most of the room description body text rule is committed to handling darkness. Here we also encounter the previously mentioned Inform 6 computations.
Carry out looking (this is the room description body text rule):
if the visibility level count is 0:
if set to abbreviated room descriptions, continue the action;
if set to sometimes abbreviated room descriptions and
abbreviated form allowed is true and
darkness witnessed is true,
continue the action;
begin the printing the description of a dark room activity;
if handling the printing the description of a dark room activity:
now the prior named object is nothing;
say "[It] [are] pitch dark, and [we] [can't see] a thing." (A);
end the printing the description of a dark room activity;
The remainder of the rule is straightforward, especially if we set aside the possibility of Infocom-style brevity/verbosity considerations: print the location's description.
otherwise if the visibility ceiling is the location:
if set to abbreviated room descriptions, continue the action;
if set to sometimes abbreviated room descriptions and abbreviated form
allowed is true and the location is visited, continue the action;
print the location's description;
That isn’t all. The locale description must be handled. If visibility level count is 0, the rule does nothing. This is a fairly elaborate rule, since the player might see the contents of various locales. I’m confused, though. The room description paragraphs about objects rule is broken into two loops, the first of which marks visibility-holders for listing. But I don’t see where any list is printed! The printing the locale description of something sets all things unmarked for listing early on. What am I missing? This is too much trouble to have no purpose.
Carry out looking (this is the room description paragraphs about objects rule):
if the visibility level count is greater than 0:
let the intermediate position be the actor;
let the IP count be the visibility level count;
while the IP count is greater than 0:
now the intermediate position is marked for listing;
let the intermediate position be the visibility-holder of the
intermediate position;
decrease the IP count by 1;
The second half of the rule describes the locales of all visibility-holders holding locale objects, using a loop to exhaust the possibilities. As a reminder, describe locale for (O - an object) is not an Inform 6 reference, it is a straightforward invocation of the printing the locale description of something activity.
let the top-down IP count be the visibility level count;
while the top-down IP count is greater than 0:
let the intermediate position be the actor;
let the IP count be 0;
while the IP count is less than the top-down IP count:
let the intermediate position be the visibility-holder of the
intermediate position;
increase the IP count by 1;
describe locale for the intermediate position;
decrease the top-down IP count by 1;
continue the action;
The visited property is assigned when the player reads the description of a lit room. This make sense, doesn’t it?
Carry out looking (this is the check new arrival rule):
if in darkness:
now the darkness witnessed is true;
otherwise:
if the location is a room, now the location is visited;
§46. Report.
A report rule that applies only to NPCs.
Report an actor looking (this is the other people looking rule):
if the actor is not the player:
say "[The actor] [look] around." (A).
§47. Examining.
One of Inform’s most commonly-used actions, I am sure. Dispenses clues and gives worlds their savor.
Examining is an action applying to one visible thing and requiring light.
The examining action translates into Inter as "Examine".
The specification of the examining action is "The act of looking closely at
something. Note that the noun could be either a direction or a thing, which
is why the Standard Rules include the 'examine directions rule' to deal with
directions: it simply says 'You see nothing unexpected in that direction.'
and stops the action. (If you would like to handle directions differently,
list another rule instead of this one in the carry out examining rules.)
Some things have no description property, or rather, have only a blank text
as one. It's possible that something interesting may be said anyway (see
the rules for directions, containers, supporters and devices), but if not,
we give up with a bland response. This is done by the examine undescribed
things rule."
A small wrinkle deserving its own space. How many would guess that examining involves an action variable?
The examining action has a truth state called examine text printed.
§48. Carry out.
Again, no checking involved. The first is the most common case, and those that follow are supplemental.
Note the check for description of the noun is not ""; The undescribed noun is an author’s bogeyman. It is quite painful to see one mentioned in a review!
Carry out examining (this is the standard examining rule):
if the noun provides the property description and the description of the noun is not "":
say "[description of the noun][line break]";
now examine text printed is true.
A custom response for examining direction objects. Some authors will add something more elaborate in its place, but looking into other rooms is hard to carry off.
Carry out examining (this is the examine directions rule):
if the noun is a direction:
say "[We] [see] nothing unexpected in that direction." (A);
now examine text printed is true.
The next, container-specific rule will print its output whether or not the noun has a text description: a list of relevant things within nouns that are containers. This will also flag examine text printed as true (but only if the container is open or transparent).
Carry out examining (this is the examine containers rule):
if the noun is a container:
if the noun is open or the noun is transparent:
if something described which is not scenery is in the noun and something which
is not the player is in the noun:
say "In [the noun] " (A);
list the contents of the noun, as a sentence, tersely, not listing
concealed items, prefacing with is/are;
say ".";
now examine text printed is true;
otherwise if examine text printed is false:
if the player is in the noun:
make no decision;
say "[The noun] [are] empty." (B);
now examine text printed is true;
A similar rule for supporters. Note that Inform does not declare supporters “empty,” so unless something is on a supporter noun, examine text printed will not be set to true.
Carry out examining (this is the examine supporters rule):
if the noun is a supporter:
if something described which is not scenery is on the noun and something which is
not the player is on the noun:
say "On [the noun] " (A);
list the contents of the noun, as a sentence, tersely, not listing
concealed items, prefacing with is/are, including contents,
giving brief inventory information;
say ".";
now examine text printed is true.
A check to determine if examined things providing the property switched on are on or off. If the rule is applicable, examine text printed is set to true.
Carry out examining (this is the examine devices rule):
if the noun provides the property switched on:
say "[The noun] [are] [if story tense is present tense]currently [end if]switched
[if the noun is switched on]on[otherwise]off[end if]." (A);
now examine text printed is true.
A final check. If we have reached the end of the check examining rulebook having produced zero output regarding the noun, Inform returns one of the most dreaded sentences in the Standard Rules:
Carry out examining (this is the examine undescribed things rule):
if examine text printed is false:
say "[We] [see] nothing special about [the noun]." (A).
§49. Report.
Only NPC’s generate report examining output.
Report an actor examining (this is the report other people examining rule):
if the actor is not the player:
say "[The actor] [look] closely at [the noun]." (A).
I think that’s it for today. Because looking is pretty I6-heavy, I may not have fully understood what is happening there. I am still confused about the room description paragraphs about objects rule marking visibility holders for listing. Have I missed a list somewhere? Quite possibly!
As always, comments, corrections, etc are welcome.