| Chapter 12: Advanced Actions |

| 12.10. Making actions work for other people

The "photographing" action now works very nicely when the player does it. But not when others try. Suppose that neither the player, nor Clark Gable, is holding the camera:

> >photograph clark
> You can hardly photograph without a camera, now can you?

> >clark, photograph me
> >

An uncanny silence. What has happened is that the rules written so far are all implicitly restricted to the player only. This is because when we write -

> Check photographing: if the camera is not carried then say "You can hardly photograph without a camera, now can you?" instead.

the action is "photographing", not "Clark trying photographing". In the next few sections we shall see how to make the rules work nicely for everybody. This is a little bit harder, so it should be noted right away that in many projects there is no need. In a game which has no other characters who succumb to persuasion, for instance, only the player will ever try the action.

166
| Example The Man of Steel An escaping action which means "go to any room you can reach from here", and is only useful to non-player characters.

167
| Example Trying Taking Manhattan Replacing the inventory reporting rule with another which does something slightly different.

Inform has built-in commands for other people, and sometimes we may want to adjust the way these work without completely disabling and replacing the command. Suppose, for instance, that instead of Kermit the Frog looks through his possessions. we'd like someone taking inventory to report what he's got, thus: Kermit the Frog says, "I seem to be carrying a microphone and wearing a hat and a trenchcoat." To do this, we could replace the built-in report rule with a different one. "Trying Taking Manhattan" Procedural rule: substitute the loud inventory rule for the report other people taking inventory rule. This is the loud inventory rule: if the player is the person asked, do nothing; otherwise say "[The person asked] says, 'I seem to be carrying [a list of things carried by the person asked][if the person asked is wearing something] and wearing [a list of things worn by the person asked][end if].'" Persuasion rule for asking someone to try doing something: persuasion succeeds. Grand Central Station is a room. "Here you are in New York, New York. Any minute now someone is going to burst into song." Kermit the Frog is a man in Grand Central Station. "Kermit the Frog stands nearby, enjoying being green." Kermit is wearing a hat and a trenchcoat. He is carrying a microphone. Test me with "inventory / kermit, inventory".

168
| Example Under Contract Creating a person who accepts most instructions and reacts correctly when a request leads implicitly to inappropriate behavior.

Previous | Contents | Next