Aftershock
The built-in behavior of Inform is to print a line after a device is examined, saying whether the item is on or off. This is often inappropriate, and we could simply turn off that behavior in general by instructing Inform to ignore the "examine devices rule" (see the chapter on rulebooks).
Perhaps, though, we would like continue to have a short passage about the action of any switched on device; we'd just like a little more control over what it says from time to time. And in that case, we might change the rule to give a new activity control over that portion of the description:
Borrowing from the rulebooks chapter, we can replace the standard "examine devices" rule with something that uses this activity.
Thus far we have essentially replicated the original behavior, but we've made it possible to write specialized behavior for devices, and to invoke that behavior in other places:
This might be useful for an electric lamp kind:
And with our activity, we can override the flashlight's electric lamp behavior with new behavior:
…or give special actions for the radio:
Test me with "examine light / switch light off / switch flashlight on / switch radio on / examine radio / examine flashlight".
The only room in the house with no furniture and almost nothing on the walls. At times like this you always notice the crack in the plaster, originating near the light fixture and running almost all the way to the wall.
You can see a plastic jug of filtered water here.
>(Testing.)
>[1] examine light
A plain globe of frosted glass containing the light bulb. Nothing special, and you never think about it except when, as now, you are forced to spend hours in this room.
The light fixture is lit.
>[2] switch light off
You switch the light fixture off.
It is now pitch dark in here!
>[3] switch flashlight on
You flip a switch. A strong, narrow beam of light shines from the flashlight.
Downstairs Hallway
The only room in the house with no furniture and almost nothing on the walls. At times like this you always notice the crack in the plaster, originating near the light fixture and running almost all the way to the wall.
You can see a plastic jug of filtered water here.
>[4] switch radio on
You flip a switch. Through the static, you pick up pieces of discussion: a 6.7 on the Richter scale, epicenter... something about Topanga... but it crackles out again.
>[5] examine radio
A small battery-operated radio which you received for free with your subscription to US News & World Report. It has served you well through many earthquakes past.
Through the static, you pick up pieces of discussion: a 6.7 on the Richter scale, epicenter... something about Topanga... but it crackles out again.
>[6] examine flashlight
A shiny red flashlight.
A strong, narrow beam of light shines from the flashlight.