When the turn sequence is interrupted

What are all the situations where the turn sequence rulebook fails to reach the end? And at what point do they stop? And how is it determined?

I know that a parser error will cause the turn sequence to stop. In this case I assume that the last rulebook to run is the “after printing a parser error” rulebook. Is that right?

I also know that actions out-of-world skip the Before and After rulebooks, as well as ending the turn sequence early. Is the “report [action]” rulebook the last one to run? Is there a way to have something happen after an out-of-world action of any kind has completed?

From the index, the rulebook has these entries:
Parse Command Rule
Generate Action Rule
(consider the scene changing rules)
Every Turn Stage Rule
Timed Events Rule
Advance Time Rule
Update Chronological Records Rule
(consider the scene changing rules)
Adjust Light Rule
Note Object Acquisitions Rule
Notify Score Changes Rule

Opening the Standard Rules, we see that, of the listed rules defined in I7, none makes a decision, so they cannot stop the Turn Sequence Rulebook. As for those that are implemented in I6, the Standard Rules gives us routine names in lines like:

The adjust light rule translates into I6 as "ADJUST_LIGHT_R".

Looking in the template layer, most of these routines end in rfalse, so they makes no decision (WI 25.19). GENERATE_ACTION_R is an exception; it has these lines at then end:

if (meta) { RulebookSucceeds(); rtrue; } rfalse;
Searching the .i6t files for |meta| brings up these tidbits:

and

To summarize, the only thing (barring authorial intervention) that will stop the Turn Sequence Rulebook early is a mistake or an out-of-world action. Parser errors are a somewhat different case: the parser will loop until it gets a valid input, running the Printing a Parser Error activity (and also the Constructing the Status Line activity twice, though nothing else) for each bad command. So, strictly speaking, the Turn Sequence Rulebook isn’t stopped by parser errors; it just processes more than one command before finishing.

For out-of-world actions, yes, the report rulebook is the last to run, unless you want to count things like the (rule succeeds) at the end of the Specific Action Processing Rulebook. To make a rulebook act like ``after’’ for out-of-world actions, you need to add a hook to the success of the Generate Action Rule, like this:

[code]There is a room.

The out-of-world after rulebook is a rulebook.
This is the revised generate action rule:
follow the generate action rule;
if rule succeeded:
follow the out-of-world after rulebook;
rule succeeds.
The revised generate action rule is listed instead of the generate action rule in the turn sequence rulebook.

Out-of-world after preferring sometimes abbreviated room descriptions:
say “You just ran the out-of-world action ‘brief.’”

Test me with “superbrief / brief / sing”.[/code]

That looks handy! Much cleaner than adding my rule to the report rulebook of every out-of-world action…

I also discovered that ending the game interrupts the turn sequence. It seemed like the best hook for handling that was “after printing the player’s obituary” - handling the final question seemed to be too late.

And the reason for that, along with the problems I had with parser errors, was this: The Automated Testing extension that I’m fiddling with wants to capture text output before the vm starts collecting input again. So it turns out that the turn sequence isn’t as important as when input is requested. I wonder if I could use “before reading a command” instead? It looks promising, but it seems to be messing with the code for manipulating the player’s input - the first command in the test script gets lost.

I think I’m going to have to look into the asking which do you mean activity too…

Ending the story (the I6 “deadflag” variable) is a special case. If its value changes, that will interrupt any rulebook in progress.

Before Reading a Command seems to be the way to go. I figured out how to keep it from firing when there’s no command to process yet.

The only hitch that I can see at this point is “undo.” I’m not sure if there’s much I could do to recover from that. In itself “undo” isn’t much of a problem because the extension documentation can just tell users not to put undo, save, or restore in a test script. But I’m not sure if there are other commands that might cause similar havoc.

This whole business has got me curious about Hypothetical Questions. I might end up incorporating it somehow.