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

Chapter 12, part 2:

Section 12.10 is about the mythical ‘Action variables’. I would never read this section unless forced to by publicly promising to cover the entire rulebook.

It says that even in the standard rules only 2 or 3 of the 90 actions use this level of complexity.

You use action variables like this:

Setting action variables for photographing:
    now the camera photographed with is the sharpest camera which is carried by the actor.

where ‘sharpest camera’ is defined earlier (recall that if you define a comparison with an inequality inform makes a superlative out of it):
A camera is a kind of thing. A camera has a number called picture quality. The digital SLR camera is a camera in the tote bag. The player carries a camera called the instant one-shot camera. The picture quality of the SLR camera is 10. The picture quality of the one-shot is 2. Definition: a camera is sharp if its picture quality is 5 or more.

and ‘the camera photographed with’ is defined as:
The photographing action has an object called the camera photographed with.

So this last thing is literally a variable of the action. These names need to be distinct for each action:

The best way to do this is to include the past participle of the action name - just as “camera photographed with” contains the past participle “photographed” of the action “photographing”.

This is a temporary variable that starts out with the default and then is set by the ‘set action variables’, which runs even before the before rules and shouldn’t do anything but set the rulebook variables. Since the rule should work for everyone, use ‘the actor’ instead of ‘the player’.

So now you can say stuff like this:

A check photographing rule:
    if the camera photographed with is nothing:
        say "You can hardly photograph without a camera, now can you?" instead.

The phrase ‘the camera photographed’ basically belongs to the ‘name space’ of this action, and cannot be used by anything not part of the action.

You can also write a special gerund or something that is faster than the above:
The photographing action has an object called the camera photographed with (matched as "using").

Instead of photographing something using the one-shot camera:
    say "But you promised to give this to Sally's nephew."

Check photographing something using the noun:
    say "That would require some sort of contraption with mirrors." instead.

Report photographing something using a sharp camera:
    say "You feel cool and important as the shutter clicks."

Honestly, I’m struggling to find a purpose for this. I often want to bring in local variables during action processing, but how is this different from something like `

Check photographing:
  let current be the sharpest camera which is carried by the actor;
...

Is the idea that it’s convenient to use the same variable name throughout all six stages of action processing? (although I’ll admit I throw a lot of things into INSTEAD and BEFORE and ignore the rest usually).

There are five examples here.

Example 198 is Removal:
Ohhh, this is a great example for why to use action rules! It helps ‘remember’ where things were at the start (this is nice!):


Setting action variables for taking:
    now previous locale is the holder of the noun.

Report taking something from the location:
    say "You pick up [the noun] from the ground." instead.

Report taking something:
    say "You take [the noun] from [the previous locale]." instead.

Very neat! I find this very useful. I don’t have anywhere this could fit in my code right now because I didn’t know it existed but I think this is absolutely great.

Example 199 is Further Reasons Why All Poets Are Liars, which has the best description:

The young William Wordsworth, pushing a box about in his room, must struggle to achieve a Romantic point of view.

(I feel like @Lancelot would like this example):

Understand "push [box]" as a mistake ("You can push the box to the window, the bed or the shelf.").

Understand "push [something] to [something]" as pushing it over to. Pushing it over to is an action applying to two things.

The pushing it over to action has an internal position called the old position.
The pushing it over to action has an internal position called the new position.
Setting action variables for pushing something over to something:
    now the old position is the current box position;
    now the new position is nowhere at all;
    if the second noun is the window, now the new position is over by the window;
    if the second noun is the bed, now the new position is near the bed;
    if the second noun is the shelf, now the new position is under the shelf.

Check pushing it over to:
    if the noun is not the box, say "That's not something you can push." instead;
    if the player is on the bed, say "You can't reach from here." instead;
    if the player is on the noun, say "Not while you are standing on [the noun]." instead;
    if the new position is nowhere at all, say "You can only push [the noun] to the window, the bed or the shelf." instead;
    if the new position is the old position, say "The [noun] is already [new position]." instead.
Carry out pushing it over to:
    now the current box position is the new position.
Report pushing it over to:
    say "With some effort, you shove [the noun] from [old position] to [new position]."

We’ve finally made it to Example 200! We’re almost halfway through with examples. This is The Second Oldest Problem. It’s based on original FORTRAN code of Adventure, which is pretty neat:

The going action has a number called the dark terminus count.
Setting action variables for going:
    now the dark terminus count is 0;
    if in darkness, increment the dark terminus count.
The last carry out going rule:
    if in darkness, increment the dark terminus count;
    if the dark terminus count is 2, end the story saying "YOU FELL INTO A PIT AND BROKE EVERY BONE IN YOUR BODY!" instead.

This is only the second oldest problem in the IF literature: the earliest puzzle is unlocking the steel grate which bars entrance to the cave.

Example 201 is Puff of Orange Smoke:

A body is a kind of thing. A body is a part of every person. Instead of touching a body: say "[The noun] is grotesquely inert."

The description of Lydia's body is "Long, long legs and no attitude at all." The initial appearance of Lydia's body is "Lydia's corpse is sprawled at your feet."

Spirit-possession relates one person to one body. The verb to be owner of means the spirit-possession relation.

When play begins:
    repeat with victim running through people:
        let the corpse be a random body which is part of the victim;
        now the victim is owner of the corpse.

Setting action variables when the noun is a body which is part of a person (called owner):
    now the noun is the owner.

Setting action variables when the second noun is a body which is part of a person (called owner):
    now the second noun is the owner.

Setting action variables when the noun is a dead person and the noun is owner of a visible body (called the mortal remains):
    now the noun is the mortal remains.

This shows how setting action variables can be used to redirect actions with one part of a thing to another (I’ve just since reading this manual started doing this with text on a thing).

Example 202 is Croft: (as in Lara Croft)
This has tons of rules, mostly around messing with platforms. Here is an example:

The dropping action has an object called the container dropped into (matched as "into").

The dropping action has an object called the supporter dropped onto (matched as "onto").

Rule for setting action variables for dropping:
if the actor is in a container (called C), now the container dropped into is C;
if the actor is on a supporter (called C), now the supporter dropped onto is C.

Report dropping a heavy thing onto a metallic thing:
say "You drop [the noun], and [the supporter dropped onto] clangs protestingly." instead.

Report someone dropping a heavy thing onto a metallic thing:
say "[The actor] drops [the noun] onto [the supporter dropped onto], which clangs protestingly." instead.

Section 12. 11 is Making Actions Work for other people:

If you make action rules that mention ‘the player’, then they won’t say anything when other people do them (which was my problem with the clone).

photograph clark
You can hardly photograph without a camera, now can you?

clark, photograph me

This section just says we’ll fix that later.

Example 203 is The Man of Steel, which gives an example of an action which has no ‘understand’ rule since players will never type it:

Escaping is an action applying to nothing.

Carry out someone escaping:
    let space be the holder of the person asked;
    let place be a random room which is adjacent to the space;
    let way be the best route from the space to the place;
    try the person asked going way.

Every turn:
    if Clark Kent can see kryptonite, try Clark Kent escaping.

Example 204 is Trying Taking Manhattan:

The loud inventory rule is listed instead of the report other people taking inventory rule in the report taking inventory rules.

This is the loud inventory rule:
unless the player is the person asked:
say "[The person asked] says, 'I seem to be carrying [a list of things carried by the person asked][if the person asked is wearing something] and wearing [a list of things worn by the person asked][end if].'"

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

Grand Central Station is a room. "Here you are in New York, New York. Any minute now someone is going to burst into song."

Kermit the Frog is a man in Grand Central Station. "Kermit the Frog stands nearby, enjoying being green." Kermit is wearing a hat and a trenchcoat. He is carrying a microphone.

(There have been a ton of pop culture references in the last few sections; seems like the authors are having fun and figuring that no government censor would ever bother reading this deep into the Advanced Actions chapter).

Example 205 is Under Contact, a rare 4-star example. It basically lets Clark Gable do a lot of things and comment on them. The most interesting part to me is this code and the following table:

Unsuccessful attempt by Clark doing something:
repeat through table of Clark Retorts:
if the reason the action failed is the cause entry:
say “[response entry][paragraph break]”;
rule succeeds;
say “‘I don’t think that’s in the script,’ says Clark dubiously.”

Table of Clark Retorts

cause response
can’t take yourself rule “‘I’m always self-possessed,’ Clark remarks. You’ve heard that line before, but it sounds so much more convincing from him.”
can’t take other people rule “‘I don’t think it would be appreciated if I tried to do that to [the noun],’ he rumbles.”
can’t take component parts rule “‘I don’t want to rip [the noun] out,’ Clark remarks.”
can’t take people’s possessions rule “‘I don’t cotton to acting like a thief,’ Clark replies. ‘It ain’t proper.’”
can’t take what you’re inside rule “‘Do you see where I am, babe?’ Clark demands.”
can’t take what’s already taken rule “[already done]”
can’t take scenery rule “‘I’m not the stunt man, darling,’ he says with a wry twinkle.”
can’t take what’s fixed in place rule “‘I’m not the stunt man, darling,’ he says with a wry twinkle.”
can’t exceed carrying capacity rule “Clark grins. ‘I’ve only got so many hands, darling,’ he says.”
can’t insert into closed containers rule “[physical impossibility]”
can’t go that way rule “[physical impossibility]”
can’t go through closed doors rule “[physical impossibility]”
can’t enter closed containers rule “[physical impossibility]”
can’t exit closed containers rule “[physical impossibility]”
can’t drop yourself rule “‘We’re inseparable, me and me,’ Clark replies, with a smile.”
can’t drop what’s already dropped rule “[already done]”
can’t drop what’s not held rule “‘Not under my control, [the noun],’ replies Clark.”
can’t drop clothes being worn rule “[salacious retort]”
can’t put something on itself rule “‘I lack the dexterity,’ says Clark. Oh, he’s so modest.”
can’t put onto what’s not a supporter rule “‘[The second noun] won’t support a thing,’ says Clark reprovingly.”
can’t put clothes being worn rule “[salacious retort]”
can’t insert clothes being worn rule “[salacious retort]”
can’t give worn items rule “[salacious retort]”
can’t wear what’s not clothing rule “‘Costuming just gets stranger every year,’ says Clark. ‘In short: no.’”
can’t wear what’s already worn rule “[already done]”
can’t eat unless edible rule “‘What’re you trying to do, poison me?’”
can’t eat clothing without removing it first rule “[salacious retort]”
can’t take off what’s not worn rule “[already done]”
can’t close what’s already closed rule “[already done]”
can’t open what’s already open rule “[already done]”
can’t switch off what’s already off rule “[already done]”
can’t switch on what’s already on rule “[already done]”
can’t unlock what’s already unlocked rule “[already done]”
can’t lock what’s already locked rule “[already done]”

And I think I’ll stop there for the day! This is a big section and less people read on weekends anyway. I’ll pick up the other half tomorrow. I’ll probably split Activities the same way, that one’s monstrously large.

4 Likes

Mostly because “the noun”, etc are already taken—in the action “asking Bob to try taking the book”, the noun is the book.

Action rules about “someone” doing something don’t apply to the player. If you want the rule to apply to everyone, say “an actor” instead (“check an actor hypnotizing someone”).

This is another little inconsistency, put in because it’s so common to write rules about either the player doing something or an NPC doing something (but not both) that they get a special syntax (“doing something” for you, “someone doing something” for others, “an actor doing something” for both).

4 Likes

fwiw, actions with variables are:

The going action has a room called the room gone from (matched as "from").
The going action has an object called the room gone to (matched as "to").
The going action has an object called the door gone through (matched as "through").
The going action has an object called the vehicle gone by (matched as "by").
The going action has an object called the thing gone with (matched as "with").

The exiting action has an object called the container exited from (matched as "from").

The examining action has a truth state called examine text printed.

And those are all worth knowing if customizing those actions. The looking action has some also, but those mostly involve lower-level stuff than most people will be interested in.

An action variable can be useful in several ways, some of which are:

  • if you want to really make sure something’s set before any other rules are considered, the Setting Action Variables rules enable that (i.e., you don’t have to worry about some first before action sneaking in ahead of it)
  • if the computation to set the variable is expensive, you don’t incur that cost multiple times
  • rules can change the value and thus affect the behavior of later rules (like examining’s examine text printed

oh, good grief, I did not know that someone doing something distinction!

5 Likes

In a lot of situations you’re making a non-deterministic selection. If there’s no “sharpest” relation, you might be writing “a random camera which is carried by the player”, and then it’s important not to re-randomize it in each rule.

Also, if the action moves the object around, it might not be “carried by the player” any more. (Not likely a problem for photographing, but for many actions either the player or the noun will move.)

5 Likes

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!

1 Like

That the actor wasn’t a person didn’t do anything special: there just weren’t any applicable output-producing rules nor anything stopping it. Unless a rule in/among the Before rules, the Basic Visibility rule, the Basic Accessibility Rule, the Carrying Requirements rule, the Instead rules, or the action’s Check rules makes it fail, an action succeeds.

1 Like

I have to say, reading all the persuasion stuff and all of Emily Short’s examples makes me really want to do a game with ordering people around. One of the areas coming up in my giant game is a combat area, so I think I’m going to include a couple of robots in your ‘squadron’ that you have to give instructions to strategically to take out the other team. So I’m glad for the inspiration here!

Edit: Now that I think about it, that’s a lot like the final puzzle in Dr Terrors House of Horrors (or is it the other way around?) which is neat.

1 Like

Strictly speaking, Inform doesn’t care if the actor is a person or not. It has rules to stop the player from giving commands to an inanimate object, but if you, the author, have Mount Everest try to take the chair, Inform won’t stop you.

However, the Report rule is about someone crying, and an inanimate object is something but not someone.

Yep, this is the magic stage in between Before and Instead where feasibility is checked. I do think it should have a convenient name for adding things to it, but by default it checks visibility, touchability, and carried…ness.

Now that’s a sensible exception and not one I knew about.

Technically “the container in question” and “the supporter in question” are two names for the same global variable, parameter_object, which is whatever the current activity or rule is being applied to. (Of course, it’s only relevant if the activity/rule applies to an object or value of some sort; by default, they do not.)

Nope, it uses whatever name you’ve used in the source code. Another reason to name your actions sensibly! But you can make a new activity for printing a stored action if you want.

2 Likes

Chapter 13 - Relations (part 1)

Section 13.1 is Sentence Verbs

This section and chapter are mostly talking about sentences in Inform code itself. ‘Is’ is the most common sentence verb: the mouse is in the teapot, the device is switched on.

Some verbs will never be allowed by Inform, like:
now Mr Darcy has never seen the mouse;

since the past can’t be changed.

This chapter focuses on ‘sentence verbs’ which are basically just assertions about an object or two objects.

Such a sentence can be used in three different ways: to declare the original state of the world, to ask during play if the world currently has that state, or to change things during play so that it does.

So, variable defining and initialization, if statements, and changing variables.

Section 13.2 is What sentences are made up from.

Usually a sentence is two nouns/descriptions with a verb in between:

Mr Collins is in a lighted room.

But some times the nouns are other things like number values:
if the score is greater than 10, ...

Example 223 is Formal Syntax of Sentences.

This is not code but the underlying structure of Inform itself. It goes into detail on what all these terms mean, but th total structure is:

1. S = DP + VP
2. VP = Verb + DP
3a. DP = DP + which + VP
3b. DP = DP + who + VP
4. DP = DP + RP
5a. RP = Preposition + DP
5b. RP = Participle + DP
6 (assertions only). S = RP + Verb + DP

Where RP is a relative phrase (like ‘in a container’, DP is Description Phrase, VP is Verb Phrase (verb +DP), and S is the subject itself.

This reminds me of finite state automata and regular languages in math, which was part of my PhD thesis. Pretty neat stuff! I used to make fractals out of this stuff.

So this is our formal definition of ‘Sentence’.

Section 13.3 is What are relations?

It says that relations are what sentences express (I always think of the term ‘relation’ from set theory, which is just a subset of the cartesian product of two sets X and Y, and I suspect this definition of relation is actually the same in at least one sense).

They are yes/no questions about pairs of things: for example, to say that the coin is in the purse is to say that a particular relation (“being in”) is true about a specific pair of things (the coin, the purse). It is neither a fact about the coin nor about the purse, but about the two together.

Here are some of the most common relations, as expressed by verbs:

containment relation - The coin is in the purse.
support relation - The coin is on the table.
incorporation relation - The coin is part of the sculpture.
carrying relation - The coin is carried by Peter.
wearing relation - The jacket is worn by Peter.
possession relation - if Mr Darcy has a rapier...
adjacency relation - The Study is east of the Hallway.
visibility relation - if Darcy can see Elizabeth...
touchability relation - if Darcy can touch Elizabeth...

The same relation can have several verb forms:

The coin is in the purse.
The purse contains the coin.
The coin is contained by the purse.

So relations are not the exact same thing as verbs (you could almost say that…relation definitions relate a relation to some verbs…).

No examples yet!

Section 13.4 is To carry, to wear, to have.

This describes the five mutually exclusive relationship that physically join one object to another:

containment relation - The coin is in the purse.
support relation - The coin is on the table.
incorporation relation - The coin is part of the sculpture.
carrying relation - The coin is carried by Peter.
wearing relation - The jacket is worn by Peter.

All of these can be expressed at once as ‘to have’:

if Mr Darcy has a wet shirt ...

I wonder if ‘to have’ is a weaker version of ‘to enclose’…

You can also have concealed stuff (which is done by the concealed possessions rule from some earlier chapter):
if Mr Darcy conceals a fob watch ...

It can’t be declared, just checked.

Example 223 is Celadon:

Before dropping something:
    if the player does not carry the noun and the player encloses the noun:
        say "(first taking [the noun] from [the holder of the noun])[command clarification break]";
        silently try taking the noun;
        if the player does not carry the noun, stop the action.

This uses ‘enclosed’ before it was ever mentiond in the text! (Okay, wait, looks like it was mentioned back in 3.25). This might be a good section to mention it again, though.

Example 225 is Interrogation:

A thing can be secret or obvious. A thing is usually obvious.

Rule for deciding the concealed possessions of something: if the particular possession is secret, yes; otherwise no.

Instead of examining someone: say "[The noun] is openly carrying [a list of unconcealed things carried by the noun]."

Instead of waving the X-Ray Vision Wand when the player can see someone who is concealing something:
    say "The wand glows green. Immediately you see on the monitor [a list of things which are concealed by people who can be seen by the player]."

After printing the name of a thing (called target) which is carried by someone while waving the wand:
    say " (carried by [a random person who carries the target])"

This example is notable for using the ‘random person’ trick. What I usually wish I could do in these situations is something like:

After printing the name of a thing (called target) which is carried by someone (called carrier) while waving the wand:
    say " (carried by [carrier])"

But wait, that actually compiles. Hmm, so why do we need the ‘random person’ trick? (the idea of the trick is that if there’s just one person who can satisfy a description, then saying ‘a random person who [description]’ automatically slects that person.

Section 13.5 is Making new relations. I’ve never made a new relation, and only heard about relations while working on my most recent game.

This is how you make a new relation:

Loving relates various people to one person.

Every relation has a name which ends with the word “relation”, and in this case the name is “loving relation”. While the name is often just two words long, as here, it doesn’t have to be:

Adept sensitivity relates one person to one vehicle.

makes the “adept sensitivity relation”. (The limit is 32 words.)

When making the definition, you pick a kind on the left and a kind on the right and pick ‘one’ or ‘various’ for each.

So you could have Kinship relates various people to various people, for instance.

Defined as earlier, ‘Loving relation’ becomes a set-theoretical relation; in math you could type xRy to say x relates to y via R, and in Inform, you would type:

Liubov loving relation Stankevich

You can have multiple people love one person, but not one person loving multiple people, due to the way we defined it.

If the relation is a set-theoretical function (so the word ‘one’ appears on the right side) then you can give a name to the object on the right side:

Pet-ownership relates various animals to one person (called the owner).

It would then make sense to talk about “the owner of Loulou”, and we could have phrases like “now Flaubert is the owner of Loulou” or “if the owner of Loulou is a woman…” and so forth.

I also think you can name the left side if it has the word ‘one’. Actually, I just checked it out and this compiles:
Dreaming relates one person (called the dreamer) to various things.

Sectino 13.6 is Reciprocal relations (which are called Symmetric relations in set theory). This is wear if A relates to B then we want B to relate to A. You use this with ‘each other’ (for situations you would typically use various) or ‘another’ (for ‘one’)

Meeting relates people to each other.
or
Marriage relates one person to another.

Again, if the relation is a function, you can name things:
Marriage relates one person to another (called the spouse).

(Although, as any student of genealogy can attest, marriage does not in fact relate one person to another).

Section 226 is Four Cheeses:

Connection relates one thing to another (called the other party).

The verb to reach means the connection relation.

Check calling it on:
    if the second noun is not a telephone, say "[The second noun] is unlikely to be much use in that respect." instead;
    if the second noun is the noun, say "You get a busy signal." instead.

Carry out calling it on:
    if a person (called the listener) can see the noun, now the player reaches the listener.

Report calling it on:
    say "'Hello?' says [the other party of the player]."

If a relation is one person to one person, like this example, and you declare that someone who was previously related to person A now relates to person B, the first person is no longer related.

There’s also a scope thing:

After deciding the scope of the player while the player reaches someone:
    place the other party of the player in scope, but not its contents.

To decide whether acting through the line:
    if the noun is something and the location of the noun is not the location of the player:
        yes;
    if the second noun is something and the location of the second noun is not the location of the player:
        yes;
    no.

Visibility rule when acting through the line:
    there is insufficient light.

Rule for printing a refusal to act in the dark when acting through the line:
    say "You're not on a video phone, so you can only hear." instead.

A rule for reaching inside a room (called destination):
    if the other party of the player is enclosed by the destination:
        say "Though you're on the line with [the other party of the player], you can't physically reach to [the destination].";
        deny access.

This is great stuff to work with on my crystal ball room.

Section 13.7 is Relations in groups. This is basically partitioning through equivalence classes, in set theory, so that every relation is symmetric, transitive, and reflexive. But that’s pretty similar to other options we already have (like assigning values to objects, or kinds).

You can use the testing command RELATIONS to print out just your custom relations:

>relations
Overlooking relates various rooms to various rooms:
    The Pub >=> the Garden
    The Garden >=> the Shrubbery
    The Shrubbery >=> the Sundial Plot
Friendship relates people to each other:
    Mr Wickham <=> Sophie
    Charlotte <=> Sophie
Marriage relates one person to another:
    Mr Wickham == Sophie

I should note that I just tried testing this all and I realized the text is kind of misinforming you earlier on. It has sentences like:
‘John marriage relation sandra’
but the compiler rejects that. You have to define a new verb for the relation to get it to compile at all. So it’s weird we’re in section 7 and haven’t mentioned defining verbs for relations in the main text yet.

You can show all specific relations with this testing phrase:

show relation (put relation name here).

This is not a typed command. It’s printed wonkily here and no example is given, so it took me a while but I got this to compile:

Dreaming relates one person (called the dreamer) to various things.

The verb to dream means the dreaming relation.

The player dreams the peanut.

Every turn:
	show relation dreaming relation;

(where the peanut is a thing I defined earlier).

Example 227 is Transmutation:

Transmutation relates things to each other in groups. The verb to become means the transmutation relation.

Definition: a thing is transmutable if it becomes more than one thing.
A thing can be valuable. Something valuable called a bag of jewels is carried by the player. It becomes the bag of gunpowder and the bag of jelly beans.

A thing can be dangerous. The bag of gunpowder is a dangerous thing.

The bag of jelly beans is an edible thing.

The machine is fixed in place in the workshop.

The can't insert into what's not a container rule does nothing when inserting something into the machine.

Check inserting something which is not transmutable into the machine:
    instead say "You can't transmute that."

To decide which thing is new form of (obj - edible thing): decide on a random valuable thing which becomes obj.

To decide which thing is new form of (obj - dangerous thing): decide on a random edible thing which becomes obj.

To decide which thing is new form of (obj - valuable thing): decide on a random dangerous thing which becomes obj.

Carry out inserting something into the machine:
    now the noun is nowhere;
    now the player carries the new form of the noun.

This example was suggested by Jesse McGrew.

Example 228 is Otranto. This is with rope, which is rough, as it mentions:

The range of things one might want to do with a rope in a work of interactive fiction is fairly overwhelming. One might, in theory, swing from ropes; use them to tie containers shut; cut them up into smaller ropes; tie them together into longer ropes; employ them as fuses; bind other characters with them, or the player character.

Our rope implementation is, by these lights, reasonably simple, but it does account for the possibility of tying and untying both ends; using ropes to descend into lower rooms; pulling objects tied to the far end of the rope; and dragging objects from place to place.

So here are some definitions:

A rope is a kind of thing.

Definition: a thing is nonrope if it is not a rope. [The perfect idiocy of this statement notwithstanding, having a shortcut will come in very handy later]

Attachment relates things to each other in groups. The verb to be stuck to means the attachment relation.

Definition: a thing is tied if the number of things stuck to it is greater than 1.

Definition: a thing is free if it is not tied.

Definition: a rope is free if the number of nonrope things stuck to it is less than 2.

Definition: a thing is hindering if it is stuck to the noun and it is not within the location.

A thing can be round or unevenly shaped. A thing is usually round.

Definition: something is anchored if it is fixed in place or it is scenery or it is part of an anchored thing.

Definition: something is draggable if it is not had by the player and it is not the player and it is not anchored.

What follows is some extensive code about describing the rope. It’s pretty extraordinarily complex.

Section 13.8 is Built-in verbs and their meanings.

These are:

to be - equality relation
to have - possession relation
to contain - containment relation
to support - support relation
to carry - carrying relation
to wear - wearing relation
to incorporate - incorporation relation

It turns out that when inform is parsing the source code, all verbs are parsed as relations.

There are two more verbs that include prepositions:

to be part of - (reversed) incorporation relation
to be adjacent to - adjacency relation

Technically ‘to be’ has more than one relation attached to it, such as equality and assigning or checking adjectives.

To other expert-level verbs are:

to mean - meaning relation
to provide - provision relation

But I omit the description as I am not expert.

We finally reach the important 13.0, which is defining new verbs:

The verb to sport means the wearing relation.

(I should note that when we get to adaptive text later on there’s something else called a verb that we can use to adapt written text to various tenses and persons).

Once you have a verb you can write:

Mr Wickham sports a Tory rosette.

which in this case, since we specified the ‘wearing’ relation, means:
Mr Wickham wears a Tory rosette.

Inform conjugates your verb for you:

The verb to sport means the wearing relation.

is enough for Inform to understand “he sports”, “they sport”, “he sported”, “it is sported”, “he is sporting”, “he had sported” and so on. It works with irregular verbs, too; it has a very comprehensive dictionary. But it’s legal to spell out the conjugation if need be:

The verb to sport (he sports, they sport, he sported, it is sported) implies the knowledge relation.

You can make verbs for reverse relations:

The verb to grace means the reversed wearing relation.

A Tory rosette graces Mr Wickham.

You can make bigger verbs:

The verb to cover oneself with means the wearing relation.

Peter is covering himself with a tent-like raincoat.

Example 229 is Unthinkable Alliances:

Unthinkable Solutions is a room. Sophie, Daisy, Ryan and Owen are in Unthinkable Solutions.

Alliance relates people to each other in groups. The verb to help means the alliance relation.

Sophie helps Ryan. Daisy helps Ryan. Owen helps the player.

Instead of kissing someone (called the blessed one):
say "Smack!";
now the player helps the blessed one.

Instead of attacking someone (called the vilified one):
say "Smack!";
now the player does not help the vilified one.

(I like the ‘smack’ dual meaning in this example, pretty funny).

Example 230 is The Unexamined Life:

Explaining relates one thing to various things. The verb to explain means the explaining relation.

Instead of hinting about something when something unexamined (called the clue) explains the noun:
say "You're still missing some information that might be useful to understanding the problem. [More]";
if player consents, try hinting about the clue.

Requiring relates one thing to various things. The verb to require means the requiring relation.

Instead of hinting about something when the noun requires something (called the implement) which is not carried by the player:
say "You're missing an object that might be useful to resolving this problem. [More]";
if player consents, try hinting about the implement.

Hinting about is an action applying to one visible thing. Understand "hint about [any thing]" as hinting about.

Section 13.10 is Defining new prepositions.

This is really defining the verb ‘to be’ + a preposition (or really to be + anything).

So like this:

Suspicion relates various people to one person.

The verb to be suspicious of means the suspicion relation.

And you can also say this:
somebody suspicious of Colonel Hotchkiss

Example 231 is The abolition of love:

Loving relates one person to one person.

Noticing relates various people to one person.

Impressing relates one person to various people.

Fancying relates various people to various people.

Acquaintance relates people to each other.

Marriage relates one person to another.

Alliance relates people to each other in groups.

The Chapel is a room. Elizabeth, Wickham and Darcy are people in the Chapel. Mr Bennett and Mrs Bennett are people in the Chapel. Georgiana is a person in the Chapel.

The verb to love means the loving relation.

The verb to notice means the noticing relation.

The verb to impress means the impressing relation.

The verb to fancy means the fancying relation.

The verb to know means the acquaintance relation.

The verb to be married to means the marriage relation.

The verb to be related to means the alliance relation.

Elizabeth loves Darcy. Elizabeth fancies Darcy. Elizabeth notices Darcy. Elizabeth impresses Darcy.

Mr Bennett is related to Mrs Bennett and Elizabeth. Mr Bennett is married to Mrs Bennett.

There are then a bunch of actions and commands defined to change these around.

Example 232 is Swerve left? Swerve right? Or think about it and die?

I swear Emily Short made a marble madness game. Maybe this is from it?

Overlooking relates various rooms to various rooms.

The verb to overlook means the overlooking relation.

A thing can be spherical or lumpy. A marble is a kind of thing. A marble is always spherical. The player carries a marble called a red marble. The player carries a marble called an agate marble. The player carries a marble called a blue cloudy marble.

The Long Yellow Slide is north of the Funnel. The Long Yellow Slide overlooks the Blue Funnel. The Ski-jump is below the Blue Funnel. The Blue Funnel overlooks the Ski-jump. The Ski-jump overlooks the Landing Bowl. The Landing Bowl overlooks the Snake Run. The Landing Bowl is north of the Snake Run. The Snake Run overlooks the Goal. The Snake Run is north of the Goal.

Definition: a room is sloping if it overlooks a room.

Instead of jumping in a sloping room:
    say "You leap...";
    move the player to a random room overlooked by the location.

Example 233 is Beneath the surface

This example gives a standard way to let objects be ‘under’ another object in the same way they can be ‘in’ or ‘on’ each other.

This is a pretty useful example!

Underlying relates various things to one thing. The verb to underlie means the underlying relation. The verb to be under means the underlying relation. The verb to be beneath means the underlying relation.

Instead of looking under a thing which is underlaid by something (called the lost object):
    say "You find [the list of things which underlie the noun]!";
    now every thing which underlies the noun is carried by the player;
    now every thing which underlies the noun does not underlie the noun.

Hiding it under is an action applying to one carried thing and one thing. Understand "put [something preferably held] under [something]" as hiding it under. Understand "hide [something preferably held] under [something]" as hiding it under. Understand the commands "shove" and "conceal" and "stick" as "hide".

Check hiding it under:
    if the second noun is not fixed in place, say "[The second noun] wouldn't be a very effective place of concealment." instead.

Carry out hiding it under:
    now the noun is nowhere;
    now the noun underlies the second noun.

Report hiding it under:
    say "You shove [the noun] out of sight beneath [the second noun]."

Example 234 is Bogart, which uses ‘underlying’ again but with a different meaning in terms of layers of clothing.

Underlying relates one thing to various things. The verb to underlie means the underlying relation. The verb to be under implies the underlying relation.

Before taking off something which underlies something (called the impediment) which is worn by the player:
say "(first removing [the impediment])[command clarification break]";
silently try taking off the impediment;
if the noun underlies something which is worn by the player, stop the action.

Check taking off:
if the noun underlies something (called the impediment) which is worn by the player, say "[The impediment] [are] in the way." instead.

Carry out taking off:
now the noun is not underlaid by anything.

Report taking off something:
say "[We] [are] now wearing [a list of uppermost things worn by the player]." instead.

Notice that this example exemplifies the Before, Check, Carry out, Report quadrichotomoy (if that’s a word).

Before redirects (in this case, if you take off clothes underneath other clothes, it redirects to taking off top clothes first)

Check stops

Carry out physically removes th objct

Report prints.

Although wouldn’t this line in the Before:
if the noun underlies something which is worn by the player, stop the action.

stop this line in Check?:
if the noun underlies something (called the impediment) which is worn by the player, say "[The impediment] [are] in the way." instead.

Section 13.11 is Indirect relations.

This is for non-transitive relations, to express that two things are related by a chain of intermediate relations.

The verb to overlook means the overlooking relation.

The Garden overlooks the Shrubbery. The Folly overlooks the Garden. The Shrubbery overlooks the Sundial Plot. The Old Ice House overlooks the Garden.

After looking:
    say "This wintry vantage point overlooks [the list of rooms overlooked by the location].";
    let the way be the next step via the overlooking relation from the location to the Sundial Plot;
    if the way is a room, say "To sledge downhill to the Sundial, aim for [the way].";
    otherwise say "It is not possible to sledge downhill to the Sundial."

So the ‘next step via…form … to …’ is an object that fits in the relation.

You can also type ‘number of steps via…from … to …’, getting 0 for start and end being the same and -1 if no chain exists.

You can do fast route-finding and slow route-finding, like before.

This would be great for puzzle dependency charts and hints, to be honest.

Example 235 is ‘The problem of Edith’.

This is some clever conversational code:

Suggestion relates things to each other. The verb to suggest means the suggestion relation.

A subject is a kind of thing. The current subject is a thing that varies. greeting is a subject.

Understand "ask [someone] about [any subject]" as asking it about the subject. Understand "tell [someone] about [any subject]" as asking it about the subject.

Asking it about the subject is an action applying to one thing and one visible thing.

Carry out asking it about the subject:
say "'Hmm, [the second noun],' says [the noun]. ";
relate the current subject with the second noun;
now the current subject is the second noun.
starting final comment
divorce love “‘As it seems to me, all the love is on one side,’ she says crisply. ‘And that rarely works.’”
divorce love “‘Stop making that plea: it won’t work.’”
divorce infidelity “‘Frankly, I rather think there would have been cause enough for divorce without the perversely plentiful evidence of unfaithfulness.’”
divorce money “‘If you mean that the divorce will be expensive, I know it,’ she says. ‘But I can think of no happier investment.’”
marriage money “‘If you wish me to understand that it was a marriage for money, you could have spared your energy. That was patent from the outset.’”
infidelity money “‘I’m sorry, but I don’t see how having married for money excuses a subsequent infidelity.’”

This example exemplifies Emily Short’s tendency to produce conversation not from a single topic but from transitions between topics.

Section 13.12 is Relations which express conditions.

This gives another way of making relations:

Contact relates a thing (called X) to a thing (called Y) when X is part of Y or Y is part of X. The verb to be joined to means the contact relation.

As the text states, this is just a fancy way of writing ‘if’ statements, especially since we can’t just assert The hook is joined to the line, we can only check if it is.

The text goes on to show a useful example:

Nearness relates a room (called A) to a room (called B) when the number of moves from B to A is less than 3. The verb to be near means the nearness relation.

Instead of listening when the location is near the Sundial: say "You hear a splashing of water."

Another example (which is very useful to me, I posted on the forum for help with this recently):

Material is a kind of value. The materials are wood and metal. A thing has a material.

Materiality relates a thing (called X) to a material (called Y) when Y is the material of X. The verb to be made of means the materiality relation.

This lets you write:

if the cube is made of wood, ...
say "The carpenter looks at [the list of things which are made of wood].";

That last part is the ticket; relations are very easy to make lists out of, while values are not. So this is really a lifesaver for me in my current game.

Example 236 is Wainwright Acts.

THis points out that doors move as objects from the room on one side to the room on the other in order to follow the player, so NPCs may not be in the presence of a door if they’re on the other side from the player.

So you can get around that with this trick:
Liminality relates a door (called X) to a room (called Y) when the front side of X is Y or the back side of X is Y. The verb to be a threshold of means the liminality relation.

Definition: a person is other if he is not the player.

Every turn:
    repeat with indiscreet one running through other people:
        repeat with port running through open doors that are a threshold of the location of the indiscreet one:
            if the port is a threshold of the location and the indiscreet one is not in the location:
                say "Through [the port], you overhear [the indiscreet one] discussing [one of]his hopes for your imminent resignation[or]your wife's infidelity[or]your financially straitened circumstances[or]ways to avoid attending your birthday party[or]your halitosis[as decreasingly likely outcomes]."

Example 237 is Wayside flower:

Marriage relates one person to another (called the spouse). The verb to be married to means the marriage relation.

Fatherhood relates one person (called father) to various people. The verb to engender means the fatherhood relation.

Siblinghood relates a person (called A) to a person (called B) when a person who engenders A engenders B. The verb to be sibling to means the siblinghood relation.

Family relates a person (called A) to a person (called B) when A is married to B or A engenders B or B engenders A or A is sibling to B. The verb to be related to means the family relation.

To say relation between (first party - a person) and (second party - a person):
    if the first party is married to the second party:
        if the first party is female, say "wife";
        otherwise say "husband";
        rule succeeds;
    if the first party is sibling to the second party:
        if the first party is female, say "sister";
        otherwise say "brother";
        rule succeeds;
    if the first party engenders the second party:
        say "father";
        rule succeeds;
    if the second party is the father of the first party:
        if the first party is female, say "daughter";
        otherwise say "son";
        rule succeeds.
1 Like

Chapter 13, Relations (part 2)

13.13 is Relations involving values.

You can relate anything, not just objects:

Partnership relates various texts to various texts.

The verb to belong with means the
partnership relation.

"cheese" belongs with "crackers".
"clam" belongs with "chowder".

You can do conditions on this like so:

if "chalk" relates to a text by the partnership relation, ...
if a text relates to "cheese" by the partnership relation, ...
the text to which "chalk" relates by the partnership relation
the text which relates to "cheese" by the partnership relation

For multiple answers of this type:
list of texts which relate to "cheese" by the partnership relation
list of texts to which "chalk" relates by the partnership relation

Finally you can get every possible left hand side or right hand side:
list of texts which the partnership relation relates
list of texts which the partnership relation relates to

Some of the distinctions between these are very small, so it’s worth checking it carefully.

Example 238 is Meet Market:

Feature is a kind of value. The features are snub-nosed, gangly, comely, bright-eyed, and sulky.

Appearance relates various persons to various features. The verb to appear means the appearance relation.

Instead of looking:
    say "The snub-nosed ones: [list of people who appear snub-nosed][line break]";
    say "The gangly ones: [list of people who appear gangly][line break]";
    say "The comely ones: [list of people who appear comely][line break]";
    say "The bright-eyed ones: [list of people who appear bright-eyed][line break]";
    say "The sulky ones: [list of people who appear sulky][paragraph break]".

So this is just an example using relations for lists.

Example 239 is For Demonstration Purposes:
Capability relates various people to various stored actions. The verb to be capable of means the capability relation.

(as a side note, I don’t think you need to say ‘stored action’ anymore based on earlier material in this chapter).

Persuasion rule:
    let CA be the current action with no specific actor;
    if the person asked is capable of CA:
        persuasion succeeds;
    otherwise:
        say "[The person asked] look[s] confused. Maybe a demonstration would help.";
        persuasion fails.

The learning by observation rule is listed after the report stage rule in the specific action-processing rules.

Definition: a person is other if he is not the player.

This is the learning by observation rule:
    repeat with the viewer running through other people who can see the player:
        if the player is the actor and viewer is not capable of the current action:
            say "[The viewer] watches your behavior with interest. Seems like [they] [are] learning.";
            now the viewer is capable of the current action.

There’s some other heavy-duty code in here, but basically this lets other people learn from your actions.

Section 13.14 is Relations as values in their own right:

Parity relates a number (called N) to a number (called M) when N minus M is even.

Joint magnitude relates a number (called N) to a number (called M) when N plus M is greater than 7.

are both examples of relations, and they have the same kind:
relation of numbers to numbers, and every relation is between a kind K and a kind L (so this really is just set theoretical relations with domain K and codomain L). If K=L we call it a relation of K.

So you if you want to refer to a kind of relations you can do it like this:

To chart (R - a relation of numbers):
    repeat with N running from 1 to 5:
        repeat with M running from 1 to 5:
            if R relates N to M, say "[N] <=> [M] ";
        say "[line break]";

You can also write this for any relation:

if R relates X to Y, ...
now R relates X to Y;
now R does not relate X to Y;

Hmm, could you also repeat through relations? Sounds interesting.

Here are some adjectives applying to relations:

"empty" - nothing relates to anything else
"symmetric" - by definition X relates to Y if and only if Y relates to X
"equivalence" - this is a relation "in groups", or an "equivalence relation"
"one-to-one" - it relates one K to one L
"one-to-various" - similarly
"various-to-one" - similarly
"various-to-various" - similarly

Ha! I was right that relation ‘in groups’ was just an equivalence relation in a fancy hat.

You can clear out some relations with ‘now R is empty’, but not a lot of built-in ones.

Example 240 is Number Study.

Parity relates a number (called N) to a number (called M) when N minus M is even.

Joint magnitude relates a number (called N) to a number (called M) when N plus M is greater than 7.

To chart (R - a relation of numbers):
    repeat with N running from 1 to 5:
        repeat with M running from 1 to 5:
            if R relates N to M, say "[N] <=> [M] by [R][line break]";

When play begins:
    let L be { parity relation, joint magnitude relation };
    repeat with R running through L:
        chart R.

Huh, so you can repeat through some relations. Nice.

Section 13.15 is Temporary relations. You can create a new, empty relation like this:

let the password dictionary be a relation of texts;

By default, relations are various-to-various, but we could instead write, say:

let the nicknames catalogue be a various-to-one relation of texts;

There’s no verb created when you do this, but you can say something like this:

now the nicknames catalogue relates "Trudy" to "Snake-eyes";

Finally, section 13.16 is What are relations for?

It points out that most other design systems for IF don’t really have relations (I don’t remember Dialog having them. Does TADS?)

It says that relations are most useful when working on the internal motivations of people. Interesting…

Example 241 is Murder on the Orient express, where people suspect each other:

The Dining Car is a room. Lord Peter is a man in the Dining Car. Sherlock Holmes is a man in the Dining Car. Miss Marple is a woman in the Dining Car. Adam Dalgliesh is a man in the Dining Car.

Suspecting relates various people to one person.

The verb to suspect means the suspecting relation.

Dalgliesh suspects Holmes. Holmes suspects Lord Peter. Lord Peter suspects Holmes. Miss Marple suspects the player.
Instead of showing something to a person who suspects the player:
    say "'You would say that,' remarks [the second noun] darkly.".

Instead of showing something which exculpates the player to someone:
    say "'How striking!' says [the second noun]. 'Almost I begin to distrust myself.'".

Example 242 is What Not to Wear

This is a very long example similar to one we covered earlier, where garments overlay each other and different garments have different body parts. It’s complex enough that I don’t think a snippet will do it justice.

Example 243 is Mathematical view of relations, which basically covers everything I mentioned earlier. Cool! Things like reflexive, symmetric, transitive, and equivalence classes.

Example 244 is a graph theory view, which explains a bit about how route finding is calculated. It also mentions data storage use of relations:

All the cases are benign except for “various to various” - the most useful - and for its closely related symmetrical version, “relates… to each other”. Inform cannot afford to assume that the relation will be “sparse” (that is: that no vertex will have more than a certain number of arrows, or that the total number of arrows will be small), because it has no idea how the arrows will come and go during play. It therefore uses 1 bit of storage for each pair of objects. This sounds harmless, but if there are 200 rooms, there are 40,000 pairs of rooms, which means a 5000-byte allocation of storage (plus a handful of bytes as overhead). Gratuitous various-to-various relations are therefore not a good idea.

Pretty fun! I love math, so this is neat to read.

1 Like

Or, as was pointed out to me recently, you can say “the verb to be made of means the material property”. This is something I never knew about before, and accomplishes the same thing, but also lets you use the verb to set the property: “now the box is made of wood”.

Dialog sort of does, in that any binary predicate can be used in basically the same way as a relation in Inform. (Not just binary ones, either.)

4 Likes

There is probably no chapter I’m grumpier about than the relations chapter. And one big part of the problem is that it and Chapter 6: Descriptions are two parts of the same story: understanding relations, and verbs, and noun phrases, and how one makes sentences from them and what you can do with those. But the information is scattered all over and the dots aren’t connected.

I still struggle with this in practice. There are a couple of better behaviors we could wish for. Suppose we have:

Call sign is a kind of value.
The call signs are porcupine, flamingo, and axlotl.
Designation relates one person to one call sign.
The verb to be known as means the designation relation.
The player is known as axlotl.

At runtime we want to find the person known as axlotl. We know it’s a one-to-one relation, so that can’t refer to multiple values; it must be either nothing or some specific value. So I’ve often been enraged to be told

but ‘person who is known as axlotl’ is used in a context where I’d expect to see a (single) specific example of an object. Although what you wrote did make sense as a description, it could refer to many different values or to none, so it wasn’t specific enough.

Syntactically person who is known as axlotl is a description of values. It may semantically identify a single value, but the compiler isn’t checking that. But the random phrase:

To decide which K is a/-- random (S - description of values of kind K):

turns that description of values into a solitary K that syntactically satisfies Inform.

A decent alternative given that much of the time we’d want to test for whether the result was nothing anyway is:

if there is a person (called the salamander) who is known as axlotl: [...]
else: [...]

Another alternative is one of the phrases that let you talk about the relation without using a verb (that I can never get right without looking them up, and usually not for the first couple of times afterward):

let salamander be the person that relates to axlotl by the designation relation;

Now suppose we try to do the same with:

Cipher relates one number to one text.
The verb to encipher means the cipher relation.
5 enciphers "cat".
19 enciphers "sub".

[ ... then, within some code block ]]
if there is a number (called the passcode) that enciphers "cat" [...]
[or]
let x be a random number that enciphers "cat";

we get a runtime error.

*** Run-time problem P59: You can’t implicitly repeat through the values of this kind: a problem arising from a description which started out here - “if there is a number ( called the passcode ) that enciphers “cat””.

Inform is convinced (I assume because it’s actually true to the implementation) that to tell whether there’s a number that enciphers “cat” it should loop through all the numbers and test each for whether it enciphers “cat”. Even though it knows how to do:

say the list of numbers that the cipher relation relates;

So a bunch of relation functionality just doesn’t work for relations involving texts or numbers, and we’re never warned of that. (The full list of kinds of value Inform can’t iterate over is: number, real number, text, unicode character, snippet, action, equation name, rulebook outcome. I’m pretty okay with not being able to do this with the latter half of that list.)

6 Likes

Chapter 14 - Adaptive text and responses

Nice, after being in the weeds in the last few highly technical sections, this is a chapter that is not to hard to understand and is very useful.

IF is second person present, but we can change any of that. The main things we change are:

story viewpoint
story tense

In my current game, I have a murder mystery area where you interrogate people, and in their flashbacks they speak in first person past tense. At first it was hard to write all the responses but once I figured out this adaptive text stuff it was great.

The viewpoint is one of the following:

first person singular
second person singular
third person singular
first person plural
second person plural
third person plural

The tense is one of:

past tense
present tense
future tense
perfect tense
past perfect tense

The main thing to realize is only the main rules are automatically adapted. If you want your text to adapt, you have to make it that way.

For instance:

The Taj Mahal is a room. "You stand and admire the Taj Mahal."

When play begins:
    now the story viewpoint is first person plural;
    now the story tense is past tense.

prints out:

Taj Mahal
You stand and admire the Taj Mahal.

>e
We couldn't go that way.

It doesn’t automatically convert your message ‘you stand’. You have to write it in past tense yourself (or, as we’ll see in a bit, write it in an adaptive way).

Here are our first examples of adaptive text:
say [here] says ‘here’ in present tense and ‘there’ otherwise;
say [now] says ‘now’ in present and ‘then’ otherwise.

Section 14.2 is Adaptive text.

How do we write text if we don’t know the number of things?

For instance, the following code (from the text) has a mistake I’ve made many times:

Instead of taking: say "[The noun] is pinned down by Dr Zarkov's force field."

The problem with this is that if ‘the noun’ is plural or yourself it looks messed up:

> GET ME
You is pinned down by Dr Zarkov's force field.
> GET CONDENSERS
The condensers is pinned down by Dr Zarkov's force field.

You can adapt it like this:

Instead of taking: say "[The noun] [are] pinned down by Dr Zarkov's force field."

The [are] adapts to match whatever was in brackets earlier.

Now this I knew, and I used this a lot. I also knew you could define new verbs to adapt using the ‘is a verb’ construction we’ll see later. What I didn’t know is that Inform audomatically adapts any built in verb:

"[The noun] [carry] too much static charge."

including with negative versions:

"[The noun] [cannot touch] the ionizer terminal."

These adaptive features really make Inform shine (as compared to, for instance, standard python or other programming languages that aren’t text-focused).

This doesn’t work if you don’t put the noun in brackets.

"The condensers [are] working." won’t adapt.

And it doesn’t recognize that two brackets together make a plural:
"[The condensers] and [the V-ray] [are] smashed by Voltan's birdmen." prints ‘is’ instead of ‘are’. You can get around this with lists:

"[The list of things on the bench] [are] smashed by Voltan's birdmen."

No examples yet!

Section 14.3 is More on adapting verbs.

You can just say something is a verb like this:
To retrofit is a verb.

and inform adapts it.

I thought this was a separate construction from relation verbs from last chapter, but apparently it’s the same thing internally, just not attached to a relation.

Defined this way without meaning, it won’t work in code, but works in text like this:

"[The actor] [retrofit] the Mecha-Mole."

The weird thing is I thought we had to write [adapt the verb retrofit], which is what I have in my code.

So I have this:
To mark is a verb.

say "[We] [adapt the verb mark] [the noun] with [the second noun].";
				now the noun is marked;

But it sounds like the ‘adapt the verb’ part is unnecessary.

You can use this in ‘actor’ rules like this:

say "[The actor] [put] [the noun] on [the second noun]."

Example 245 is Fun with participles:

Describing relates various verbs to various action names. The verb to describe means the describing relation.

To look around is a verb. The verb look around describes the looking action.

To stand about is a verb. The verb stand about describes the waiting action. To look bored is a verb. The verb look bored describes the waiting action. To waste time is a verb. The verb waste time describes the waiting action.

To jump is a verb. To leap is a verb. To pirouette is a verb. The verb jump describes the jumping action. The verb leap describes the jumping action. The verb pirouette describes the jumping action.

A person has an action name called the current idle. The current idle of a person is usually the waiting action.

Rule for writing a paragraph about someone (called chosen person) when a verb describes the current idle of the chosen person:
say "[The chosen person] [are] here, [present participle of a random verb that describes (the current idle of the chosen person)]."

After Clark doing something when a verb describes (the action name part of the current action):
    say "'Fine, have it your way!' Clark exclaims. 'But I have [past participle of a random verb that describes (the action name part of the current action)] for the last time!'";
    rule succeeds.

Example 246 is Variety:

Describing relates various verbs to various action names. The verb to describe means the describing relation.

To take is a verb. To acquire is a verb. To get is a verb.

The verb take describes the taking action. The verb acquire describes the taking action. The verb get describes the taking action.

To drop is a verb. To put down is a verb. To discard is a verb. The verb drop describes the dropping action. The verb put down describes the dropping action. The verb discard describes the dropping action.

To sniff is a verb. To smell is a verb. The verb sniff describes the smelling action. The verb smell describes the smelling action.

To jump is a verb. To leap is a verb. To pirouette is a verb. The verb jump describes the jumping action. The verb leap describes the jumping action. The verb pirouette describes the jumping action.

After an actor doing something when the noun is nothing and a verb describes (the action name part of the current action) (this is the apply random verbs to describing nounless actions rule):
say "[The actor] [verb rendering applied to a random verb that describes (the action name part of the current action)].";
rule succeeds.

Variety 2 is like variety 1 but also mentions the change in your state:

After an actor doing something to something when a verb describes (the action name part of the current action) (this is the apply random verbs to describing actions rule):
    let current action name be the action name part of the current action;
    if a random chance of 1 in 2 succeeds and the current action name is a related action listed in the Table of Action Results:
        choose a row with the related action of current action name in the Table of Action Results;
        let R be the relation entry;
        let subject be the actor;
        let chosen object be the noun;
        say "[The subject] [are] now [present participle of a random verb that means R] [the chosen object].";
    else:
        say "[The actor] [verb rendering applied to a random verb that describes (the action name part of the current action)] [the noun].";
    rule succeeds.

Example 248 is Narrative Register:

THis is a very complex example that has a table of verbs and actions with a list of tags/registers for the verb and a blank column called ‘relevance’. A register is selected at random and then every verb with that register is given a point of relevance. Then, when speaking, a random high-relevance word is chosen.

I can only suppose The Mary Jane of Tomorrow included a system like this (but more complex), as it had procedural generation that included ‘registers’ like ‘speaking in french’, ‘politeness’, etc. Honestly a truly great game.

Section 14.4 is adapting text about the player.

Inform’s responses automatically adapt to the tense and story viewpoint. They do this by using adaptive text for subjects.

[We] is the standard thing to use, I think because it varies the most in declension (whereas ‘you’ is the same in nominative and accusative).

So you can write:
"[We] [carry] the Queen's warrant."

and it will adapt to ‘You carry’ or ‘we carried’ or ‘i will carry’, etc.

These are the versions of ‘us’ we can use:

"[We]" or "[we]"
"[Us]" or "[us]"
"[Our]" or "[our]"
"[Ours]" or "[ours]"
"[Ourselves]" or "[ourselves]"

Section 14.5 is Adapting Text rferring to other things

This is for adapting stuff besides the player.

You can do this with [They] if we proceed this with [regarding the noun]:

Instead of examining in the Netherworld:
    say "[regarding the noun][They] [have] no clear outline in this misty netherworld."

This is used if we haven’t just printed the name of something with a text substitution. If we have, we don’t need ‘regarding the noun’, like this:

"[We] [have] a look at [the noun], but [they] [are] just too big."

This can print all of the following:

I had a look at Peter Rabbit, but he was just too big.
You have a look at the chessmen, but they are just too big.
We have a look at ourselves, but we are just too big.

There’s also the impersonal ‘it is’ or ‘there is’:

"[We] [take] [the noun]. [It] [rain] harder."

Specifically, we can adapt:

"[It's]" or "[it's]"
"[There's]" or "[there's]"

And if you have a number (for instance, a variable called ‘dud count’):
"Honestly, [dud count][regarding the dud count] of these [are] broken."

Section 14.6 is Adapting demonstratives and possessives

This is if you want to say ‘You can’t reach that!’ but have the possibility of saying ‘those’ instead if it’s plural.

You just say [those], with a [regarding the noun] if we haven’t printed the name of the object recently:

"[We] really [are not] tall enough to reach [regarding the noun][those]."

You can also print the possessive of a noun:

“[regarding the noun][Possessive] height [are] just too great.”

I’ve never used this! Nice.

You can use ‘regarding’ for multiple items matching a description:

say "Every possession is a worry. I wonder if [regarding things carried by the player][they] still [look] okay in your pocket?"

Upper case [Those] is assumed to be nominative and lower case [those] is assumed to be accusative. If you need one of them specifically you can type it like this:

"[those in the nominative]"
"[Those in the accusative]"

Example 249 is Olfactory settings:

Instead of eating something inedible, say "[The noun] [don't] seem likely to agree with [us] at all. [We][']d be wiser to leave [regarding the noun][them] alone."

Instead of touching something: say "[regarding the noun][Those] [are] all prickly."

Instead of smelling something: say "[Our] nose [regarding nothing][are] too weak to get much smell from [regarding the noun][those]."

Instead of smelling the bouquet: say "[regarding the noun][They]['re] lovely."

Instead of tasting something:
    say "Whew, [regarding the noun][are] [those] ever nasty!"

Section 14.7 is Can, could, may, might, must, should, would.

These can be used like so:

"[can V]" or "[cannot V]" or "[can't V]"
"[could V]" or "[could not V]" or "[couldn't V]"
"[may V]" or "[may not V]" or "[mayn't V]"
"[might V]" or "[might not V]" or "[mightn't V]"
"[must V]" or "[must not V]" or "[mustn't V]"
"[should V]" or "[should not V]" or "[shouldn't V]"
"[would V]" or "[would not V]" or "[wouldn't V]"

where you replace ‘V’ with a verb that inform knows. If it doesn’t know it, just say ‘to whatever is a verb’.

You can do complex stuff like "[Fred] [might not discombobulate] so easily."

Section 14.8 (this is really an examples-light chapter, but it’s clear so it’s fine) is Adapting contractions.

To contract ‘to be’ and ‘to have’ at the end of other words, do “['re]” and “['ve]”:

"[We]['ve] got rhythm. [We]['re] cool."

This can produce stuff like:

“I’ve got rhythm. I’m cool.”, or “He’ll have rhythm. He’ll be cool.”, or “You had got rhythm. You were cool.” (The contractions don’t appear in the past tense; but the spacing fixes itself automatically.)

Inform 7 has a few special substitutions only really used in the rules, like [They're] hardly portable, which is almost exactly lik [They]['re] but:

the singular would be “It’s hardly portable” not “That’s hardly portable”.)

Here are 4 other things Inform knows:

"[aren't]"
"[don't]"
"[haven't]"
"[won't]"

Code like this:

Instead of taking something:
    say "[The noun] [are] pinned down by Dr Zarkov's force field. [They] [aren't] free to move. [They] [can't] move. [They] [won't] move. [They] [haven't] a chance to move. Anyhow, [they] [don't] move."

can make text like this:

The condensers are pinned down by Dr Zarkov's force field. They aren't free to move. They can't move. They won't move. They haven't a chance to move. Anyhow, they don't move.

You were pinned down by Dr Zarkov's force field. You weren't free to move. You couldn't move. You wouldn't move. You hadn't a chance to move. Anyhow, you didn't move.

Section 14.9 is Verbs as values.

You can make verbs be considered values by putting ‘the verb’ in front of it:
the verb contain.

If you use ‘showme the meaning of…’ it produces output like this:

"meaning of the verb contain" = relation of objects: containment relation
"meaning of the verb provoke" = relation of objects: equality relation

Here ‘provoke’ would be something we defined earlier. If it has no relation on its own it jus tprints equality relation.

Inform itself uses the verb to ‘mean’, with meaning being the meaning relation. So you can have something like this:

the list of verbs meaning the containment relation

which produces the following:
list of verbs: {verb contain}

Here are some other things you can type:
say "[adapt (verb)]"

This adapts the verb to the story viewpoint. I mentioned this earlier; maybe it’s only useful when [we] has not yet been printed?

You can also adapt from a different viewpoint or tense:
say "[adapt (verb) from (narrative viewpoint)]"

or

say "[adapt (verb) in (grammatical tense)]"

This is great! I had to write something in past tense in just one phrase so I was changing the whole story viewpoint for one rule. This is much nicer.

You can combine them both:

"we [adapt the verb provoke in the future tense from the first person plural]"

You can negate things in the current tense:

say "[negate (verb)]"
(this would be like ‘adapt not verb’, which wouldn’t work)

You can combine that with the above stuff too:
"we [negate the verb provoke in the future tense from the first person plural]"

(It’s like the last chapter was the mathematician’s chapter and this chapter is the English professor’s chapter).

These constructions work for a verb variable:

To decide which text is the rendering of (V - verb) (this is my rendering):
    decide on "[negate V in the past perfect tense]".

When play begins:
    showme my rendering applied to the list of meaningful verbs.

This produces (remembering that ‘meaningful’ means ‘this verbs is connected to a relation’):

"my rendering applied to the list of meaningful verbs" = list of texts: {"had not had", "had not related", "had not meant", "had not provided", "had not contained", "had not supported", "had not incorporated", "had not enclosed", "had not carried", "had not held", "had not worn", "had not been able to see", "had not been able to touch", "had not concealed", "had not unlocked"}

We can also say ‘infinitive of’, ‘past participle of’, and ‘present participle of’.

Some of these are bad for defective verbs (giving results like ‘mighted’ or ‘shoulding’).

Example 250 is History Lab:

After printing the name of something (called item):
    if the last action of the item is not waiting and the last action of the item is not the current action:
        let chosen action-name be the action name part of the last action of the item;
        let chosen actor be the actor part of the the last action of the item;
        if a verb describes the chosen action-name:
            let the chosen verb be a random verb that describes the chosen action-name;
            say " [if the chosen actor is the player][we][else][chosen actor][end if] [adapt chosen verb in past tense]";

Example 251 is Relevant Relations. This example uses forbidden tech:

The following uses what is, strictly speaking, a piece of internal machinery not really intended for public use: a variable called “prior named object” which keeps track of what noun other words should agree with. It is not safe to use this variable except to clear it: “now the prior named object is nothing”. In a few situations, this prevents glitches in adaptive text.

Rule for writing a paragraph about something (called item):
    now the current paragraph is { };
    say "[one of][regarding item]There [are] [an item] here[or][We] [can see] [an item] here[at random]. [run paragraph on]";
    follow the descriptive rules for the item;
    repeat with new item running through the current paragraph:
        now the prior named object is nothing;
        if new item is not the item:
            follow the descriptive rules for the new item;
    say paragraph break

There’s a lot I don’t understand here but I don’t feel compelled to learn it. For instance, why do we set current paragraph to {} and then run through it? It must have changed…how? It’s just a weird example.

Section 14.10 is responses. The stuff in this section is vital (to me) for making a good game.

Inform automatically has built in responses:

EAST
You can’t go that way.

JUMP
You jump on the spot.

These responses have names. In the standard rules, something might say:

Carry out taking inventory (this is the print empty inventory rule):
    if the first thing held by the player is nothing,
        say "[We] [are] carrying nothing." (A) instead.

Then the name of the message at the bottom is “empty inventory rule response (A)”. If you write your own rules in an extension, you should name your rules in this format so others can change them.

With that name, you can print them:

print empty inventory rule response (A)

or we can print them like this:
say "Hmm: [text of print empty inventory rule response (A)]"

Section 14.11 is Changing the text of responses, which is what players will want to do to make their game cool:

The print empty inventory rule response (A) is "Your hands are, like, totally empty. Lame."

You can even change this dynamically (hmm I didn’t realize that!):

now the print empty inventory rule response (A) is "Your hands ...";

In my personal experience and for my personal tastes, changing all the rule responses (or at least the 30 or so most common ones) really makes or breaks the atmosphere in a game. Most of a parser game is typing in errors as you explore the boundaries of a world or just mess up. The standard responses then become the main bulk of your ‘story’.

Unfortunately, I don’t always change them myself, as my faithful testers can woefully attest (sorry testers!)

To see all the names of responses in the game just type RESPONSES ALL and copy them. If you’ve never seen a rule, don’t change it; if you have, change it to make it fit your game (is my advice).

Example 252 is Responsive:

When play begins:
    now print empty inventory rule response (A) is "[We] [have] absolutely nothing.".

Sectoin 14.12 is The RESPONSES testing command, which I just mentioned. You can type RESPONSES which lists the sets of possible responses, and then you can pick from them with something like:

> RESPONSES 1
Standard Rules:
    block vaguely going rule response (A): "You'll have to say which compass direction to go in."
    print the final prompt rule response (A): "> [run paragraph on]"
    ...

So, this is a ‘core chapter’ that is easy to understand. Pretty wild coming after ‘relations’, which was highly technical and not something most players will use. I love chapter 14.

The next chapter is math, which should be fun.

3 Likes

The two pronouns that are most useful for this are “we” (us, our, ours) and “they” (them, their, theirs), because all four forms are distinct. Most other pronouns don’t have this property: “it” (it, its, its), “he” (him, his, his), “she” (her, her, hers), “you” (you, your, yours).

Technically “I” (me, my, mine) and “thou” (thee, thy, thine) also work, but most people don’t know how to conjugate verbs for “thou” any more (thou art, thou knowest), and for “I” it’s awkward to write “[I] [are] in a…”. So Inform uses “we” to mean “the pronoun for the player character” and “they” to mean “the pronoun for the most recently mentioned noun”. This generally works pretty well.

There’s also “those”, for if you want a demonstrative, but this runs into the problem you mention: the subject form and object form look the same! Inform’s solution is to assume that capital “[Those]” is a subject and lowercase “[those]” is an object, which mostly works but occasionally produces very annoying bugs. “[Those in the accusative]” and “[those in the nominative]” are actually a later addition to the language, iirc, after these bugs started showing up.

One special thing to note: the name of the verb “to be” is actually “are”, not “be”. (This is so that you can say [They] [are] or [We] [are] instead of [They] [be] and [We] [be].) It used to be that you had to say “[can are]” and “[would are]” and so on, since Inform didn’t realize that “be” and “are” are the same verb. I think this is fixed now.

I didn’t realize this was forbidden. If you want to do Advanced Pronouns™ or anything like that, you need to be able to check this to get your references right. I wonder why they say not to do that?

Anyway, if you want to clear the variable, the other way to do it is “[regarding nothing]”. (Setting this variable is what “regarding” means in general.)

It’s also one of the newest chapters in the book! Inform didn’t originally have these features; if you ever see a project using the extension Plurality by Emily Short, that was a much less elegant stop-gap created to deal with this deficit.

3 Likes

I believe it would be the other way around. If “I” had been chosen, we would have to write "[I] [am]" but "[They] [am]". English is lucky to have the same form for “we” and “they” so I guess it was better to choose those. In French, “tu” was chosen (for having the most distinct forms) so we have "[Tu] [es]" and "[Il] [es]" (instead of “est” for the latter).

Maybe it’s because we can also use regarding open containers (with a description for argument) or regarding 729 (with a number for argument). So the full state is not solely encoded in the prior named object variable. We can see in the English Language that the condition if the prior naming context is plural is used, instead of if the prior named object is plural-named (so that it works if we regarded a number or a description of objects).

But all this information is not that useful for regular authors. (But very useful for translators!)

3 Likes

That is correct. There’s actually three I6 variables in there (prior_named_noun, prior_named_list, prior_named_list_gender). If the first is set to nothing, the other two are ignored. But for other cases, you need to set them all as a group, which is what “[regarding X]” does.

4 Likes

It’s the second-last day of the month, and this is certainly the dorkiest piece of prose I’ve read this month. Good on you, Inform!

-Wade

2 Likes

Thanks for all the fun feedback on this.

Reading the manuals and getting help has been so fun and useful!

For instance, I said earlier I had given up having the player’s actions appearing on a security camera, because I’d have to write custom stuff for each action.

But from these last few lessons, I realized I didn’t have to do every action; I could just come up with descriptions of what the most important actions look like.

Then, I was worried that I wouldn’t know if an action failed or succeeded when showing it on the camera. Then, I realized that that is what Check, Carry out, and Report is for! If it passes ‘check’, then it succeeds; so I split up all my new functions (that only had ‘carry out’) into Check, Carry Out, and Report, and wrote an After rule for functions that adds a message about what the player just did to the list of the camera feed. It only fires for successful functions!

And usually I’d be too scared to add an after rule since it makes the text disappear, but I’ve now learned I can type ‘continue the action!’

This is my current code:

EyeballList is a list of text that varies. EyeballList is {"yourself staring into the camera"}.

To say randomflavor:
	say "[one of]nervously[or]fearfully[or]with great trepidation[or]with terror in [our] eyes[at random] "

After the player doing something when the player is in spell-region:
	say "The current action is [the current action].";
	if the action name part of the current action is a behavior listed in the table of monitored activities:
		choose the row with behavior of action name part of current action in the table of monitored activities;
		let behaviorpart be "[summaries entry]";
		choose the row with locale of the location in the table of Room shorthands;
		let localepart be "[summaries entry]";
		add "[behaviorpart] [if a random chance of 1 in 4 succeeds][randomflavor][end if][localepart]" to EyeballList;
		if the number of entries in EyeballList > 10:
			sort EyeballList in random order;
			truncate EyeballList to the last 10 entries;
	continue the action;

Table 1 - Monitored Activities
behavior	summaries
the taking inventory action	"[the player] looking through [their] possessions"
the anghofioing action	"[the player] wiping [their] memory"
the bywyding action	"[the player] casting a spell and looking at [their] spellbook"
the clapping action	"[the player] clapping"
the closing action	"[the player] closing [the rucksack]"
the crying action	"[the player] crying"
the dancing action	"[the player] dancing"
the deffroing action	"[the player] casting a spell"
the denuing action	"[the player] casting a spell that makes metal fly towards you in a terrifying way"
the dropping action	"[the player] dropping something"
the examining action	"[the player] looking intently at something"
the fladhing action	"[the player] erupting into a pile of black sand"
the flying action	"[the player] soaring through the air"
the going action	"[the player] moving quickly"
the goping action	"[the player] pointing and casting a spell"
the hedfaning action	"[the player] casting a spell and rising into the air"
the hunigoing action	"[the player] sending a shower of black sparks around [themselves]"
the hyblyging action	"[the player] casting a spell that melts bones"
the jumping action	"[the player] leaping"
the kissing action	"[the player] kissing something"
the llosging action	"[the player] bursting into flames"
the looking action	"[the player] staring around"
the nwyding action	"[the player] casting a spell and becoming enraged, running around"
the pydruing action	"[the player] casting a spell and becoming covered in sores, weeping"
the reading action	"[the player] reading"
the searching action	"[the player] searching around"
the shouting action	"[the player] shouting"
the sleeping action	"[the player] dozing off"
the squeezing action	"[the player] squeezing something"
the taking action	"[the player] grabbing something"
the touching action	"[the player] touching something"
the thinking action	"[the player] standing around, thinking"
the waiting action	"[the player] staring at the camera"
the waving hands action	"[the player] waving at the camera"
the wearing action	"[the player] getting dressed"

Table 2 - Room shorthands
locale	summaries
black-dome	"standing in a hemispherical dome"
lonely-room	"in an underground village"
buried-room	"in an impossibly tight crevice"
end-room	"in a graveyard of bodies"
vast-room	"while standing on the edge of a towering cliff"
eye-room	"in this very room"
stranger-room	"standing near a humanoid figure"
desolation-room	"in a room filled with flames"
corruption-room	"in a room crawling with insects of every kind"
flesh-room	"in a room filled with bizarre beasts"
hunt-room	"in an empty room"
slaughter-room	"in a room with a cage"
vast-ladder	"while clinging to a ladder"
web-room	"in a room filled with cobwebs"
spiral-room	"in a bizarre maze of shifting colors"
dark-room	"in front of a completely dark background"
lonely-house	"inside a stone house"
lonely-alley	"between two houses"
north-lonely	"next to a tall crack"
air-scroll	"near a giant stalactite"
air1	"while flying in mid-air"
air2	"while flying in mid-air"
air3	"while flying in mid-air"
air4	"while flying in mid-air"

I would never have been able to do something like this without this thread, so thanks to people who have been following along!

7 Likes

Chapter 15 : Numbers and Equations

I always saw this and the tables and lists chapters as being the most straightforward: here is a niche topic that you will either not use at all or will need to know everything about all at once.

15.1 is How do we measure things?

This section just mentions that usually exact numbers aren’t super useful in fiction and that when they are, units are useful.

You can make up new kinds of numbers with units like this:

A distance is a kind of value. 5 miles specifies a distance.

There are two built-in numerical values: number and real number.

Section 15.2 is Numbers and Real Numbers. This is basically like ints and floats, except that the max size of a ‘number’ in z-machine is 32767, while the max number size for Glulx is 2147483647.

These are pretty low numbers compared to most programming languages, but if you have a game that is using calculations of numbers higher than 2 billion, you’re either Mike Spivey or lost in the woods.

(actually here’s Mike Spivey’s comment on this in his Junior Arithmancer postmortem):

While running my own tests on the game I ran into a problem I hadn’t anticipated. Glulx has a maximum integer capacity of just over 2 billion, and you can combine the spells in ways that will generate numbers larger than that. This was going to ruin the player’s sense of immersion in the game! I was really frustrated and disappointed for about ten minutes, until I remembered the improv motto of “Yes, and…” O.K., let’s just make the integer overflow a feature of the game and write a puzzle where you have to contend with it. (Andrew Schultz later called this a “fun evil” puzzle during testing. I’m good with that.)

Real numbers are truncated to between 6 and 9 decimal places.

showme 1.2345654321;
showme 1.2345667890;

produces

real number: 1.23457
real number: 1.23457

Inform does support scientific notation (I didn’t know this!):
let Avogadro's number be 6.022141 x 10^23;

Inform also recognizes pi and e as real numbers, in lowercase.

If Inform has the Use engineering notation option set, you can write things this way:
6.022141E+23;

I’m trying to think of games that could use these math abilities…I guess the recent Jigsaw let’s play showed how trigonometry is useful…

Example 253 is Alias, about american phone numbers. It uses some tricks we haven’t been taught yet:

A telephone is a kind of thing. Understand "phone" or "telephone" as a telephone.

A phone number is a kind of value. 999-9999 specifies a phone number.

Understand "Stephen" as 555-2513 when the blue paper is examined.

Test me with "dial 555-9999 / call home on the telephone / phone the president / call stephen / open drawer / read paper / call stephen / put phone in drawer / close drawer / call stephen".

Section 15.3 is Real number conversions. It mentions that it’s just here for technical reasons and is not useful for most people.

If a number is expected to be a real number (i.e. a decimal) and a number (i.e. an integer) is used, it’s converted to a decimal.

So cosine of 2 is redirected to cosine of 2.0.

‘divided by’ will find only the whole-number quotient if just numbers are used, and the decimal approximation if any of the numbers involved is real:

3 divided by 2 = 1
3 divided by 2.0 = 1.5
3.0 divided by 2 = 1.5
3.0 divided by 2.0 = 1.5

To round real numbers to whole numbers:

1.4 to the nearest whole number = 1
1.6 to the nearest whole number = 2
-1.6 to the nearest whole number = -2

Sometimes the ‘nearest number’ is just the max number:
6 x 10^23 to the nearest whole number = 2147483647

since we literally can’t go any higher.

Inform also supports infinity:
plus infinity, minus infinity

So showme 1.0 divided by 0.0 is plus infinity, but showme 1 divided by 0 gives a runtime error.

Also instead of runtime errors with real numbers inform will produce a ‘nonexistent real number’ for things like the square root of a negative or logarithm of a negative. It’s the equivalent of NaN.

Section 15.4 is Printing real numbers

We can print to a certain decimal place:

"The semicircle is roughly [pi to 3 decimal places] paces around."
"[1.23457 x 10^8 in decimal notation]"
(the latter prevents inform from using scientific notation)

These can be combined:
"[ (real number) to (number) decimal places in decimal notation]

Or you can just pick scientific notation:
"[the reciprocal of 137 in scientific notation]"

and finally:
say "[(real number) to (number) decimal places in scientific notation]".

Section 15.5 is Arithmetic:

We can do addition with either + or plus, and it respects units:

200 + 1 = 201
10:04 AM + two minutes = 10:06 AM
200 plus 1 = 201

minus:

200 - 1 = 199
10:04 AM - two minutes = 10:02 AM
200 minus 1 = 199

times:

201 times 3 = 603
two minutes times 4 = eight minutes
201 multiplied by 3 = 603
201 * 3 = 603

divided by (which does either the quotient for whole numbers of long division for real numbers):

201 divided by 3 = 67
201 / 3 = 67
202 divided by 3 = 67
202.0 divided by 3 = 67.33334
twenty minutes divided by 4 = five minutes
twenty minutes divided by five minutes = 4

you can divide by 0 in real numbers (getting plus infinity or minus infinity) but not whole numbers.

For modular arithmetic:

remainder after dividing 201 by 5 = 1
remainder after dividing twenty minutes by 7 = six minutes

We can either use symbols or spell out the words for operations

(If we do use the symbols, then spaces around them are obligatory: to Inform, they are words which just happen to be spelt with symbols instead of letters.)

We can round to any granularity:

201 to the nearest 5 = 200
205 to the nearest 10 = 210
10:27 AM to the nearest five minutes = 10:25 AM

We can do approximate square roots, which are slow in z-machine:

square root of 16 = 4 (always gives whole number)

real square root of 2 = 1.41421

cube root of 27 = 3

‘real cube root’ is not supported.

This next part is one where I’ve been tripped up; we can’t use the equal sign for comparisons!

We can type out or use symbols for inequalities:

if the score is less than 10
if the score < 10
if the score is at least 10
if the score >= 10

But we cannot write if the score = 10, we have to write if the score is 10, which is a little goofy but what can you do.

Section 15.6 is Powers and logarithms

First is rounding up:

ceiling of pi = 4.0
ceiling of -16.315 = -16.0

Next is rounding down:

floor of pi = 3.0
floor of -16.315 = -17.0

Next is absolute value:

absolute value of 62.1 = 62.1
absolute value of 0 = 0.0
absolute value of -62.1 = 62.1
absolute value of minus infinity = plus infinity

and reciprocals:

reciprocal of -2 = -0.5
reciprocal of 0.1 = 10.0
reciprocal of 7 = 0.14286
reciprocal of plus infinity = 0.0

(which is nice since 1 / 2 would just give 0)

Now there are powers:

2 to the power 4 = 16.0
100 to the power 0.5 = 10.0
7 to the power -1 = 0.14286
pi to the power 0 = 1.0

In the words of the Glulx specification document (section 2.12), “the special cases are breathtaking”: if you need to know exactly what, say, “minus infinity to the power Y” will do for different cases of Y, refer to the details of the “pow” opcode.

For square roots, don’t do 0.5 power, but for other roots, you can type:

X to the power (reciprocal of N)

For a base of e, we can say ‘exponential of’, which is presumably faster is it probably uses the maclaurin series instead of first plugging in e into the other power equation:

exponential of 0 = 1.0
exponential of 1 = e = 2.7182818
exponential of -10 = 4.53999 x 10^-5
exponential of 10 = 22026.46484
exponential of logarithm of 7.12 = 7.12

(I was teaching students the Maclaurin series for e^x just today!)

Logarithms are like so (man, why are you doing logarithms in an inform game):

logarithm to base 10 of 1000000 = 6.0
logarithm to base 10 of 350 = 2.54407
logarithm to base 2 of 256 = 8.0

and for base e (logarithm and natural logarithm mean the same thing):

logarithm of e = 1.0
natural logarithm of e = 1.0
logarithm of 1 = 0.0
logarithm of 1000 = 6.90776
logarithm of exponential of 7.12 = 7.12

Section 15.7 is Trigonometry.

Inform naturally uses radians (I’m guessing again due to Maclaurin series), but if you want sine and cosine to use degrees, just say so.

Here are some trig examples:

sine of 0 = 0
sine of 45 degrees = 0.70711
sine of (pi divided by 4) = 0.70711
sine of (pi divided by 2) = 1.0
sine of pi = 0
cosine of 0 = 1.0
cosine of 45 degrees = 0.70711
cosine of (pi divided by 4) = 0.70711
cosine of (pi divided by 2) = 0.0
cosine of pi = -1.0
tangent of 0 = 0.0
tangent of 45 degrees = 1.0
tangent of (pi divided by 4) = 1.0
tangent of (pi divided by 2) = plus infinity

(technically the last one should be plus infinity from the left and negative infinity from the right but man if you’re doing tangent of (pi divided by 2) in an actual Inform game the heavens have abandoned you anyway and you must bear your curse alone.

We also can do arcsine, arccosine, arctangent, hyperbolic sine, hyperbolic cosine, hyperbolic tangent, hyperbolic arcsine, hyperbolic arccosine (come on now Mr. Nelson, this is going too far), and hyperbolic arctangent.

Section 15.8 is units:

To assign a number to a person you can say:

A person has a number called height.

Inform claims this is dumb, as then you’d have to say Isabella has height 68 (which is exactly what I did with my rockclimbing rocks).

Instead, Inform wants you to be able to write ‘Isabella is 5 foot 8’ and have it understood.

We begin this by saying something like:

A weight is a kind of value. 10kg specifies a weight.

This is different from other kinds of values, where we explicitly listed all of the possibilities:

A colour is a kind of value. The colours are red, green and blue.

This is basically the separation between categorical and numerical data in stats.

The ‘10’ in ‘10 kg’ isn’t really important, it’s just showing inform what a typical weight might look like. So after that line you can say stuff like this:

The maximum load is a weight that varies. The maximum load is 8000kg.

if the maximum load is greater than 8000kg, ...

And inform doesn’t let numbers of different unit types mix.

You can now use the numerical values like numbers, except that units will print:

For instance, we can write:

The Weighbridge is a room. "A sign declares that the maximum load is [maximum load]."

…which will produce the text “A sign declares that the maximum load is 8000kg.”

The default is whole numbers only.

If you want a real number, type this kind of thing:

1.0 kg specifies a weight.

For whole number specifications, we can only use positive numbers. If you want negatives, say this:

-10 kg specifies a weight.

Time for examples!

Exampe 254 is rBGH:

A counter, a one-way mirror, and a stool are scenery in the Facility. The stool is an enterable supporter. The counter supports a plate.

Height is a kind of value. 5 feet 11 inches specifies a height. 5'11 specifies a height. A person has a height.

Definition: a person is tall if its height is 6 feet 0 inches or more.

Definition: a person is short if its height is 5 feet 4 inches or less.

When play begins:
now the height of the player is a random height between 5 feet 2 inches and 6 feet 4 inches;
now the right hand status line is "[height of player]".

Instead of examining the player:
say "You, Test Subject, are [height of the player] tall."

The growth pill is a kind of thing. A growth pill is always edible. The description is usually "It is leaf-green and has a reassuring logo of a curling vine on the side. Nothing to worry about, nothing at all." Two growth pills are on the plate.

After eating the growth pill:
increase the height of the player by 0 feet 6 inches;
say "Your spine does something frightening and painful, and you find yourself looking down on the room from a wholly new angle.";
try looking.

Example 255 is Lethal concentration 1:

This is a very complex example, which reminds me of an old XYZZY nominee called Oxygen (or something). I can’t copy everything, but here’s the idea:

A concentration is a kind of value. 200.9ppm specifies concentration. 200.9 ppm specifies concentration.

A room has a concentration called current concentration. A room has a concentration called former concentration.

Probability inverse is a number that varies. [This is expressed as an inverse of the actual probability of diffusion from one room to another, to avoid error.] Probability inverse is 20. [That is, any given molecule of gas has a 5% chance of leaving by a given doorway at any given minute. Probability inverse should never drop below 10, the maximum number of exits from the room.]

A diffusion rule (this is the gas movement rule):
    repeat with space running through rooms:
        let sum be 0.0 ppm;
        repeat with way running through directions:
            let second space be the room way from the space;
            if second space is a room:
                let difference be the former concentration of the second space minus the former concentration of the space;
                increase sum by the difference;
        let sum be sum divided by probability inverse;
        now current concentration of the space is the former concentration of the space plus the sum.

This kind of diffusion is exactly how amenability is studied in geometric group theory, and my advisor did this stuff a lot.

This example also gives a text map of the whole game with concentrations marked, and has gas sources and sinks, etc. Pretty wild!

Example 256 is Wonderland

An altitude is a kind of value. 1000 feet specifies an altitude. A room has an altitude.

Definition: a room is low if its altitude is 3000 feet or less. Definition: a room is high if its altitude is 5000 feet or more.

Instead of going down:
    if an adjacent room is lower than the location:
        let the valley be the lowest adjacent room;
        let the way be the best route from the location to the valley;
        say "(that is, [way])[paragraph break]";
        try going the way;
    otherwise:
        say "You're in a local valley: there's no down from here."

Instead of going up:
    if an adjacent room is higher than the location:
        let the peak be the highest adjacent room;
        let the way be the best route from the location to the peak;
        say "(that is, [way])[paragraph break]";
        try going the way;
    otherwise:
        say "You're on a local peak."

Example 257 is Lethal Concentration 2

This makes gas more likely to sink down than up:

To decide what number is the probability inverse between (space - a room) and (second space - a room):
    let guess be 20;
    let way be the best route from space to second space;
    if way is up, let guess be 50;
    if way is down, let guess be 10;
    if the guess is less than 10, decide on 10;
    decide on guess.

Section 15.9 is Multiple notations

You can have mutliple units for a weight, including versions with spaces or multiple words:

A weight is a kind of value. 10kg specifies a weight. 10kg net specifies a weight. 10 kg specifies a weight.

You can also scale units:

1 tonne specifies a weight scaled up by 1000.

You can specify singular and plural:

1 tonne (singular) specifies a weight scaled up by 1000.
2 tonnes (plural) specifies a weight scaled up by 1000.

Which of the 3 version of kg will inform print? I will find out.

Hmmm, I made a value using ‘10kg net’ and it printed as ‘10kg’, so I assume it prints with the first format you use.

Section 15.10 is Scaling and equivalents

If you use whole numbers in your original definition, inform will require you to use whole numbers all along.

So if you say 1 kg specifies a weight, you can’t have fractions.

But… you can scale things up and down.

A length is a kind of value. 1m specifies a length.
1km specifies a length scaled up by 1000.
1cm specifies a length scaled down by 100.

So you can type 3cm, 0.03m, and 0.00003km all mean the same thing, and inform starts using decimals.

Inform takes the smallest ‘scale’ and lets that go up to the max number (around 2 billion for glulx), so if you scale things by 2 billion, the largest scale can only go up to 2!

You can pick the scaling yourself like this:
A length is a kind of value. 1m specifies a length scaled at 10000., and inform will only let meters go up to about 2 hundred thousand, and can be specified to 4 decimal places.

You can also make unit conversions:
1 mile specifies a length equivalent to 1609m.

Section 15.11 is Named notations:

Let’s say we write this:

A weight is a kind of value. 10kg specifies a weight.
1 tonne (singular) specifies a weight scaled up by 1000.
2 tonnes (plural) specifies a weight scaled up by 1000.

Then inform prints it like this:

45kg -> "45kg"
1000kg -> "1 tonne"
2500kg -> "2.5 tonnes"
80000kg -> "80 tonnes"

So it automatically converts to convenient units (the documentation says it is minimising the integer part of the unit, but trying to keep it non-zero. So Inform prefers "45kg" to "0.045 tonnes".).

If you want to force it to be printed a certain way, you can name your notation (in this example, it’s the part after the comma in the parentheses):

1 tonne (singular, in tonnes) specifies a weight scaled up by 1000.
2 tonnes (plural, in tonnes) specifies a weight scaled up by 1000.

and then can use it like this:

"The weighbridge warns you not to exceed [the maximum load in tonnes]."

Section 5.12 is Making the verb ‘to weigh’

This is really useful and I had to get help from many people when making rockclimbing to do what this section is saying (although the tile of this section is a bit misleading).

Basically you can create a verb for a value:

Weight is a kind of value. 1kg specifies a weight. Every thing has a weight.

The verb to weigh means the weight property.

A thing usually weighs 1kg. The lead pig weighs 45kg.

What makes this exceptionally useful is that you can now use this verb in descriptions for finding lists, random things, and conditions.

Example 258 is Dimensions:

A length is a kind of value. 10m specifies a length. An area is a kind of value. 10 sq m specifies an area. A length times a length specifies an area.

Hmm, this is something entirely new: a length time a length specifies an area. Wild!

A weight is a kind of value. 10kg specifies a weight. Everything has a weight.

The verb to weigh means the weight property. A thing usually weighs 1kg.

Definition: A thing is light if its weight is 3kg or less.

Definition: A thing is heavy if its weight is 10kg or more.

The balance platform is a supporter in the Weighbridge. "The balance platform is 10m by 8m, giving it an area of [10m multiplied by 8m], currently weighing [the list of things on the platform]. The scale alongside reads: [total weight of things on the platform]. [if two things are on the platform]Average weight is: [the total weight of things on the platform divided by the number of things on the platform]. Heaviest item is [the heaviest thing on the platform], at [weight of the heaviest thing on the platform]. Lightest item is [the lightest thing on the platform], at [weight of the lightest thing on the platform].[otherwise]It seems to be able to weigh several things at once."

Example 259 is Lead Cuts Paper

A weight is a kind of value. 10kg specifies a weight. Everything has a weight. A thing usually has weight 1kg.

A container has a weight called breaking strain. The breaking strain of a container is usually 50kg. Definition: A container is bursting if the total weight of things in it is greater than its breaking strain.

A lead pig, a feather, a silver coin and a paper bag are in a room called the Metallurgy Workshop. The paper bag is a container with breaking strain 2kg. The lead pig has weight 50kg.

Every turn when a container (called the sack) held by someone visible (called the chump) is bursting:
say "[The sack] splits and breaks under the weight! [if the player is the chump]You discard[otherwise][The chump] discards[end if] its ruined remains, looking miserably down at [the list of things in the sack] on the floor.";
now all of the things in the sack are in the location;
now the sack is nowhere.

Sectoin 15.13 is The Metric Units Extension.

If you want tons of units and specifications, there are built in extensions:

(a) The built-in extension “Metric Units by Graham Nelson” sets up a whole range of scientific units, with all the notations we are likely to want. Real numbers are used throughout, so large and small-scale calculations can be carried out quite accurately. Like the other built-in extensions, it has its own documentation and examples.

(b) The built-in extension “Approximate Metric Units by Graham Nelson” does the same but using whole numbers, scaled about right for human situations. This won’t be much use for extensive calculations, and won’t be as accurate, but it will work reasonably well if real arithmetic isn’t available.

Absent from all of this chapter is how to make Inform print commas every 3 digits, which someone in chat was asking about. It turns out to be pretty hard.

Section 15.14 is Notations including more than one number

This is like heights with feet and inches, or time with minutes and seconds.

So you can say stuff like:
A running time is a kind of value. 3'59 specifies a running time.

or
A height is a kind of value. 5 foot 11 specifies a height.

You can make up to 8 numbers in each specification.

Referring back to the ‘3’59’ example:

The choice of "3" here makes no difference, much as the choice of "10" in the weight examples was arbitrary. But the "59" is significant. Numbers after the first one are expected to range from 0 up to the value we quote - so in this case, the number of seconds can be anything from 0 to 59.

Hmm, I didn’t know that! So for parts like this you need to make something as close to ‘ticking over’ as possible. Actually, you could do binary math like this with having a specification like `1 a 1 b 1 c 1 d 1 e 1 f 1 g 1 h’.

Haha, this works great, I just tried running this:

A binary number is a kind of value. 1 a 1 b 1 c 1 d 1 e 1 f 1 g 1 specifies a binary number.

baseCounter is always 0 a 0 b 0 c 0 d 0 e 0 f 0 g 1.
Counter is a binary number that varies. Counter is 0 a 0 b 0 c 0 d 0 e 0 f 0 g 1.

Every turn:
	say counter;
	now counter is counter plus basecounter;

This just counts up in binary! Although now I realize I didn’t need to use letters, I could have just used apostrophes.

Only the first number in something like this can be negative, and only if you specify negative in the original:

A secret sign is a kind of value. -2x17 specifies a secret sign with parts mystery and enigma.

Notations can’t have double quotes (even though arcs have them) but other punctuation is okay between digits:

A monetary value is a kind of value. $1.99 specifies a monetary value.

An aspect ratio is a kind of value. 16:9 specifies an aspect ratio.

Section 15.15 is the parts of a number specification. It lets you name the different chunks of a number:

A monetary value is a kind of value. $1.99 specifies a monetary value with parts dollars and cents.

We can now find the relevant parts like so. Suppose that “sum” is a monetary value. Then:

dollars part of sum
cents part of sum

are both numbers, so for instance we can

say "Looks like around [dollars part of sum in words] dollar[s]."

We can also go the other way:

monetary value with dollars part 4 cents part 72

produces the monetary value $4.72. (Note the lack of commas or "and"s, and that the parts have to be given in the right order.)

Naming parts of numbers lets you add other stuff onto it:
A monetary value is a kind of value. $1.99 specifies a monetary value with parts dollars and cents (optional, preamble optional).

This lets you type dollars without cents (optional), and omitting the decimal (preamble optional). Note that both options apply to cents since they are right next to cents. Apparently you can’t make the first part optional though (dollars), as I just tried doing that.

The other option is 'without leading zeroes", used when one of the parts is specified as multiple digits but we might not want that:

An aspect ratio is a kind of value. 16:20 specifies an aspect ratio with parts width and height (without leading zeros).

This ensures that when the ratio 4:3 is printed, it will be printed as “4:3” and not “4:03” as would otherwise happen.

Example 260 is Zqlran Era 8.

A Zqlran date is a kind of value. 14-88 specifies a Zqlran date with parts zqls and frbs. Current zqlran date is a zqlran date that varies. The current zqlran date is 8-22. Previous zqlran date is a zqlran date that varies. The previous zqlran date is 8-20.

The Zqlran time rule is listed instead of the advance time rule in the turn sequence rules.

This is the Zqlran time rule:
    increment turn count;
    now the previous zqlran date is current zqlran date;
    increase the current zqlran date by 0-02;
    repeat through the Table of Zql Schedule:
        if era entry is greater than previous zqlran date and era entry is not greater than current zqlran date:
            say event entry;
            say paragraph break;
            blank out the whole row.

Section 15.16 is Understanding specified numbers:

You can just throw values that are specified numbers into ‘understand’ commands:

The Oval Office is a room. Josh and Toby are men in the Oval. A height is a kind of value. 5 foot 11 specifies a height. A person has a height. Josh is 5 foot 8. Toby is 5 foot 10.

Height guessing is an action applying to one thing and one height. Understand "guess [someone] is [height]" as height guessing.

Check height guessing: if the noun is not a person, say "You can only guess the height of people." instead. Carry out height guessing: if the height of the noun is the height understood, say "Spot on!"; if the height of the noun is greater than the height understood, say "No, [the noun] is taller than that."; if the height of the noun is less than the height understood, say "No, [the noun] is shorter than that."

Example 261 is Snip:

A string is a kind of thing. A string has a length. The length of a string is usually 36 inches.

Before printing the name of a string, say "[length] piece of ". Rule for printing the plural name of a string: say "[length] pieces of string".

Understand the command "cut" as something new. Understand "cut [length] from/off [something]" as trimming it by (with nouns reversed). Understand "cut [something] by [length]" as trimming it by. Understand the command "trim" as "cut".

Trimming it by is an action applying to one thing and one length.

This is a very complex example, but the above is a taste.

Section 15.17 is Totals:

This is just a way of adding stuff up. With some preamble:

A weight is a kind of value. 10kg specifies a weight. Everything has a weight. A thing usually has weight 1kg. A man usually has weight 80kg. A woman usually has weight 67kg.

Definition: A thing is light if its weight is 3kg or less.
Definition: A thing is heavy if its weight is 10kg or more.

we can say:
The balance platform is a supporter in the Weighbridge. "The balance platform is currently weighing [the list of things on the platform]. The scale alongside reads: [total weight of things on the platform]."

This only works because ‘everything has a weight’.

You can also use superlatives:

the weight of the heaviest thing on the platform
the weight of the lightest thing on the platform

Example 262 is Nickel and Dimed

This is a very complex example involing a monetary system using US money. It includes different coins and denominations.

3 Likes

Chapter 15, continued:

Section 15.18 is Equations. The examples in this section use the Metric Units extension by Graham Nelson.

Equations are defined very similar to tables. First, some preliminary definitions before the actual equation:

The acceleration due to gravity is an acceleration that varies. The acceleration due to gravity is usually 9.807 m/ss. A thing has a mass. The mass of a thing is usually 10g.

Next th equation itself:

Equation - Newton's Second Law
    F=ma
where F is a force, m is a mass, a is an acceleration.

It’s hard to tell from the formatting, but it looks like equations might have to have whitespace in front of them.

An equation has to take the form of one formula equals another, where each formula is made up from symbols defined afterwards. The symbols can be defined as definite values (as “g” is defined in the Galilean Equation), or just by telling Inform their kinds of value (as “v” and “t” are defined).

Inform makes no distinction between upper case and lower case.

Once you have equations, you can say stuff like “let F be given by Newton’s Second Law where a is the acceleration due to gravity;”.

If you only use an equation once, you can do this:

let KE be given by KE = mv^2/2 where KE is an energy;

The Phrasebook page on the index lists all math functions that can be used.

Example 263 is Widget Enterprises:

Equation - Profit Equation
    P = nV - (F + nC)
where P is a monetary value, F is the fixed cost, C is the unit cost, V is a monetary value, and n is a number.
Carry out setting price to:
    let V be the monetary value understood;
    let n be the units sold at the monetary value understood;
    let P be given by the Profit Equation;
    say "You set the price of your widgets to [V], resulting in sales of [n] unit[s] and ";
    if P is less than $0.00:
        let L be $0.00 - P;
        say "a loss of [L].";
    otherwise if P is $0.00:
        say "break even.";
    otherwise:
        say "a profit of [P].".

Section 15.19 is Artihmetic with units

Inform does some automatic dimensional analysis, and won’t let you equate things with different types of units.

Multiplying by a scalar is always allowed:
The Weighbridge is a room. "A sign declares that the maximum load is [100kg multiplied by 3]."

On the other hand, you can’t do something like ‘122 divided by 10 kg’.

Example 264 is Frozen Assets. This is basically just a simple shopping model where when you buy something your money goes down.

Instead of buying something:
    decrease the price of the money by the price of the noun;
    say "You fork over [the price of the noun] for [the noun], leaving yourself with [the price of the money].";
    if the money is free:
        now the money is nowhere;
    now the price of the noun is $0.00;
    now the player is carrying the noun.

with special rules for money itself:

The player carries a wallet. The wallet contains money. The price of the money is $4.50. The printed name of the money is “[price of the money] in cash”. Understand “cash” as the money.

Instead of taking the money:
say "Best to leave it alone until you need to buy something."

Instead of buying something free:
say "[The noun] is yours already."

Instead of buying the money:
say "The money belongs to you; you buy things with it."

Example 265 is Money for Nothing

This is a system for bartering.

Check offering it for:
    if the price understood is greater than the wealth of the player, say "You don't have that kind of cash." instead;
    if the second noun is not carried by someone, say "There's no one in a position to sell you [the second noun]." instead;
    if the second noun is carried by the player, say "[The second noun] is already yours." instead;
    if the minimum value of the second noun is greater than the price understood, say "[The holder of the second noun] cackles disdainfully. 'If yer just here to insult me you can take your business elsewhere!' he says." instead;
    if the desired value of the second noun is greater than the price understood:
        let difference be the desired value of the second noun minus the price understood;
        let difference be difference divided by two;
        decrease the desired value of the second noun by difference;
        now the last object offered is the second noun;
        say "'How about [desired value of the second noun]?' suggests [the holder of the second noun]." instead;
    otherwise:
        unless the desired value of the second noun is the price understood:
            say "From the avaricious gleam in the eye of [the holder of the second noun], you guess you could've gotten this purchase for less..."

Carry out offering it for:
    increase the wealth of the holder of the second noun by the price understood;
    decrease the wealth of the player by the price understood;
    move the second noun to the player.

Report offering it for:
    say "You spend [the price understood], and now you possess [the second noun]."

When play begins: now right hand status line is "Your funds: [wealth of the player]".

Example 266 is Lemonade

This is a section about liquid amounts.

A volume is a kind of value. 15.9 fl oz specifies a volume with parts ounces and tenths (optional, preamble optional).

A fluid container is a kind of container. A fluid container has a volume called a fluid capacity. A fluid container has a volume called current volume.

The fluid capacity of a fluid container is usually 12.0 fl oz. The current volume of a fluid container is usually 0.0 fl oz.

Liquid is a kind of value. The liquids are water, milk, lemonade, and iced tea. A fluid container has a liquid.

Pouring it into is an action applying to two things.

Check pouring it into:
    if the noun is not a fluid container, say "You can't pour [the noun]." instead;
    if the second noun is not a fluid container, say "You can't pour liquids into [the second noun]." instead;
    if the noun is the second noun, say "You can hardly pour [the noun] into itself." instead;
    if the liquid of the noun is not the liquid of the second noun:
        if the second noun is empty, now the liquid of the second noun is the liquid of the noun;
        otherwise say "Mixing [the liquid of the noun] with [the liquid of the second noun] would give unsavory results." instead;
    if the noun is empty, say "No more [liquid of the noun] remains in [the noun]." instead;
    if the second noun is full, say "[The second noun] cannot contain any more than it already holds." instead.

Carry out pouring it into:
    let available capacity be the fluid capacity of the second noun minus the current volume of the second noun;
    if the available capacity is greater than the current volume of the noun, now the available capacity is the current volume of the noun;
    increase the current volume of the second noun by available capacity;
    decrease the current volume of the noun by available capacity.

Report pouring it into:
    say "[if the noun is empty][The noun] is now empty;[otherwise][The noun] now contains [current volume of the noun in rough terms] of [liquid of the noun]; [end if]";
    say "[the second noun] contains [current volume of the second noun in rough terms] of [liquid of the second noun][if the second noun is full], and is now full[end if]."

Example 267 is Savannah
This has more liquid stuff.

The bucket is a fluid container carried by the player. The liquid of the bucket is seawater. The current volume of the bucket is 64.0 fl oz.

The fire is a fixed in place thing in the beach. "A low fire crackles here, left over from an attempt at s'mores much earlier in the evening."

Instead of touching or rubbing or taking the fire, say "You're not such a glutton for punishment."

Instead of pouring something into the fire:
now the fire is nowhere;
now the current volume of the noun is 0.0 fl oz;
say "[The second noun] goes out in a great hiss."

Finally, section 15.20 is Multiplication of Units

This tells inform what new units you should get when you multiply other units (this showed up in an example earlier and is automatic in ‘metric units’):

A length is a kind of value. 10m specifies a length. An area is a kind of value. 10 sq m specifies an area.

A length times a length specifies an area.

Example 268 is Depth:

A length is a kind of value. 10 cm specifies a length. An area is a kind of value. 10 sq cm specifies an area. A length times a length specifies an area. A volume is a kind of value. 10 cu cm specifies a volume. A length times an area specifies a volume.

A thing has a length called height. A thing has a length called width. A thing has a length called depth. The height of a thing is usually 10 cm. The width of a thing is usually 10 cm. The depth of a thing is usually 10 cm.

To decide what volume is the exterior volume of (item - a thing):
    let base area be the height of the item multiplied by the width of the item;
    let base volume be the base area multiplied by the depth of the item;
    decide on the base volume.

Example 269 is Fabrication. This lets values have properties!

A material is a kind of value. The materials are silk, velvet, cotton, and wool.

Price is a kind of value. $1.99 specifies a price.

Area is a kind of value. 5 sq yards specifies an area.

Cost is a kind of value.. $1.99 per sq yard specifies a cost. A cost times an area specifies a price.

A material has a cost.

The cost of silk is usually $5.75 per sq yard. The cost of velvet is usually $9.50 per sq yard. The cost of cotton is usually $2.29 per sq yard. The cost of wool is usually $4.75 per sq yard.

Finally, example 270 is The Speed of Thought. It’s a way to turn normal units into weird units:

1 pencil (in conceptual units, in pencils, singular) or 2 pencils (in conceptual units, in pencils, plural) specifies a length equivalent to 18cm.
1 bathtub (in conceptual units, in bathtubs, singular) or 2 bathtubs (in conceptual units, in bathtubs, plural) specifies a length equivalent to 152cm.
1 Olympic swimming pool (in conceptual units, in Olympic swimming pools, singular) or 2 Olympic swimming pools (in conceptual units, in Olympic swimming pools, plural) specifies a length equivalent to 50 meters.
1 Empire state building (in conceptual units, in Empire State buildings, singular) or 2 Empire State buildings (in conceptual units, in Empire State buildings, plural) specifies a length equivalent to 443m.

Report reporting:
    if the extent of the noun is greater than 0mm and the surface of the noun is greater than 0 sq cm:
        contextualize "'[The noun] has a length of [about] [extent of the noun in conceptual units] and an area of [about] [surface of the noun in conceptual units].'";
    otherwise if the extent of the noun is greater than 0mm:
        contextualize "'[The noun] has a length of [about] [extent of the noun in conceptual units].'";
    otherwise if the surface of the noun is greater than 0 sq cm:
        contextualize "'[The noun] has an area of [about] [surface of the noun in conceptual units].'";
    otherwise:
        say "'[The noun] is... pretty hard to imagine,' you say weakly. That's not going to go over well."

I can think of a lot of ways to implement the stuff in this chapter but very few that players would enjoy. I feel like people generally enjoy the appearance of deep implementation as much as deep implementation itself. Now I just need to figure out a reason for a game to include the inverse hyperbolic cosine (maybe calculating the length of a suspension bridge given the height of cables at different points?)

2 Likes