Puff of Orange Smoke
Suppose we want to let the player kill characters, leaving behind corpses.
Using our "part of every person…" line, we've conveniently assigned one body per person. Since we're going to separate people from their bodies when the bodies die, though, we also want a more permanent relation that will help us keep track of which bodies used to belong to which people:
When Lydia is alive, we want >TOUCH LYDIA'S BODY to mean the same thing as >TOUCH LYDIA, so we use the setting action variables rules as a convenient point at which to reassign the action:
This doesn't change Inform's idea about what action is being performed; just about the object it's being performed on. The rest of the action will now proceed as if the player had typed >TOUCH LYDIA.
Along similar lines, once Lydia is dead, we want >MOVE LYDIA to mean >MOVE LYDIA'S BODY if the body is in view:
The trick is, though, that >MOVE LYDIA will only be understood if there is something called Lydia that the player can see and refer to, even after she's dead. There are various ways to do this, but the least painful here will be to make the deceased Lydia permanently visible, by putting her in an always-accessible backdrop. The backdrop itself will never be mentioned in the game, and we should make its name something that the player is unlikely to type casually; we don't want the player to interact with it directly. So:
It's also possible that the player will type something like >X LYDIA when Lydia's corpse is not in view, so we should have an appropriate answer to that as well:
Because the before rules happen after the setting action variables rules, this will only ever happen if the corpse is not visible.
Now we define the attack itself, which should discard the body, move the spirit to its eternal resting place, and describe the event to the player:
And finally a trick borrowed from the chapter on understanding, so that we can refer to "Lydia's body" while Lydia is alive, but "Lydia's corpse" only after Lydia has died:
Test me with "x body / x lydia's body / touch lydia's body / x corpse / kill lydia / look / x lydia's body / x lydia's corpse / x corpse / x lydia / touch lydia / lydia, hello / n / x lydia / touch lydia / lydia, hello".
Lydia is, as usual, here.
>(Testing.)
>[1] x body
Which do you mean, your body or Lydia's body?
>[2] x lydia's body
Long, long legs and a sarcastic attitude.
>[3] touch lydia's body
"Watch it, sailor," she snaps.
>[4] x corpse
You can't see any such thing.
>[5] kill lydia
With a single blow, you rid the world of Lydia.
>[6] look
Paraguay
Lydia's corpse is sprawled at your feet.
>[7] x lydia's body
Long, long legs and no attitude at all.
>[8] x lydia's corpse
Long, long legs and no attitude at all.
>[9] x corpse
Long, long legs and no attitude at all.
>[10] x lydia
Long, long legs and no attitude at all.
>[11] touch lydia
Lydia's body is grotesquely inert.
>[12] lydia, hello
There is no reply.
>[13] n
Bolivia
>[14] x lydia
Lydia is dead; or had you blocked that out?
>[15] touch lydia
Lydia is dead; or had you blocked that out?
>[16] lydia, hello
Lydia is dead; or had you blocked that out?