Combined rule for both explicit and implicit take?

I have a book, a cat and a fire.

Rule for implicitly taking the book when the book is on the fire:
    say "Can't. You'd burn your hands."

This looks after situations when the book is on the fire and the player wants to do things such as:
> Throw book at cat

But the player can still use the explicit take:
> Take book

I can add:

Instead of taking the book when the book is on the fire:
    say "Can't. You'd burn your hands."

But I’m repeating myself. How do I define a rule for both the implicit and explicit taking of the book from the fire?

The second rule you wrote should work for both implicit and explicit takes:

[code]Lab is a room. The fire is a supporter in the Lab. The book is in the Lab. The cat is in the Lab.

Instead of taking the book when the book is on the fire: say “Can’t. You’d burn your hands.”

Test me with “take book/put book on fire/throw book at cat/take book”.[/code]

I don’t want the parser to print:
(first taking the book)

(Sorry, should have made that clear at the top of the thread.)

You’ve got a two-rule solution that works the way you want. How much time do you want to spend looking for a one-rule solution? (Longer than it takes to copy-and-paste the second rule?)

If you use the extension Implicit Actions by Eric Eve, it’ll alter that text automatically based on whether the action succeeded or failed. So:

That looks like a more elegant solution. Parser response feels more satisfactory.

Unfortunately, the extension isn’t currently listed: http://inform7.com/extensions/authors/#Eric_Eve I assume that’s because it’s incompatible with the current version.

The extension is in the Public Library. Open the Extensions pane in the Inform IDE and click on the Public Library tab.

Also, if you have a two-rule solution and you’re worried about keeping the messages in sync, you can use a text substitution:

Rule for implicitly taking the book when the book is on the fire: say "[book refusal]". Instead of taking the book when the book is on the fire: say "[book refusal]". To say book refusal: say "Can't. You'd burn your hands."

Then if you want to change the message you only have to change it one place. (I haven’t tested to see whether this gets the spacing right. Spacing always messes me up.)

I’ve found the spacing for things like this is a bit cleaner if you use a phrase instead of a substitution. But it’s not always right even so.

Instead of ...: refuse to take the book.
To refuse to take the book: say "..."

A constant also works:

The book-refusal-text is always "Can't. You'd burn your hands."

EDIT: I guess you need a line break there to get the exact same result as a literal say text:

The book-refusal-text is always "Can't. You'd burn your hands.[line break]"