Instead...instead

Ah, I see - so some of those are what I was talking about, where different “insteads” are basically just different off-ramps from the rule, since “instead” within the text of a rule tells Inform “stop running this rule and go do this other thing.” That can be helpful if, for example, there are two conditions that might be satisfied but you only want one set of logic to fire (like say if a door is both locked and closed, you would want just the “this is locked” response if the player tried to go through it - dumb example since the basic rules take care of stuff like that but the principle is the same).

The other thing you’re asking about seems like it’s why “instead” is showing up in the rule preamble (like, “instead of examining”) as well as in the text of the rule? There, the “instead” is telling Inform when it should consult this rule and how that interacts with the regular order in which it processes rules (this bit of the docs spells out the details, including a handy flow chart).

Basically they’re separate questions - when you write a rule, first you want to ask yourself “when should this rule fire” - and the answer to that might push you to an instead rule - and then “what should happen once the rule is running” - which in turn might mean you want to write some instead statements terminating them when certain conditions are met.

(NB as to the first point, usually you don’t want to use an instead rule rather than a carry out rule or something like that! See this thread).

1 Like