Just replace the outcome of an action, but not the check before it

The player has a gun, and the player has an “armed” state, which is enabled & disabled with special actions “arm” and “disarm”.

What’s the best way to set up a “shoot [something]” action which first checks if the player is “armed” by default, and then for each object, I can just replace the outcome of shooting that object without having to check if the player is “armed” each time?

The action structure is designed to have several stages which make it easy to reason for how an action is carried out. One of the stages is the “check” stage which is intended for adding rules which check whether the player has what’s needed to do this action. If any check rule fails then the action stops immediately. The “carry out” stage follows the check stage, if all the checks passed, and let’s you add individual rules for specific objects, or generic rules if the same behaviour applies to all objects.

The manual explains this all in more detail, but I can’t check right now which chapter sections are the most relevant.

2 Likes

Chapter 12 deals with actions, but this is probably the relevant section:

§12.9. Check, carry out, report

The normal behaviour of an action is specified by its three associated rulebooks - check, carry out and report. In the case of our “photographing” example, these rulebooks will be:

Check photographing. Here, for instance, we need to verify that the player has the camera. If any of our checks fail, we should say why and stop the action. If they succeed, we say nothing.

Carry out photographing. At this stage no further checking is needed (or allowed): the action now definitively takes place. At this point we might, for instance, deduct one from the number of exposures left on the film in the camera, or award the player points for capturing something interesting for posterity. But we should say nothing.

Report photographing. At this stage no further activity is needed (or allowed): whatever effect the action had, it has happened and is now over. All we can do is to say what has taken place.

It may be easy to forget that carry out rules can still have if/else statements or apply to specific situations, such as “Carry out attacking someone with a melee weapon…” “Carry out attacking someone with a ranged weapon…” which will all be considered after all the check rules pass.

http://inform7.com/learn/man/WI_12_9.html

1 Like

Thanks guys, that gives me a better understanding of how the process works too.

2 Likes