§19.12. Named outcomes

We have seen that the terms "success" and "failure" can be misleading - after all, it might be a good thing for a particular rulebook to "fail". At any rate, these are vague terms, and we don't want to have to remember the conventions used by every rulebook. This is why certain rulebooks have explicitly named outcomes instead. For instance, the "visibility" rules are allowed to have the outcomes:

there is sufficient light;
there is insufficient light;

These look like phrases, but are in fact named outcomes which can only be used in visibility rules. (They would make no sense elsewhere, and Inform will not allow their use if they are clearly out of context.) Such named outcomes are listed in the Rules index.

There can be any number of named outcomes. For instance, the Standard Rules define:

The does the player mean rules are a rulebook. The does the player mean rules have outcomes it is very likely, it is likely, it is possible, it is unlikely and it is very unlikely.

which makes five possible outcomes. Five outcomes seems to contradict the principle that there are only three possible outcomes for a rule: in fact, though, the five are counted as five different forms of "success", and any of them will cause a "does the player mean" rule to succeed. If we do not want this, we can instead specify explicitly how the named outcomes correspond to success, failure or "no outcome":

Visibility rules have outcomes there is sufficient light (failure) and there is insufficient light (success).

Again, see the Rules index for examples.

The same named outcome can be used for more than one rulebook, and can have different meanings in the context of different rulebooks - "good news" could be defined as success in one rulebook and failure in another, for instance. (This means that rulebook creators need not worry about name clashes and is an important difference in behaviour between rulebook outcomes and kinds of value.) We can even name a specific named outcome as the default outcome for rules in this rulebook:

Audibility rules have outcomes high background noise (failure), low background noise (success - the default) and absolute silence (success).

After a rulebook using named outcomes has run, we can test which outcome occurred by using the phrase:

outcome of the rulebook ... rulebook outcome

This phrase produces the (named) outcome of the phrase most recently followed. Example:

follow the audibility rules;
if the outcome of the rulebook is the absolute silence outcome:
    say "You could hear a pin drop in here."

Each named outcome is a value if followed by the word "outcome", which is how "absolute silence" has become "the absolute silence outcome". Named outcomes can be said, so we could use the text substitution "[outcome of the rulebook]", for instance. A final caveat: it is perfectly legal to create a named outcome which means "no outcome", but if so then this will never be "the outcome of the rulebook" because "no outcome" is not an outcome.


arrow-up.pngStart of Chapter 19: Rulebooks
arrow-left.pngBack to §19.11. Success and failure
arrow-right.pngOnward to §19.13. Rulebooks producing values

Let's say that we're implementing a particularly irrational and volatile character. Some of the time she remains composed; some of the time she reacts with unexpected vehemence for reasons only partly related to what was said.

Moreover, her responses are divided between successful and failing outcomes, where success indicates that she's not too upset and failure means that she is distraught; we use this to determine how the rest of the room reacts.

paste.png "Being Peter"

The Drawing Room is a room. "The company is assembled here for champagne. Most of it, anyway: Mary is on the phone to her babysitter, Roger is keeping her anxious company, and Carol doesn't drink. But everyone else."

Maggie is a woman in the Drawing Room.

The player wears a top hat.

Quizzing it about is an action applying to one thing and one visible thing. Understand "ask [someone] about [any thing]" as quizzing it about.

Instead of quizzing Maggie about something:
    follow the attitude rules;
    say "Everyone waits to see what the reaction will be: [outcome of the rulebook].";
    if rule succeeded, say "There is general relief.";
    otherwise say "Everyone is pointedly silent."

The attitude rules are a rulebook. The attitude rules have outcomes she stays calm (no outcome - default), she gets angry (failure), she has a stroke (failure), she is only mildly annoyed (success), and she is elated (success).

Here we want Inform to consult every appropriate attitude rule until it gets to some answer; if an attitude rule does not provide a result, the default 'no outcome' will mean that we go on to the next rule, and so on.

A subject is a kind of thing. income, love life, and children are subjects.

An attitude rule for quizzing Maggie about love life:
    she gets angry.

An attitude rule:
    if the player wears the top hat, she gets angry.

Now, as we saw, the 'no outcome' result will never be returned and printed as Maggie's reaction, precisely because it is "no outcome". Therefore, we provide a final attitude rule which will give her a default response to all statements:

The last attitude rule:
    she is only mildly annoyed.

Test me with "ask maggie about love / ask maggie about income / take off hat / ask maggie about income".

There are plenty of contexts where we might want named outcomes for clarity but not want to print the results literally afterward.

*ExampleBeing Peter
A set of rules determining the attitude a character will take when asked about certain topics.

Let's say that we're implementing a particularly irrational and volatile character. Some of the time she remains composed; some of the time she reacts with unexpected vehemence for reasons only partly related to what was said.

Moreover, her responses are divided between successful and failing outcomes, where success indicates that she's not too upset and failure means that she is distraught; we use this to determine how the rest of the room reacts.

paste.png "Being Peter"

The Drawing Room is a room. "The company is assembled here for champagne. Most of it, anyway: Mary is on the phone to her babysitter, Roger is keeping her anxious company, and Carol doesn't drink. But everyone else."

Maggie is a woman in the Drawing Room.

The player wears a top hat.

Quizzing it about is an action applying to one thing and one visible thing. Understand "ask [someone] about [any thing]" as quizzing it about.

Instead of quizzing Maggie about something:
    follow the attitude rules;
    say "Everyone waits to see what the reaction will be: [outcome of the rulebook].";
    if rule succeeded, say "There is general relief.";
    otherwise say "Everyone is pointedly silent."

The attitude rules are a rulebook. The attitude rules have outcomes she stays calm (no outcome - default), she gets angry (failure), she has a stroke (failure), she is only mildly annoyed (success), and she is elated (success).

Here we want Inform to consult every appropriate attitude rule until it gets to some answer; if an attitude rule does not provide a result, the default 'no outcome' will mean that we go on to the next rule, and so on.

A subject is a kind of thing. income, love life, and children are subjects.

An attitude rule for quizzing Maggie about love life:
    she gets angry.

An attitude rule:
    if the player wears the top hat, she gets angry.

Now, as we saw, the 'no outcome' result will never be returned and printed as Maggie's reaction, precisely because it is "no outcome". Therefore, we provide a final attitude rule which will give her a default response to all statements:

The last attitude rule:
    she is only mildly annoyed.

Test me with "ask maggie about love / ask maggie about income / take off hat / ask maggie about income".

There are plenty of contexts where we might want named outcomes for clarity but not want to print the results literally afterward.

Let's say that we're implementing a particularly irrational and volatile character. Some of the time she remains composed; some of the time she reacts with unexpected vehemence for reasons only partly related to what was said.

Moreover, her responses are divided between successful and failing outcomes, where success indicates that she's not too upset and failure means that she is distraught; we use this to determine how the rest of the room reacts.

paste.png "Being Peter"

The Drawing Room is a room. "The company is assembled here for champagne. Most of it, anyway: Mary is on the phone to her babysitter, Roger is keeping her anxious company, and Carol doesn't drink. But everyone else."

Maggie is a woman in the Drawing Room.

The player wears a top hat.

Quizzing it about is an action applying to one thing and one visible thing. Understand "ask [someone] about [any thing]" as quizzing it about.

Instead of quizzing Maggie about something:
    follow the attitude rules;
    say "Everyone waits to see what the reaction will be: [outcome of the rulebook].";
    if rule succeeded, say "There is general relief.";
    otherwise say "Everyone is pointedly silent."

The attitude rules are a rulebook. The attitude rules have outcomes she stays calm (no outcome - default), she gets angry (failure), she has a stroke (failure), she is only mildly annoyed (success), and she is elated (success).

Here we want Inform to consult every appropriate attitude rule until it gets to some answer; if an attitude rule does not provide a result, the default 'no outcome' will mean that we go on to the next rule, and so on.

A subject is a kind of thing. income, love life, and children are subjects.

An attitude rule for quizzing Maggie about love life:
    she gets angry.

An attitude rule:
    if the player wears the top hat, she gets angry.

Now, as we saw, the 'no outcome' result will never be returned and printed as Maggie's reaction, precisely because it is "no outcome". Therefore, we provide a final attitude rule which will give her a default response to all statements:

The last attitude rule:
    she is only mildly annoyed.

Test me with "ask maggie about love / ask maggie about income / take off hat / ask maggie about income".

There are plenty of contexts where we might want named outcomes for clarity but not want to print the results literally afterward.