# Action rule doesn't work

[code]Understand “unscrew [something]” as unscrewing.

Check unscrewing pick guard:
if player does not hold guitar:
say “You need a guitar to do that.”;
stop the action;
otherwise:
if player does not hold screwdriver:
say “You need a screwdriver to do that.”;
stop the action;
otherwise:
say “You unscrew the pick guard from the guitar case. You now hold the pick guard in one hand and the screw in the other.”;
now player holds screw;
now player holds pick guard;
continue the action.[/code]

Parser says:

actions
Actions listing on.

unscrew pick guard
[turning the pick guard]
Nothing obvious happens.
[turning the pick guard - succeeded]

As the Actions listing shows you, the command “unscrew” already maps to the “turning” action.

OK, but this part:

otherwise:
say “You unscrew the pick guard from the guitar case. You now hold the pick guard in one hand and the screw in the other.”;
now player holds screw;
now player holds pick guard;
continue the action.

never executes.

Yes. That’s because your rule never runs. A “check unscrewing” rule won’t execute for any action except “unscrewing”.

Well, geez, I trief instead of and then carry out, and I got the same results.

If there’s a command that’s already mapped to an action, the only way to map it to a new action is to say

``Understand the command "unscrew" as something new.``

before your new Understand lines. Otherwise Inform will always interpret “unscrew [something]” as turning instead of the new action you’ve defined.

That works, although the beta testers are going to have some questions.

If I spell “pick guard” correctly, things carry on as I expected them to.
If I misspell “pick guard,” say as “pick guarf,” the parser says: “I only understood you as far as wanting to unscrew the pick guard.”

Thanks all.

This is because the parser expects to see one noun after unscrew. It ignores “the” and looks at what’s next. It sees “pick guarf” and consults its object table noting that there’s no such thing, so it breaks that phrase up into words: “pick” and “guarf”. It interprets “pick” as the pick guard. (Any object with a name that consists of more than one word can be referred to by any of its words.) But, then it has this extra word “guarf”, which it doesn’t understand. Hence the error message.