inform7

Can I "end the story" from within an activity rule?


I'm using an "after reading a command" rule to hijack the command line.

"The Halting Problem" by jorendorff

Termination Hall is a room. "Please type your name."

The continuation is a rule that varies. The continuation is the naming rule.

After reading a command:
    [say "(executing [the continuation]...)";]
    follow the continuation;
    reject the player's command.

This works, but if a rule says to end the story, it doesn't end.

This is the naming rule:
    say "Thank you, [the player's command]. We are now going to end the story.";
    end the story saying "You have died";
    say "This line should not be reached."

Instead it behaves like this:

Termination Hall

Please type your name.

> jorendorff
Thank you, jorendorff. We are now going to end the story.
This line should not be reached.

>

Is it a bug? Is there a way to make the story actually end from an after-activity rule?


Solution

  • Mainly for historical reasons that aren't quite as relevant today, "end the story" doesn't stop the game immediately but sets a "deadflag" that gets checked at the end of the turn, which will trigger the shutdown rules that actually end the story. In this case because the player's command is rejected, the normal turn sequence isn't followed through and deadflag never gets checked.

    What you can do is run the shutdown rules manually:

    This is the naming rule:
        say "Thank you, [the player's command]. We are now going to end the story.";
        end the story saying "You have died";
        follow the shutdown rules.