Let's Play/Read: Inform 7 manuals (Done for now)

Chapter 12, part 3

Section 12.12 is Check rules for actions by other people.

This brings up that distinction mentioned upthread, that ‘someone’ excludes the player, so that:

Check someone photographing: if the person asked does not carry the camera, stop the action.

only applies to NPCs.

They mention that we don’t print anything here because the NPC might be out of sight; that came up a lot in my game with the clone copying you while not in the room.

You can add names to rules to refer to them elsewhere; I think this is our first case of seeing that in action:

Check someone trying photographing (this is the other people can't photograph without the camera rule): if the person asked does not carry the camera, stop the action.

This name then shows up in the game’s internal logic (for instance, using the ACTIONS keyword:

>clark, photograph me
[asking Clark Gable to try photographing yourself]
[(1) Clark Gable photographing yourself]
[(1) Clark Gable photographing yourself - failed the other people can't photograph without the camera rule]
Clark Gable is unable to do that.
[asking Clark Gable to try photographing yourself - succeeded]

With a named rule, you can now say,

Unsuccessful attempt by Clark photographing:
    if the reason the action failed is the other people can't photograph without the camera rule, say "Clark is too suave to be embarrassed. 'Frankly, my dear, I don't have a camera.'";
    otherwise say "Clark tries, and fails, to take a photograph."

Example 206 is Get Axe:
This is an example of rewriting check rules:

This is the clever can't take what you're inside rule:
if the person asked is in the noun, try the person asked exiting;
if the person asked is in the noun, rule fails.

The clever can't take what you're inside rule is listed instead of the can't take what you're inside rule in the check taking rules.

Attic is a room. The unused coffin is in the Attic. The coffin is enterable and openable and open. Raskolnikov is a man in the coffin.

Persuasion rule for asking Raskolnikov to try doing something:
persuasion succeeds.

Example 207 is Barter Barter:

The block giving rule is not listed in the check giving it to rules.

A persuasion rule for asking people to try giving: persuasion succeeds.

Check someone trying giving something to someone (this is the sneering refusal rule):
if the second noun dislikes the noun, stop the action.

Unsuccessful attempt by someone trying doing something:
if the reason the action failed is the sneering refusal rule, say "'Would you care for [the noun]?' [the person asked] asks solicitously of [the second noun].

But [the second noun] refuses [the noun] disdainfully.";
otherwise say "[The person asked] just appears bewildered by this improbable instruction."

Distaste relates one person to various things. The verb to dislike means the distaste relation.

Clark dislikes the beans. Lewis dislikes the bread.

Section 12.13, by contrast, is the Report Rules for actions by other people:

Report photographing: say "Click!"
Report someone photographing: say "Click! [The person asked] takes a snapshot of [the noun]."

*So the first one applies to us, the second applies to others).

Report rules for others need not actually print anything, unlike report rules for players.

I just tried this out with a tiny game:

The Secure Zone is south of Lobby.

The guard is a man in secure zone.

Crying is an action applying to nothing. 

Report someone crying:
	say "Boohoo!"
		
Every turn:
	try the guard crying;

And ‘boohoo’ is only printed when the player is in Secure Zone, so this works; I’ll definitely keep this in mind the next time I make a reactive NPC.

Strangely, though, I forgot to say the guard was a person before. When it was an object, nothing printed, but typing ACTIONS, it said ‘the guard crying - succeeded’, so apparently having an object try doing something counts as a success. Weird.

Example 208 is The Man of Steel Excuses Himself:

Report Clark Kent going a direction (called the way):
say "[one of]With a particularly weak excuse[or]Muttering[at random] about [random excuse subject], Clark heads [way]." instead.

To say random excuse subject:
choose a random row in the Table of Lame Excuses; say "[reply entry]".

Table of Lame Excuses
reply
"needing a paper-clip"
"wanting an English-Tuvalu dictionary"
"walking a neighbor's dog"
"hearing air-raid sirens"
"having drunk too much coffee"
"thinking he smells smoke"
"wondering where Lois got to"
"needing to speak to Jimmy"
"noticing the Good Year blimp"

Example 209 is Fate Steps In:
This is a complex example, but important here are some snippets:

Before someone making a mess when a safe supporter (called target) is visible:
    if Lise carries something, try Lise putting a random thing carried by Lise on the target instead.

Report Lise putting something on something:
    say "Lise, still deep in thought, absently puts [the noun] on [the second noun]." instead.

Secttion 12.14 is Actions for any actor. It now covers all three ways of defining actions:

Instead of taking a container–only for the player
Instead of (some description of people, such as someone) taking a container–only for NPCs
and now, finally,
Instead of an actor taking a container

Which applies to everyone!

For instance, the Standard Rules include this one:

Carry out an actor wearing (this is the standard wearing rule):
    now the actor wears the noun.

Section 12.15 is Out of World Actions

These are for actions that don’t take place in the fictional world. Basically, these actions are ignored in the turn structure.

The example given is a testing command like counting how many rooms you’ve been in.

Requesting the room tally is an action out of world.
Report requesting the room tally: say "You have been to [number of visited rooms] out of [number of rooms] room[s]."
Understand "rooms" as requesting the room tally.

Example 210 is Spellbreaker, showing how a room that blocks saving can be made:

Check saving the game when the location is the Vault: say "That spell does not work here." instead.

We have to say ‘check’ because Before, Instead, and After don’t fire for Out of World Actions.

Similarly, example 211 is ‘giving a point for never saving the game’:

Check saving the game: increment the number of saves.
When play ends: if the number of saves is 0 and the score is 349, increment the score

Example 12.16 is Reaching Inside and reaching outside rules.

This one comes up a lot; anytime I mess with scope, I get weird messages like 'You can’t reach into [name of room where thing you put in scope is], so I look forward to reading this.

We cannot simply declare that the player can touch a given lever, or can see in a given room: we must arrange for there to be no barriers between the player and the lever, or for there to be a light source in the room.

Something in a transparent closed container is visible but not touchable, so TAKE will not work. There are two rules here that come into play:

can't reach inside rooms rule
can't reach inside closed containers rule

There is also a ‘reaching outside’ rule:
can't reach outside closed containers rule

Unfortunately, there’s not much more than this, so we’ll have to hope for more in the next section.

Example 212 is a weird kind of example (called Carnivale) where you want something visible from multiple rooms but touchable in one:

The Fairground is a region.

Park Entrance, By the Wheel, and Candy Stand are in Fairground. Candy Stand is north of By the Wheel. Park Entrance is west of Candy Stand and northwest of By the Wheel.

The ferris wheel is scenery in By the Wheel. 

After deciding the scope of the player:
    if the location is in Fairground, place the ferris wheel in scope.

'After deciding the scope of ’ always feels like magic to me. I have a crystal ball in my game that uses scope but I just pray my players don’t mess around with it too much.

[B]y writing this rule, we make Inform understand all commands that refer to the ferris wheel when the player is anywhere in the fairground, instead of responding with

You can't see any such thing.

as it normally would.

With this code, if someone types Touch Ferris Wheel, it will give this error:
You can't reach into By the Wheel.

So you can change this by saying:

Rule for reaching inside a room:
    say "You can only look from this distance.";
    deny access.

Oh, this is great! Going to go implement this later with my crystal ball.

Accessibility rules happen before Instead so you can type this for the room it’s in itself:

Instead of touching the ferris wheel:
    say "You don't dare: it's spinning too fast."

Section 12.17 is Visible vs touchable vs carried:

Photographing is an action applying to one visible thing and requiring light.
Depositing it in is an action applying to two things.
Taking inventory is an action applying to nothing.

Actions can involve up to two different things. We can place additional requirements on any of these things by describing them as a “visible thing”, “touchable thing” or “carried thing”. (If we simply say “thing” or “things”, as in the second example, Inform assumes the requirement to be “touchable”.) These three conditions are increasingly strong:

- To be "visible", something needs only to be possible to refer to by the player, which in practice means that it must be visible to the player-character. The noun or second noun produced by any action resulting from a command at the keyboard will always satisfy this minimal condition.

- To be "touchable", the player-character must be able to physically touch the thing in question: this normally means that it must be in the same room, and there must be no physical barriers in between.

- To be "carried", the player-character must (directly) carry the thing in question. (But if the player types a command using an action requiring something "carried", like WEAR HAT, the thing in question - the hat - will sometimes be picked up automatically. This is called "implicit taking", and results in text like "(first taking the top hat)" being printed.)

(sorry for pasting a lot, I feel like this is vital and more people should be able to see this. I wonder if this should be earlier?)

Requirements on touchability are waived in the case of "try" actions applied to people other than the player where the things they would need to touch are doors or backdrops.

Example 213 is Eddystone:

This talks about how directions are nouns but are not touchable, so to add a turning command it needs to be ‘visible’. The following:
Understand "turn [something] [a direction]" as reorienting it to. Reorienting it to is an action applying to two things.
gives an error:

>turn light northeast
You must name something more substantial.

So we fix it like so:

Understand "turn [something] [a direction]" as reorienting it to. Reorienting it to is an action applying to one thing and one visible thing.

Instead of turning the light, say "Try turning the light to the direction of your choice."

Check reorienting it to: if the noun is not the light, say "You couldn't do so meaningfully." instead; if the second noun is up or the second noun is down, say "The light only points in compass directions." instead.

and then add a bunch of code for actually turning it.

Example 214 is Slogar’s Revenge, allowing keys to be worn

The amulet carrying rule substitutes for the carrying requirements rule when locking something with the Amulet of Tumblers.

The amulet carrying rule substitutes for the carrying requirements rule when unlocking something with the Amulet of Tumblers.

This is the amulet carrying rule:
    if the player has the second noun:
        continue the action;
    say "(first picking up the amulet)[command clarification break]";
    try silently taking the second noun;
    if the player is not carrying the second noun:
        stop the action;

Section 12.18 is Changing Reachability

When can you grab something? For instance, in my game there is a crevice you can trapped in that makes it hard to move, so this is intersting to me.

You can basically add rules that either print before grabbing something out of a container or that stop access altogether:

A rule for reaching inside the flask: say "Your hand passes through the glass as if it were not there, chilling you to the bone."; allow access.

A rule for reaching inside open containers: say "Your hands seem enigmatically too large for [the container in question]."; deny access.

‘The container in question’ is the one the rule applies to (is this part of setting action variables or a new thing where rules have objects attached?)

You can also decide whether rules apply to everyone or just the player:

A rule for reaching inside the flask:
    if the person reaching is the player, say "Your hand passes through the glass as if it were not there, chilling you to the bone.";
    allow access.

A rule for reaching inside open containers:
    if the person reaching is the player:
        say "Your hands seem enigmatically too large for [the container in question].";
        deny access.

Example 215 is Magneto’s Revenge, with a character that can reach through boxes.

Check someone taking the gas (this is the gaseous object rule): rule fails.

Unsuccessful attempt by someone taking the gas: say "The gas isn't something one can pick up in one's bare hands."

Every turn:
    if the player can touch the gas:
        say "The gas has reached your lungs!";
        end the story.

A rule for reaching inside something:
    if the person reaching is Kitty, allow access.

Persuasion rule for asking someone to try doing something: persuasion succeeds.

Example 216 is Waterworld, with a backdrop that you can’t do anything to.

A view is a kind of backdrop.

Instead of doing something other than examining when the noun is a view:
say "You are too far from [the noun] to do anything but look."
Instead of doing something other than examining when the second noun is a view:
say "You are too far from [the second noun] to do anything but look."

I need to remember that in my rules blocking touching distant things.

Example 217 is Dinner is Served, showing how you can implement a window letting you reach between locations:

The can’t reach through closed window rule is listed instead of the can’t reach inside rooms rule in the reaching inside rules.

This is the can't reach through closed window rule:
    let reaching through the window be false;
    if the container in question is a room and the container in question is not the location:
        if the container in question is the Street and the location is the Olive Tree Gyro Shop:
            now reaching through the window is true;
        if the container in question is the Gyro Shop and the location is the Street:
            now reaching through the window is true;
        if reaching through the window is true:
            if the window is closed:
                say "You can't reach through the closed window.";
                deny access;
            otherwise:
                allow access;
        otherwise:
            say "You can't reach into [the container in question] from here.";
            deny access.

Section 12.19 is Changing Visibility.

This is about darkness. This section lets you see specific things in a dark room; it mentions scope (which I’ve unsuccessfully tried with dark rooms before), but you can make new rules like this:

Visibility rule when in darkness:
    if examining the book:
        say "You have to squint. Still...";
        there is sufficient light;
    there is insufficient light.

‘There is sufficient light’ and ‘there is insufficient light’ are hard-coded phrases.

It is a possibly unexpected fact that “looking” does not require light, but instead behaves differently in darkness - it prints a pseudo-room-description such as

Darkness
It is pitch dark, and you can't see a thing.

instead of printing the description of the player’s current room. This means that the “looking” action is unaffected by visibility rules. All the same, what “looking” does in the dark can be changed by using the two activities “printing the name of a dark room” and “printing the description of a dark room” (see the Activities chapter for details).

Example 218 is Flashlight, which shows how you can make a lit room be too dark for some things:

Visibility rule when looking under something:
    if the player is carrying a lit thing (called lamp):
        say "You shine [the lamp] under [the noun]...";
        there is sufficient light;
    there is insufficient light.

There is a marble. The marble can be found or lost. The marble is lost.

Instead of looking under the cabinet when the marble is lost:
    move the marble to the player;
    now the marble is found;
    say "Billy's lost marble! So that's where it got to!"

Section 12.20 is Stored actions

I’ve done this a lot before. You can basically make a variable which is an action (used to be called Stored action, but no longer).

For instance, you can have:
The best idea yet is an action that varies.

I use it in my current game for the clone copying you:

TempAction is a stored action that varies.

Before the player doing something:
	now the actor is clone-you;
	now TempAction is the current action;
	if clonesubmerged is false:
		add TempAction to past-actions; 
	now the actor is the player; 
	continue the action.

where past-actions is a list of actions that varies, and I have two other lists (pastpast-actions and pastpastpast-actions).

You can refer, like I did, to the ‘current action’:

let the present whim be the current action;
say "How you would like to be [current action].";

This can behave a bit weird with implicit actions, like if the player goes to another room, because going to a room triggers a ‘look’ action, so you can get more than one current action during a single turn.

But actions can still be useful even if we never intend to try them. For one thing, we can say them, and this produces a fairly natural description of what the action is:

Before doing something in the presence of the bearded psychiatrist: say "'Zo, the subject vishes to engage in [the current action]. Zis is very interesting.'"

will produce text such as:

"So, the subject vishes to engage in rubbing the fireman's pole. Zis is very interesting."

You can match an action to a description of an action like ‘taking something’ or ‘doing something to the lever’.

There is a possiblity of error:

if the current action is wearing something, ... fails because Inform thinks “wearing” is meant in the sense of the current action having clothes on, so it produces a problem message. To avoid this, simply write:
if the current action is trying wearing something, ...

Hmm, I think I’ve had this problem before. Nice!

You can also separate an action into the action part and the name part:

Example: suppose the current actor is Algy, who is throwing the brick at Biggles. Then

action name part of the current action = throwing it at action
noun part of the current action = the brick
second noun part of the current action = Biggles
actor part of the current action = Algy

If one of these parts is missing or not an object (like a number), this returns ‘nothing’.

You can use the word ‘involves’ to check if something is the actor, noun, or second noun all at once:

if the current action involves Algy

There’s also some legacy code stuff here I am ignoring.

Example 219 is Bosch:

Table of Valuable Actions

relevant action point value turn stamp
taking the emerald leaf 15 -1
eating the gilded lily 5 -1

The maximum score is 25.

After doing something:
repeat through Table of Valuable Actions:
if the current action is the relevant action entry and turn stamp entry is less than 0:
now the turn stamp entry is the turn count;
increase the score by the point value entry;
continue the action.

Carry out requesting the complete score:
say “So far you have received points for the following: [line break]”;
sort the Table of Valuable Actions in turn stamp order;
repeat through the Table of Valuable Actions:
if the turn stamp entry is greater than 0:
say “[line break] [relevant action entry]: [point value entry] points”;
say line break.

I copied this almost exactly in my game 77 Verbs, which rewards you for trying every verb Inform has to offer.

I remember not being able to give points to out of world actions; maybe now I can do that now that I know ‘before’ doesn’t work but ‘check’ does.

Example 220 is Cactus Will Outlive Us All:

Death Valley is a room. Luckless Luke and Dead-Eye Pete are men in the Valley. A cactus is in the Valley. Persuasion rule: persuasion succeeds.

A person has an action called death knell. The death knell of Luckless Luke is pulling the cactus. The death knell of Dead-Eye Pete is Luke trying dropping the cactus.

Before an actor doing something:
    repeat with the victim running through people in the location:
        let the DK be the death knell of the victim;
        if the DK is not waiting and the current action is the DK:
            say "It looks as if [the DK] was the death knell for [the victim], who looks startled, then nonexistent.";
            now the victim is nowhere.

After pulling the cactus when Luckless Luke was in the location:
    say "That's a real shame."

we need the last rule (with ‘was’ in it) since Luke disappears mid-action, so ‘nothing obvious happens’ would have been printed instead.

Example 221 is Actor’s Studio:

After an actor doing something when the video camera is recording:
    if the current action is tuning the video camera to recording, make no decision;
    if the number of blank rows in the Table of Videotape is greater than zero:
        choose a blank row in the Table of Videotape;
        now the recorded action entry is the current action;
        now the time stamp entry is the time of day;
    otherwise:
        now the video camera is idle;
        say "The video camera runs out of recording memory and switches off.";
    continue the action.

This kind of stuff works surprisingly well but I specifically avoided doing this in an area with a surveillance camera after how hard I saw the clone thing is. Especially if you name an action something goofy (like ‘singleuttering’), since inform will print whatever you named it.

Is there a ‘printed name’ thing for actions you make up?

Example 222 is Anteaters, which is about a device that makes you repeat an action:

The gizmo is in Death Valley. The gizmo has an action called idea. The description of the gizmo is "The gizmo is hard to describe, but it projects an idea of [idea]."

Before when the player carries the gizmo and the idea of the gizmo is waiting:
    say "[The gizmo] eagerly soaks up the whole idea of [the current action].";
    now the idea of the gizmo is the current action.

After dropping the gizmo:
    say "The percussion of the fall seems to have shaken the gizmo's idea loose! There's nothing for it now but [idea of the gizmo].";
    try the idea of the gizmo;
    now the idea of the gizmo is waiting.

Section 12.21 is just some guideline. Sometimes, we can use any of the six ways of messing with functions to get the same results:

Before taking the land mine: end the story saying "Bang!"
Instead of taking the land mine: end the story saying "Bang!"
Check taking the land mine: end the story saying "Bang!"
Carry out taking the land mine: end the story saying "Bang!"
After taking the land mine: end the story saying "Bang!"
Report taking the land mine: end the story saying "Bang!"

Some general tips on which to use are:

-Correcting typos. If you want a certain action to say ‘Instead of typing that, try ___’ (like in conversation) you can say: “Understand … as a mistake”

  1. If something applies just once, we can make a special rule, otherwise we can make general rules.

  2. For special rules: If the effect kicks in before something, use an Instead Rule, and if after, use an After rule. Occasionally we use Before, but only if it represent impulses. For instance, in my clone thing, when I was using ‘instead’ rules, the clone didn’t copy my failed attempts at things, while using Before rules made the clone catch even failed intents.

Three examples are given:

"You cannot contemplate breaking this smothering silence." (Before)
"The invigilator stares you down through her horn-rimmed glasses." (Instead)
"Everyone turns, appalled, as the silence is broken like the surface of a swimming pool by a falling elephant." (After)
  1. Generic situations use check/carry out/report rules and occasionally before.

Check rules don’t do anything but block things, and possibly say why they block things.

Carry out rules shouldn’t block things and usually don’t print anything.

Report rules don’t block actions or do anything but do print things.

That’s a nice way of splitting it up!

If you want to divert an action before it even happens, Before is useful again, as a way of redirecting to other things.

  1. If dealing with out of behavior actions, remember that Instead, Before, and After do nothing.

Whew! A three part chapter!

2 Likes