I know QUEUE is doing just what it sounds like, which is queuing whatever routine is listed to occur some number of times. I understand the -1 means every turn.
But why are two of those set with ENABLE and the one is not?
I’m guessing this means the obvious, which is that the middle routine (I-SWORD) is not enabled initially. But then why is it being set there? The “Learning ZIL” guide does not even show ENABLE, always showing QUEUE being used alone. The ZIL Guide (by Marc Blank) does use ENABLE and doesn’t show QUEUE being used alone.
Backing up my guess perhaps, there is a routine in Zork 1 that starts like this:
QUEUE adds a routine to the interrupt queue without enabling it, so it won’t count down or fire until it’s enabled.
In Zork I, I-SWORD is the routine that prints a message about the sword glowing when there’s danger nearby. It’s disabled by default, because you don’t start out carrying the sword. (The routine still checks whether you’re carrying the sword, so this doesn’t seem like much of an optimization… but I suppose it also meant the routine didn’t have to be paged in from disk.)
So why is it queued at all before you have the sword? To make the interrupts run in a specific order, I’m guessing: once the routine is queued, it stays in that position forever. I-THIEF moves the thief around, so the relative order of those two routines in the queue determines when you’ll see the sword start to glow as the thief gets closer.
In my game I am just using ‘queue’ to add interrupt routines to the queue. I don’t use ‘enable’ anywhere in my code - yet the routines still ‘fire’ when required. This suggests that the routine is ‘enabled’ by default - is that correct?
QUEUE is usually called by ROUTINE, usually like this: <QUEUE I-SWORD -1>. Usually a number follows the first argument of QUEUE, ie 5 being after 5 turns an action is parsed (or 5 moves has passed), which at -1 is every turn after an action is parsed. This can be DEQUEUED or setting off the QUEUE () using just interrupt routine call and no further arguments. You can DEQUEUE any interrupt.