1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-07 17:44:22 +03:00
inform7/resources/Documentation/Examples/TheCranesLeg2.txt
2023-07-24 11:56:58 +01:00

70 lines
3.9 KiB
Plaintext

Example: * The Crane's Leg 2
Subtitle: Descriptions based on player-character's observation abilities
Location: New rules
RecipeLocation: Viewpoint
Index: The Crane's Leg 2. Descriptions based on player-character's observation abilities
Description: A description text generated based on the propensities of the player-character, following different rulebooks for different characters.
For: Z-Machine
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 means 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".