End-of-game options

Is there supposed to be an Inform 7 Reference Book? I feel a bit foolish asking, but if there is, I don’t know how to find it.

I based this attempt on two examples, #138 “Big Sky Country,” and #370, Jamaica 1688.

Tale is a room.

achievement is a truth state that varies.

Winning is an action applying to nothing. Understand “win” as winning.

Carry out winning: now achievement is true.

Report winning:
say “You made it!”;

Losing is an action applying to nothing. Understand “lose” as losing.

Carry out losing: end the game in death.

Table of Final Question Options (continued)
final question wording only if victorious topic final response rule final response activity
“REPLAY [the current episode]” false “replay” restart the current episode rule –

This is the restart the current episode rule:
resume the story;
reset the current episode;
try looking;

The current episode is a scene that varies.

Every turn: say “The current episode is [the current episode].”

When a scene (called the moment) begins:
say “[the moment] is beginning.”;
reset the moment;

To reset (the installment - a scene):
Now achievement is false;
Now the current episode is the installment;

Prologue is a scene. Prologue begins when play begins. Prologue ends when achievement is true.

Middle is a scene. Middle begins when Prologue ends. Middle ends when achievement is true.

Epilogue is a scene. Epilogue begins when Middle ends. Epilogue ends when achievement is true.

When Epilogue ends: end the game in victory.

test me with “lose/replay”[/code]

You wrote “REPLAY [the current episode]” in the table, but your test command only says “REPLAY”.

I’m actually surprised Inform allowed you to require a parameter there. I tried something like “RESTART [text]” and it thwacked my hands with a ruler.

That should be OK – the text substitution is only used in the display of the REPLAY option. The actual expected text is in the third column: “replay”.

I don’t know the answer to the original poster’s question, though…

EDIT: As per zarf’s answer, my speculation was totally wrong, so I’m hiding it beneath a rant tag for posterity.

[rant]I don’t know the answer to the original poster’s question either, but I’ll speculate: Is it possible that the game is considering the scene-changing rules as soon as you resume it? The documentation for “resume the game/story” says it causes play to resume exactly as if no ending had been reached. Since play ended in the middle of a Carry Out rule, I can convince myself that the rules chart says that you should resume in (or just after) the generate action rules, which means the scene changing rules would fire right away – and since achievement is true, that would mean that all the scenes end at once, and the game with it. Not sure why it wouldn’t print “You have won” but this seems like a place where a corner case would arise.

So one thing that I might suggest would be setting achievement to false before you resume the game. Another might be just switching “reset the current episode” and “resume the game.” How are you setting “The current episode,” by the way? I can’t see where it gets set in your code.

What you’re trying to do just isn’t supported. Once you get into the final question, there is no code path out. (The only way to leave the question loop is to wallop the VM state, by restart/restore/undo/quit.)

(When the documentation says “resume exactly”, it’s not promising anything magical – it just sets a flag that requests a new turn to start as normal. That flag is checked before the final question, not during it.)

Here’s the logic that does what you want:

This is the zarf's ask the final question rule:
	ask the final question replayably.

To ask the final question replayably: (-
	print "^";
	while (true) {
		if (resurrect_please) {

Zarf's ask the final question rule is listed instead of the ask the final question rule in the shutdown rulebook.

I thought it might be something like that, when I realized Big Sky Country avoids the final question completely.

Thanks for the fix!

By the way, is there more detail about the Table of Final Question Options anywhere in the documentation? Or should I just read the source code if I want to change the wording or order of existing questions?

Maybe I just need to review the documentation on tables…

By the way, what’s really the difference between a regular scene and a recurring scene? Does a recurring scene have to end before it can begin again? What happens when the start condition of a non-recurring scene becomes false and then true again after the scene ends? Is it the same when it’s a regular condition and when it’s an “X scene ends” condition?

A recurring scene will start over if the conditions for it happen and the scene has ended. A regular scene will not, even if the start conditions become true again – regardless of what those start conditions are.

It’s covered in moderate detail (including a full list of the default table contents) at inform7.com/learn/man/Rdoc96.html . Tweaking it can be done with any of the things you can do with tables otherwise.

I see I need to get more familiar with the Recipe Book. Thanks for the link!