What rule triggers the end of the game?

I’ve been using some funky rules for processing parser errors, and I’m having some trouble with getting the game to actually end when a game-ending rule triggers inside of one. Take this (rather flawed) example code:

[code]“The Great Riddle” by Matt Weiner

Use no scoring [dammit]

Riddletorium is a room. “Remember, that riddle is ‘What rises in the morning, goes down at night, and is highest at the noon when the sun is at its height?’”.
When play begins: say “A voice booms out, ‘In this room I have hidden an object. You must take it to leave. It is the answer to this riddle: [apostrophe]What rises in the morning, goes down at night, and is highest at the noon when the sun is at its height?[apostrophe]’[line break]”.
The sun is in Riddletorium. The temperature is in Riddletorium.
Before listing nondescript items when in the Riddletorium:
now the sun is not marked for listing;
now the temperature is not marked for listing.
After taking the sun:
Say “Congratulations!”;
end the story saying “Your hands are slightly blistered”.
Instead of taking the temperature:
say “A voice booms out, ‘How are you going to take the temperature without a thermometer? Anyway, the temperature is highest at about 4 PM.’”

Understand the command “take” as something new. Understand “take [something]” as taking. [We’d really have to do this for every synonym for taking.]

To decide what action-name is the action-to-be: (- action_to_be -).
Rule for printing a parser error when the latest parser error is the can’t use multiple objects error and the action-to-be is the taking action:
say “A voice booms out, ‘Nice try, smartass.’”;
end the story saying “You have been hit by a bolt of lightning”;
[abide by the turn sequence rules.]
[abide by the advance time rule.]

Test me with “take all/foo/fa/floe/take all/sing”.[/code]

As you can see, after trying “take all,” the player doesn’t actually get hit by a bolt of lightning until entering a valid command. This is a known issue; section 9.4 says of the “end the story” rules, “This phrase ends the story at the next opportunity (typically as soon as the current rule ends).” But when exactly is the next opportunity? I can’t figure out how to force it. Abiding by the advance time rule helped me solve a similar issue, but in this case it seems to prevent the story from ending at all. Abiding by the turn sequence rules doesn’t change a thing, and neither does considering the scene changing rule. So is there anything I can do?

(The riddle comes from here. As you can see, I agree with Mr. T.)

The shutdown rulebook is invoked from the I6 main routine when control returns from the turn sequence rulebook and the deadflag is not zero. That means that you have to stop the turn sequence rulebook, which isn’t happening here.

A slightly hacky alternative is to call the shutdown rulebook yourself, as in

To end the story immediately saying (message - some text): end the story saying the message; follow the shutdown rulebook.
and then

end the story immediately saying "You have been hit by a bolt of lightning";

Thanks – looks like “follow the shutdown rulebook” should work. I guess it manually shuts things down rather than running a check to see if the story has ended, but it should amount to the same thing.

(Of interest only to me: This same issue came up in my first post on this forum, and I’ve been a member for almost exactly a year.)