[ZILF] Distinction of LIGHTBIT and ONBIT

Probably mostly for @vaporware:

Looking at the Learning ZIL document, it reads as follows:

LIGHTBIT: The object is capable of being turned on and off, like the old brass lantern from Zork.
However, it doesn’t mean that the object is actually on.

ONBIT: In the case of a room, this means that the room is lit. If your game takes place during
the day, any outdoor room should have the ONBIT. In the case of an object, this means that
the object is providing light. An object with the ONBIT should also have the LIGHTBIT.

However, from what I can see, ONBIT isn’t supported in ZILF. ROOMS are set with LIGHTBIT. Yet rooms can’t be turned on or off. The guide suggests that OBJECTS should have both set, but that ROOMS should only have ONBIT, as in the following (shortened) example from the guide:

<ROOM LIVING - ROOM
  (LOC ROOMS)
  (DESC "Living Room")
  (FLAGS RLANDBIT ONBIT SACREDBIT)

I just want to make sure I document this correctly.

Does ONBIT have any relevance whatsoever?

I’m not sure about modern ZIL(F), but Marc Blank’s 1982 guide (§12.1.10) says that ONBIT is used to make something give off light, whether it’s a room or an object, and makes no mention of LIGHTBIT. The latter is used on the candles and the lamp all the way back in Zork 1, which makes me think Marc just forgot to mention it. But ONBIT is indeed applied to all lit rooms in Zork 1, as the standard “this thing/room gives off light” flag.

(That said, what flags do what is a property of the game and the library, not of ZIL(F) itself. ONBIT and LIGHTBIT mean whatever the game uses them to mean, nothing more, nothing less. So it’s not wrong to use LIGHTBIT to make rooms give off light, as long as the library’s light-calculation routines are expecting that.)

Good catch.

ZILF’s library uses LIGHTBIT to mean “is lit (or is a light source)”, DEVICEBIT to mean “can be switched on and off”, and ONBIT to mean “is currently switched on”; there’s no connection between LIGHTBIT and ONBIT. Advent has a couple pointless references to ONBIT, but the lamp works simply by toggling LIGHTBIT on and off in its action routine.

This is different from what’s documented in Learning ZIL, and there isn’t much of a good reason for it to be different. I vaguely recall doing it this way on purpose because it didn’t seem right to assume every switchable object was a kind of lamp, but in retrospect, sticking to the documented behavior probably would’ve been better. I’m open to changing this.

1 Like

It’s also worth noting that Zork 1 had some extremely annoying bugs coming from the use of ONBIT and LIGHTBIT: dropping the candles (including during the exorcism) clears one but not the other, for example, so they continue to burn down without giving off light and without being able to be extinguished.

So overhauling the system isn’t a bad idea!

1 Like