I'm in the dark here

You’re essentially replicating the logic of Inform Recipe Book #81, “Unblinking,” but I think that it’s easier to just write an adjective that describes the room and also handles the work of moving the relevant object around for you, so you don’t have to remember to do it every time you check to see if a room has light.

Here’s one way to do that:

``````The light-meter is a privately-named scenery thing. [privately-named so the player can't ever refer to it, even accidentally]

Definition: a room (called the target room) is light-filled:
if the target room is lighted, yes;
move the light-meter to the target room;
if the light-meter can see a lit thing:
now the light-meter is nowhere;
decide on true;
otherwise:
now the light-meter is nowhere;
decide on false.
``````

Note that this still won’t get the answer right in cases where a room has a lit backdrop, because backdrops only get moved into a location when the player does. But it’s good enough for a lot of cases.

1 Like