| 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.

Previous | Contents | Next