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

Chapter 18, continued

18.5 is New Activities.

Activities can just be themselves or the can affect other things. Here are some ways of defining an activity:

Assaying is an activity.
Analysing something is an activity.
Announcing something is an activity on numbers.

If we use the word ‘something’ or ‘of something’ but don’t specify the kind, ‘objects’ becomes the kind.

"assaying activity" has kind activity on nothing
"analysing activity" has kind activity on objects
"announcing activity" has kind activity on numbers

Just like actions, making an activity creates multiple rulebooks (before, for, and after), which are all empty. You can test if it all three are simultaneously empty as so:

if the analysing activity is empty, ...

(It compares this to rulebooks, but I’ve never learned this about rulebooks before).

Just like we write ‘try’ for actions, we write ‘carry out’ for activities.

carry out the assaying activity;

For an activity with values:

carry out the analysing activity with the pitchblende;
carry out the announcing activity with the score;

So far, these seem to have a lot of the functionality of phrases, but with the benefit of having multiple stages and being able to be scheduled.

None of these definition do anything unless we also have a rule to go in the rulebooks, especially in the ‘for’ section:

Rule for announcing a number (called N): say “Ladies and gentlemen, [N].”

The last for assaying rule:
say "Professionally, you cast an eye around mineral deposits nearby, noticing [list of rocks in the location]."

‘The Last’ is something from next chapter that says this is the last one read. Apparently its best to make the ‘main’ rule the last one so that there are more chances for other people’s rules to interfere.

The first ‘for’ rule that runs is the last, because it stops after that. Unless you don’t want it to! Then you type ‘continue the activity’.

Once you’ve defined one activity, you can reference it inside others (the ‘hook’ thing people mentioned above):

Rule for printing the name of a rock while assaying: ...

Example 335 is AARP-Gnosis

This gives a collective item representing many volumes of an encyclopedia, which we can take one at a time or all at once:

Collecting something is an activity.

Every turn:
    repeat with item running through collectives:
        carry out the collecting activity with the item.

To remove (item - a thing) when empty:
    let space be the holder of the item;
    if the number of things which are part of the item is 0:
        now the item is nowhere;
    if the number of things which are part of the item is 1:
        let the last thing be a random thing which is part of the item;
        move the last thing to the space;
        now the item is nowhere.

Before collecting a thing (called the item):
    remove item when empty;
    let space be the holder of the item;
    if space is not a thing and space is not a room:
        if something (called the other space) contains at least two things which fit the item, move item to the other space;
        if a room (called the other space) contains at least two things which fit the item, move item to the other space;
        if someone (called the owner) carries at least two things which fit the item, move item to the owner.

Rule for collecting a thing (called the item):
    let space be the holder of the item;
    if space is a thing or space is a room:
        repeat with component running through things held by the space:
            if the component fits the item, now the component is part of the item;
        remove item when empty.

There’s some other code involving actually doing stuff to the encyclopedia.

Example 336 is Aftershock

This example points at that the line about a device being switched on or off is often inappropriate, and has a new way of dealing with that:

Showing action of something is an activity.

Rule for showing action of something (called item):
    if the item is switched on, say "[The item] is switched on.";
    otherwise say "[The item] is switched off."

The new described devices rule is listed instead of the examine devices rule in the carry out examining rules.

This is the new described devices rule:
    if the noun is a device:
        carry out the showing action activity with the noun;
        now examine text printed is true.

This is the same as baseline functionality, but you can replace the behavior more easily for specific things now:

Rule for showing action of an electric lamp (called item):
    if the item is switched on, say "[The item] is lit[if the number of visible lit things is greater than 1], competing with [the list of visible lit things which are not the item][end if].";
    otherwise say "[The item] is dark."

Example 337 is Crusoe:

The fancy examining rule is listed instead of the standard examining rule in the carry out examining rules.

Printing the description of something is an activity.

This is the fancy examining rule:
    carry out the printing the description activity with the noun;
    rule succeeds.

All we have done here is enclose what is usually just a rule inside an activity. This means that we can now write before and after rules for the activity, and also add special instructions like “Rule for printing the name of something while printing the description of something” – this may not be likely to arise often, but Inform now has the concept of “printing the description of something” as a separate context of action.

Rule for printing the description of something (called item):
    if the description of the item is not "":
        say "[description of item] [run paragraph on]";
    otherwise:
        say "You see nothing special about [the item]. [run paragraph on]".

After printing the description of something charred:
    say "It is charred." instead.

Last after printing the description of something:
    say paragraph break.

Hmm, that last rule (about ‘last after …say paragraph break’) seems like it could be useful!

Section 18.6 is Activity Variables, something I never wanted to see with my own two eyes (what’s next? Seeing the code for the Inform parser itself in C++?)

You just make a property of the activity like this:

Analysing something is an activity. The analysing activity has a text called first impression. Instead of examining something (called the sample), carry out the analysing activity with the sample.

Before analysing: now the first impression is "unremarkable".

Rule for analysing someone: now the first impression is "living tissue".

After analysing something (called the sample):
    say "Your professional opinion of [the sample] is that it is
        [first impression]."

(The idea is you make a default in ‘before’, specify it in ‘for’, and do something in ‘after’).

Section 18.7 is Beginning and ending activities manually.

We usually do this as so:

carry out the analysing activity with the pitchblende;

Next is more fine-tune handling:
begin the assaying activity;
will start the activity and run the ‘before’ rulebook. You must later print an ‘end the activity’ statement (has anyone ever seen this in action??? in a real games source code???).

If you have an activity on an object, you have to specify what to start it on:
begin the analysing activity with the pitchblende;

And you end it like so:
end the assaying activity;

The main benefit that I can see of this more fine-tuned method is that you can run other activities in the center and they can have special code that only runs when the larger activity is running, and so on.

The ‘after’ rulebook runs when we end things.

The for rules don’t run at all, so you can put your own behavior here:
if handling the analysing activity with the pitchblende:

in between the Begin and End statements.

You can replace this activity that happens within the if statement with something like this elsewhere:

Rule for handling the analysing activity with the pitchblende when the player is not sober:
    say "You can't seem to focus."

More specifically:

if handling (activity) activity:

This should be used only where the given activity has been started with “begin …” and will be finished with “end …”. It runs the “for” rules for the activity, and then comes out true if none of those for rules intervened in the handling of that activity. (The activity must be one which doesn’t apply to any value.)

(or if there’s an object, we say if handling ... activity with ...).

Man I reallllly hope there’s an example at the end that shows why this is useful and how for rules and if handling interact. If there’s not I’m just going to erase all of this from my brain.

You can also abandon activities and skip the ‘after’ rulebook, and is used only in dramatic circumstances (it’s only used between begin and for or between for and end):

abandon the assaying activity;

or

abandon the analysing activity with the pitchblende;

We need to follow three golden rules: all activities must end, they must never last longer than a turn, and if activity B starts during activity A then it must also finish during activity A. We must also be careful to make sure that if an activity applies to something, then it begins and ends with the same something (the pitchblende, in the above example).

Okay, I’m begging for examples, let’s see…

No examples! :scream:

Yeah, I’m going to pretend I didn’t read any of this section (I honestly didn’t know if there would be examples or not, I hadn’t scrolled down yet).

Section 18.8 is Introduction to the list of built-in activities.

This just says that activities make IF graceful and beautiful and that we’re about to go through every activity possible.

(Also if Graham Nelson or Emily Short ever is reading this: I actually really like the Inform documentation; all the problems I have with it are problems I have just as much or more with other programming languages. It’s like when I’m trying to write in Python and the only examples use very complex inheritance or constructors or error catching that is not at all relevant to me. At least Inform has tons of examples and is thoroughly documented; this chapter may not be very relevant to my experience but I’d hate for it not to exist.)

Section 18.9 is Deciding the Concealed possessions of something. This section sets the tone and pattern for all the others: a section on ‘when it happens’, one for ‘default behavior’, and examples.

So this activity runs silently all the time when checking visibility, so this should be optimized as much as possible. By default nothing is concealed (by this rule). An example:

Rule for deciding the concealed possessions of the Cloaked Villain: if the particular possession is the sable cloak, no; otherwise yes.

The coin is in the Roman Villa. The face and inscription are parts of the coin. Rule for deciding the concealed possessions of the coin: if the coin is carried, no; otherwise yes.

Hmm, so ‘the particular possession’ must be an action variable. I guess it’s not as scary as I thought!

Example 338 is Hays Code, which promises Clark Gable in a pink thong. Let’s see…

The Movie Set is a room. Clark Gable is a man in the Movie Set. "Clark leans on a polystyrene pillar, wearing [a list of unconcealed things worn by Clark] with his usual aplomb." Persuasion rule for asking Clark to try doing something: persuasion succeeds.

Clark is wearing a pin-striped suit and a pink thong. Rule for deciding the concealed possessions of Clark: if the particular possession is the thong and Clark is wearing the suit, yes; otherwise no.

:thinking:

Section 18.10 is Printing th name of something. This one is really useful and comes up a lot! I’ve messed around with this before by using sample code.

It happens whenever something is printed. By default, the printed name is printed, except for th current player, who is called ‘you’ or ‘yourself’. I had to hack this when I had a clone messing with the player, I didn’t know what activities were so I was very confused. Although I think I must have taken it out since I can’t find it now.

Here are some examples:

Rule for printing the name of the pen while taking inventory: say "useful pen".

A novel is a kind of thing. Dr Zhivago and Persuasion are novels. Before printing the name of a novel, say "[italic type]". After printing the name of a novel, say "[roman type]".

Hey, I have a novel in my game! I could add this!

After printing the name of the wrist watch while taking inventory: say " (time: [the time of day])".

 Rule for printing the name of the bottle while not inserting or removing:
    if the bottle contains sand, say "bottle of sand";
    otherwise say "empty bottle";
    omit contents in listing.

Hmm, neat.

Next is a very useful phrase:

omit contents in listing

This is how you keep a container from saying something like ‘a box (in which is a pizza)’. It isn’t permanent (there are rules for that).

Example 339 is Shipping Trunk:

Before printing the name of the baking powder when the powder is in a container which contains a smelly thing: say "completely ineffective ".

Notice that we run a ‘before’ rule to literally print things before a name, and we can use after for after.

Before printing the name of a bottle (called target) while not inserting, taking, searching, or removing:
    if the target is closed, say "sealed ";
    otherwise say "now open ".

After printing the name of a bottle (called target) while not inserting, searching, examining, or removing:
    if the target contains a noncork thing, say " containing [a list of noncork things in the target]";
    omit contents in listing.

These examples are really selling activities on me, seems like a lot of the things I mess around with the most deal with activities.

Example 341 is a rare 4-star example (the first in quite a while!)

This is a way to set a flag/property for every object based on whether we’ve printed the name before.

Definition: a subject is pending if the player is aware of it and it is not known by the player.

Instead of thinking:
    if the number of pending subjects is 0, say "You have no fresh leads at the moment.";
    otherwise say "You recall that thus far you have not followed up with questions about [the list of pending subjects]."

After printing the name of a subject (called idea):
    now the player is aware of the idea.

Highlighting is a setting that varies. Highlighting is dull.

Understand "highlighting [setting]" as setting highlighting. Setting highlighting is an action out of world, applying to one setting.

Carry out setting highlighting:
    now highlighting is the setting understood.

Report setting highlighting:
    say "Highlighting is now [if highlighting is dull]off[otherwise]on[end if]."

Before printing the name of a subject (called idea) when highlighting is bright:
    unless the player knows the idea:
        say "[bold type]".

After printing the name of a subject when highlighting is bright:
    say "[roman type]".

Section 18.11 is Printing the plural name of something.

This is only used for groups of identical items. It’s used in the middle of, like You can see five gold rings here., it’s only the ‘gold rings’ here.

The default behavior is just printing the gold rings.

To change the number, change the ‘printing a number of something’ activity.

Example 342 is Hudsucker Industries

Tone is a kind of value. The tones are effusive, affectionate, polite, curt, and flamingly rude.

A letter is a kind of thing. The description of a letter is usually "On inspection, it turns out to be quite [tone]." A letter has a tone. The tone of a letter is usually polite.

A letter can be read or unread. A letter is usually unread. Carry out examining a letter: now the noun is read.

Before printing the name of a read letter: say "[tone] ".

Before printing the name of an ungrouped letter: say "random ".

Before printing the plural name of a letter (called the subject):
    if the subject is grouped:
        say "[tone] ";
    otherwise if the number of unread letters which are next to the subject is 0:
        say "unsorted ".

After printing the plural name of a letter (called the subject):
    if the number of read letters which are next to the subject is 0, say " (all unread, at the moment)" instead;
    if the number of unread letters which are next to the subject is greater than 0, say " (some as yet unread)" instead.

Proximity relates a thing (called X) to a thing (called Y) when the holder of X is the holder of Y. The verb to be next to means the proximity relation.
Definition: a letter is grouped:
    if it is unread, no;
    if the number of unread letters next to it is greater than 0, no;
    repeat with item running through letters which are next to it:
        if the tone of item is not the tone of it, no;
    yes.

Hmm, this is a pretty neat trick!

Section 18.12 is Printing a number of something, again used only for identical objects.

It has a variable called ‘listing group size’. It usually just prints a number and then prints the plural name of something (so it contains the previous activity).

You could do something weird like:
Rule for printing a number of ants: say "altogether [listing group size in words] ants".

Rule for printing a number of blocks when the listing group size is 3: say "all three blocks".

Example 343 is Prolegomena (for a player who can’t count high at a glance):

A red pencil is a kind of thing. 12 red pencils are on the desk.

A letter is a kind of thing. 12 letters are on the desk. Understand "correspondence" as a letter.

Rule for printing the plural name of a letter:
    if the listing group size is greater than 7, say "correspondence";
    otherwise say "letters".

Rule for printing a number of something (called the target) when the listing group size is greater than 7:
    say "[one of]some [or]various [or]an assortment of [at random]";
    carry out the printing the plural name activity with the target.

and we can override this with even more specific rules:

Rule for printing a number of red pencils (called the target) when the listing group size is greater than 10:
    carry out the printing the plural name activity with the target;
    say " in nearly-sufficient quantity".

Section 18.13 is Listing contents of something

This is done when taking inventory, and when listing nondescript items in the location.

This rule does not fire for containers!

So this works:

Rule for printing the name of the brogues while listing contents of a room: ...

But this won’t affect room descriptions:

Rule for printing the name of the brogues while listing contents of the shoe box: ...

This rule also isn’t used when printing player-made lists.

By default, it just prints out the list.

You can use this to make some descriptions fancier (this is different from initial appearance because this fires even after you pick up the object and drop it!):
Rule for printing the name of the wrapper while listing contents of a room: say "discarded sweet wrapper".

You know, stuff like this makes me realize why Curses! and Emily Short games are so special; they really know the inner workings and can make really special touches.

You can group items together in the following way with the special syntax ‘group…together’, which I’m absolutely going to use for tokens in my game! (I have 7 colored tokens).

You can use ‘group … together’, ‘group…together giving articles’, or ‘group…’ together as (text)'.

The first two just make the objects listed as a single line in the inventory, while the third prints the text and then the objects in parentheses.

Example 344 is Unpeeled:

Scullery is a room. A sack is carried by the player. The sack contains a yellow onion. The player carries a cork.

Before printing the name of the onion while listing contents:
if the holder of the onion contains exactly 1 thing, say "single ".

Section 18.14 is Grouping together something

This is only used when doing the ‘group together’ activity mentioned in the last section.

There is a variable called ‘listing group size’, but if there are multiple groups, the listing group size will be the number of groups.

If the list contains five men and six women, for example, “listing group size” might be 2 rather than 11.

Example:

Before listing contents: group Scrabble pieces together.

Before printing the name of a Scrabble piece while not grouping together, say "tile ". After printing the name of a Scrabble piece while not grouping together, say " from a Scrabble set".

Before grouping together Scrabble pieces, say "the tiles ". After grouping together Scrabble pieces, say " from a Scrabble set".

Nice to see we can say ‘while not…’ for an activity.

You don't even have to print them individually:
Before listing contents while taking inventory: group utensils together. Rule for grouping together utensils: say "the usual utensils".

Section 18.15 is Issuing the response text of something.

This is for responses that are marked with a letter like (A) in rules that use them (you will usually only write such rules when making an extension).

So this activity runs during this rule:

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.

The default behavior is just to print the line.

We are advised not to mess with this rule (instead, just changing the responses manually). But it can be useful if you want to mess with the behavior of all responses, like this:

This is a way to see which responses are being printed, for example:

Before issuing the response text of a response (called R): say "[R]: ".

whence:

>WAIT
standard report waiting rule response (A): Time passes.

Or we can print out the same response in all viewpoints (using a trick to avoid repeating too many times):

The response inhibition is initially false.

Rule for issuing the response text of a response (called R) when the response inhibition is false:
    now the response inhibition is true;
    let the current viewpoint be the story viewpoint;
    repeat with P running through narrative viewpoints:
        now the story viewpoint is P;
        say "[P]: [text of R][command clarification break]";
    now the story viewpoint is the current viewpoint;
    now the response inhibition is false.

With that in place,

>EAST
first person singular: I can't go that way.
second person singular: You can't go that way.
third person singular: He can't go that way.
first person plural: We can't go that way.
second person plural: You can't go that way.
third person plural: They can't go that way.

Example 345 is Wesponses:

The response inhibition is initially false.

Rule for issuing the response text of a response (called R) when response inhibition is false:
    now response inhibition is true;
    let output be "[text of R]";
    now response inhibition is false;
    replace the text "r" in output with "w";
    replace the text "R" in output with "W";
    say "[output]".

Section 18.16 is Printing room description details of something.

This is for the nondescript items in a room. This rule is specifically for the parentheses after an item like:

You can also see Po and a cage (empty) here.

It doesn’t print the contents of something (that’s the ‘omit contents in listing’ thing).

We can get rid of these things altogether!
Rule for printing room description details: stop.

Hmm…I don’t think we’ve seen ‘stop’ before. Isn’t that for actions? I though stopping an activity was like ‘abort the activity’ or something mentioned earlier.

You can also add a new detail:

Rule for printing room description details of a person:
    say " (at last, someone to talk to)" instead.

This is really nice, as often it’s hard to make these nondescript items seem nice.

Example 346 is Rules of Attraction:

Definition: a thing is nonmagnetic if it is not a magnet.

Rule for printing room description details of a magnet (called attractor): if something is part of the attractor, say " (stuck to which [is-are the list of things which are part of the attractor])".

After printing the name of a magnet (called attractor) while taking inventory:
if something is part of the attractor, say " (stuck to which [is-are the list of things which are part of the attractor])".

Before taking a touchable thing which is part of a magnet (called attractor):
move the noun to the holder of the attractor.

Hmm, that last bit is a neat way to let the player take parts of things!

Section 18.17 is Printing Inventory details of something, which is just like the last section but for inventory. Standard behavior looks like this:
a flaming branch (providing light)

We can get rid of it like this:
Rule for printing inventory details: stop.

and we can add new ones like this:

Rule for printing inventory details of something edible:
    say " (yummy!)[run paragraph on]".

Hmmm, I feel like this is opening new horizons for me. I doubt I’ll be able to make effective use of it, but it’s nice!

Section 18.18 is Printing a refusal to act in the dark.

This runs when visibility is bad, and says: “It is pitch dark, and you can’t see a thing.”

We can alter this slightly:
Rule for printing a refusal to act in the dark: if we are examining something, say "It's not totally dark here, perhaps, but certainly too dim for close-up examination of anything." instead.

Example 347 is Zorn of Zorna:

Rule for printing a refusal to act in the dark:
    if we are examining something, say "The details of [the noun] are too fine to make out in the light of only [the number of visible lit candles in words] candle[s]." instead.

Section 18.19 is Printing the announcement of Darkness. This happens when the room becomes dark after being lit, and prints “It is now pitch dark in here!”.

We can change the text:
Rule for printing the announcement of darkness: say "Ooh-er! It's now very nearly pitch dark in here." instead.

Why does that rule say instead??? Since when is instead part of activities? Man, I thought I was understanding this. Did I write about that earlier? I really have to read this chapter again.

We can also move stuff around

Before printing the announcement of darkness: now all of the gremlins are in the kitchen.

or do a special rule when its dark because you closed a container:

Rule for printing the announcement of darkness when closing a container which contains the player:
    say "Congratulations: now you can't see a thing." instead.

Section 18.20 is Printing the announcement of light.

This is the opposite of last section, and just has the player try looking.

We can vary it like this:
Rule for printing the announcement of light in the Dazzling Temple: say "You are almost blinded by the suffusion of white light, and have spots before your eyes." instead.

2 Likes