Inform 7 Home Page / Documentation
§9.7. Painting and Labeling Devices
Writing on something is only one way a player can change its visual appearance. IF authors have long been wary of paint brushes, because a sufficiently motivated player could go through a whole landscape like a graffiti artist with a railway bridge. We want to give the player the illusion of freedom of action, while avoiding a situation where unlimited numbers of different decorations might be needed - that would need a table of potentially unlimited size.
One approach is to limit the number of items which can be decorated. In Palette, only the canvas can be painted, and each image overlays the last. Early Childhood increases the range to allow a whole kind ("block") to be painted, and also shows how the changing colours can be used to distinguish between otherwise identical objects.
Brown finds a different way to limit the number of simultaneous decorations: almost anything can have a red sticky label attached, but there is only one red sticky label. (So to decorate a new item, the player must first un-decorate an old one.)
See Electricity and Magnetism for another form of stickiness
|Start of Chapter 9: Props: Food, Clothing, Money, Toys, Books, Electronics|
|Back to §9.6. Reading Matter|
|Onward to §9.8. Simple Machines|
There are hundreds of traditional pigments, from lampblack to burnt sienna, so we will confine ourselves to just two:
Painting is an action applying to one thing and one colour. Check painting: if the noun is not the canvas, say "Centuries of tradition suggest that canvas is the natural home of paint." instead. Carry out painting: now the colour of the canvas is the colour understood. Report painting: say "You splash away at the now [canvas]."
The Shipping Room is a room. The red sticky label is a thing carried by the player. The description of the red sticky label is "It reads: AIRMAIL[if the label is part of something (called the parent)]. It is stuck to [the parent][end if]."
Here is the essential point: whenever we ATTACH LABEL TO something, it becomes part of that object.
And of course the label cannot be stuck to itself or to more than one thing at a time.
Before tying the label to something when the label is part of something:
if the label is part of the second noun:
say "[The label] is already stuck to [the second noun]." instead;
say "(first freeing the label)[line break]";
silently try taking the label;
if the label is part of something, stop the action.
Much of the rest is just tidying to make sure that the player's commands are redirected into the right syntax.
We could have created a new "sticking" action, but to keep the example short we will use the built-in "tying" action instead, and respond to the command "stick" just as if it were "tie".
This would be a one-star example if it were not for the repainting:
But a kind cannot change during play, so this will not do. Instead, the colour will have to be a property of the block. So we might first try this:
Which is fine, so far as it goes, but the colour property is not at all visible to the player, who simply sees "eleven blocks". We thought of colour as being something outwardly apparent, but Inform does not know this. To achieve a better effect, we will need features from distant chapters. The first is an activity called "printing the name of":
Colour is a kind of value. The colours are red, blue and green. A block is a kind of thing. A block has a colour. A block is usually blue. Before printing the name of a block: say "[colour] ". Before printing the plural name of a block: say "[colour] ".
This too, however, is unsatisfactory. The individual blocks are correctly described, but we are unable to distinguish them during play: we cannot type "take a green block", for instance. And because the blocks are indistinguishable in play, they are still massed together as "eleven blocks" in room descriptions. We need to go one step further:
Colour is a kind of value. The colours are red, blue and green. A block is a kind of thing. A block has a colour. A block is usually blue. Before printing the name of a block: say "[colour] ". Before printing the plural name of a block: say "[colour] ". Understand the colour property as describing a block.
And now everything works nicely: the blocks are grouped by colour, and can be referred to by colour, and we can even change the colour of an individual block during play, using a bit of extra trickery from later:
Understand "paint [something] [colour]" as painting it. Painting it is an action applying to one thing and one colour. Check painting it: if the noun is not a block, say "Paints are only for blocks." instead. Carry out painting it: now the colour of the noun is the colour understood. Report painting it: say "The block is now [the colour of the noun]."