I don’t really have a clever solution or explanation, and I might very well be missing something, but from cursory testing, it does actually seem to me that Inform updates the darkness status so late in the turn sequence that you can use “if in darkness
” during a Report rule, for example.
As far as I can tell, it will reflect the state as it was at the beginning of the turn, even if the current action changed the status (either by switching on/off a light source or directly changing a room to lighted/dark).
In other words, unlike, e.g., “the number of things on a supporter” during a taking action, which does accurately reflect the number of things in the various stages of the action (n things in the Before stage, n-x things in the After stage, because the Carry Out stage caused the removal of some things in the meantime), the status of “in darkness
” does not seem to change during the various phases of an action, and is only updated at the end of the turn sequence (probably in the “adjust light rule
”).
Example:
The Lab is a dark room. "You can see the lab."
Carry out jumping:
if the lab is dark:
now the lab is lighted;
otherwise:
now the lab is dark;
Last report jumping:
if in darkness:
say "Player was in darkness at the beginning of this turn.";
otherwise:
say "Player was not in darkness at the beginning of this turn.";
Every turn:
if in darkness:
say "Every-turn: player was in darkness at the beginning of this turn.";
otherwise:
say "Every-turn: player was not in darkness at the beginning of this turn.";
Output:
Darkness
It is pitch dark, and you can’t see a thing.
>z
Time passes.
Every-turn: player was in darkness at the beginning of this turn.
>jump
You jump on the spot.
Player was in darkness at the beginning of this turn.
Every-turn: player was in darkness at the beginning of this turn.
Lab
You can see the lab.
>l
Lab
You can see the lab.
Every-turn: player was not in darkness at the beginning of this turn.
>jump
You jump on the spot.
Player was not in darkness at the beginning of this turn.
Every-turn: player was not in darkness at the beginning of this turn.
It is now pitch dark in here!
It works the same for a similar “Last report switching on a light source
” rule (coming after a Carry out
rule which turns on the “lit
” status of a device).