18.3. New rules

| Chapter 18: Rulebooks |

| 18.3. New rules

Stretching a point seasonally, we might write:

> Every turn, say "The summer breeze shakes the apple-blossom."

This rule is nameless. It needs no name because it will never need to be referred to: by identifying it as an every turn rule we have already said enough to lodge it in the "every turn" rulebook. In fact, though, it is easy to create a named rule:

> This is the blossom shaking rule: say "The summer breeze shakes the apple-blossom."

The name of a rule must always end with the word "rule", for clarity's sake. (The phrasing "This is the ... rule" is used because "The ... rule" would be open to misinterpretation.)

Previously we had a rule which had no name, but belonged to a rulebook: now we have the opposite, because although the "blossom shaking rule" has a name, it has not been placed in any rulebook. That means it will probably never be applied, unless we give specific instructions for that.

Alternatively, it is possible to both name and place a rule in a single sentence:

> Every turn (this is the alternative blossom rule): say "The summer breeze shakes the apple-blossom."

Now the "alternative blossom rule" is a named rule in the "every turn" rulebook.

376
| Example Stone A soup to which the player can add ingredients, which will have different effects when the player eats. |
RB

377
| Example The Crane's Leg 2 A description text generated based on the propensities of the player-character, following different rulebooks for different characters. |
RB

> Names of rules can be listed in tables. This is convenient if, for instance, we decide that we'd like to swap the rules we use for a specific purpose, as in this continuation of our earlier example of automated description: "The Crane's Leg, Grown Longer" Material is a kind of value. The materials are wood, glass, stone, cloth, paper, clay, and metal. A thing has a material. Color is a kind of value. The colors are red, orange, yellow, green, blue, indigo, violet, black, brown, and white. A thing has a color. A thing is usually white. A height is a kind of value. 3 feet 11 inches specifies a height. A thing has a height. Definition: a thing is tall if its height is 6 feet 0 inches or more. Definition: a thing is short if its height is 2 feet 0 inches or less. Imitation relates various things to one thing (called the ideal). The verb to imitate (it imitates, they imitate, it is imitating) implies the imitation relation. A table is a kind of supporter. A table is usually wood. The height of a table is usually 3 feet 8 inches. The ordinary table is a table. Every table imitates the ordinary table. A rock is a kind of thing. A rock is usually stone. The ordinary rock is a rock. The height of a rock is usually 0 feet 3 inches. Every rock imitates the ordinary rock. The description of a thing is usually "[comparison with ideal][run paragraph on]". To say comparison with ideal: say "You observe [the noun]:[paragraph break]"; choose row with character of the player in Table of Descriptive Reporting; follow instructions entry. This is the comparative observation rule: let the sample be the ideal of the noun; if the sample is not a thing: say "Nothing special, really."; rule succeeds; if the material of the noun is not the material of the sample: if the height of the noun is not the height of the sample: if the noun is shorter than the sample, say "Unusually short at [height of the noun], and made of [material of the noun]."; otherwise say "Unusually tall at [height of the noun], and made of [material of the noun]."; otherwise: say "Distinct mostly in being made of [material of the noun]."; otherwise: if the height of the noun is not the height of the sample: if the noun is shorter than the sample, say "Unusually short at [height of the noun]."; otherwise say "Unusually tall at [height of the noun]."; otherwise: say "In every respect [a sample]." The Pleasure Garden is a room. "At the riverbank, a pleasing garden, having many curving paths and one straight." The low table is a table in the Pleasure Garden. The height of the low table is 2 feet 3 inches. On the low table is a yellow metal rock called a gold nugget. A willow is in the Pleasure Garden. The height of the willow is 20 feet 2 inches. Understand "possess [any person]" or "be [any person]" as possessing. Possessing is an action applying to one thing. Carry out possessing: now the player is the noun; say "You swap bodies!" The crane is a person in the Garden. The height of the crane is 4 feet 0 inches. Table of Descriptive Reporting
> character | instructions
> yourself | comparative observation rule
> crane | bird observation rule
This is the bird observation rule: if the noun is shorter than the player, say "Small, like a duck[if the color of the noun is not white]; and [color of the noun][end if]."; otherwise say "Supremely tall[if the color of the noun is not white] and [color of the noun][end if]." Test me with "examine table / examine nugget / examine willow / possess crane / examine table / examine nugget / examine willow".

378
| Example Bribery A GIVE command that gets rid of Inform's default refusal message in favor of something a bit more sophisticated. |
RB

Previous | Contents | Next