How To Make an Action that Fails by Default

I’ve got a simple scenario where I’m defining a “helping” action:

Helping is an action applying to one object. Understand “help [something]” or “save [something]” as helping. Unsuccessful attempt by an actor helping: say “[The actor] [if the actor is the player]don’t[else if the actor is singular-named]doesn’t[else]don’t[end if] know how to help [the noun].”

My question is how do I make it so that I can default the helping action to failure, but make it succeed in specific situations.

So if you say josh, help mary, then it will say “josh doesn’t know how to help mary” by default.

But for specific scenarios I want to define what happens when helping succeeds.

Oooh, OK, just found this:

https://inform-7-handbook.readthedocs.io/en/latest/chapter_4_actions/rulebooks_&_stop_the_action/

It looks like I can use a check rule that always fails, then use an instead rule with a rule succeeds phrase in it:

Instead of josh helping mary:
    say "Josh helps mary";
    rule succeeds.

Yep! That’s a pattern used in the Standard Rules when an action is supposed to fail by default (giving, showing, waking, etc).

Check an actor waking (this is the block waking rule):
    if the actor is the player:
        now the prior named object is nothing;
        say "That [seem] unnecessary." (A);
    stop the action.
1 Like

Noting because I forgot I could do this for a second: if you want to change the failure notice in specific situations you can just make more specific Unsuccessful attempt by rules:

Unsuccessful attempt by josh helping mary in the kitchen:
    say "Josh is unfortunately useless in the kitchen.".