| Chapter 4: Kinds |

| 4.9. Using new kinds of value in properties

Having created a new kind of value called "brightness", we are free to use it in the ordinary way like this:

> The lantern has a brightness called the flame strength. The flame strength of the lantern is blazing.

The "flame strength" property is now only allowed to have one of four values we allowed: guttering light, weak light, radiant light or blazing light. Inform will not allow anything else to be put into it, or allow it to be compared to (say) the number 3.

However, it seems artificial to call the brightness of the lantern "flame strength", when we could instead simply call it "brightness", so we are also allowed this:

> The lantern has a brightness. The lantern is blazing.

New kinds of value are very convenient when substituting variations in text:

> A dead end is a kind of room with printed name "Dead End" and description "This is a dead end, where crags in the uneven rock are caught by the [brightness of the lantern] flame you hold aloft. Despite [river sound] there is no sign of the stream." A dead end is usually dark.

The "brightness of the lantern" in square brackets is printed not as literal text, but as whatever the brightness currently is. (This is called a text substitution, and will be the subject of the next chapter.) If the brightness had been a number from 1 to 4, this would have resulted in something like "... by the 3 flame...", but since it is a new kind of value, the result is "... by the radiant flame..."

46
| Example The Crane's Leg 1 A description text that automatically highlights the ways in which the object differs from a standard member of its kind.

47
| Example Signs and Portents Signpost that points to various destinations, depending on how the player has turned it.

"Signs and Portents" Seven Dials is a room. The description of Seven Dials is "There is a signpost, on which seven hands swivel and swing, freely as weathercocks. They make your present road now London, now Abingdon; now Weston-super-Mare, or now Hell." Seven Dials contains a signpost. The signpost is scenery. Understand "sign" and "post" as the signpost. Destination is a kind of value. The destinations are London, Abingdon, Luton, Weston-super-Mare, Runnymede, Hell, and Low Noon. The signpost has a destination. In order to interact with the signpost, we will need to borrow some action rules from chapter 6: Instead of examining the signpost: say "[The signpost] currently puts you on the road to [italic type][the destination of the signpost][roman type], but it swiftly alters again."; change the destination of the signpost to the destination after the destination of the signpost. Instead of turning the signpost: change the destination of the signpost to the destination after the destination of the signpost; say "With a hand's touch you turn the signpost to mark your way for [italic type][the destination of the signpost][roman type]." Instead of going north in Seven Dials when the destination of the signpost is Hell: say "It is a path that goes gently ever down and down with no stumbling block or any distraction at either side; there are no bandits and no tolls."; end the game in death. Instead of going north in Seven Dials when the destination of the signpost is Low Noon: say "A long road whose scenery does not change, nor anything on the horizon move but the sun. When at last you come to Noon, she hangs above your head like a hat."; end the game in victory. Test me with "x signpost / n / turn signpost / n / turn signpost / n / turn signpost / n / turn signpost / n". Test more with "x signpost / n / turn signpost / n / turn signpost / n / turn signpost / n / turn signpost / turn signpost / n".

Previous | Contents | Next