Implementing "press r to restart"

Is it possible to create a shortcut for “restart” (typing the letter R, for example) the way X is the shortcut for “examine”? (Edit: specifically in response to the final question.)

Sure!

Understand “r” as restarting the game.

(In case it’s helpful, an easy way to check stuff like this is to use the ACTIONS testing command - if you type that and then type RESTART you’ll see that that invokes the restarting the game action.

3 Likes

Ahh, thank you so much! The “actions” command is going to be so helpful.

2 Likes

Okay, so I added that code to my game but I’ve discovered that pressing R to restart doesn’t work at the end (in answer to the final question). Is there a way around that?

1 Like

The output and the actions at the end are governed by the Table of Final Question Options, cf. 11.6. Ending The Story.

One way to allow “r” for restart there would be like this:

The Lab is a room.

After jumping:
	end the story.

When play begins:
	choose row with a final response rule of immediately restart the VM rule in the Table of Final Question Options;
	now the final question wording entry is "(R)ESTART";

Table of Final Question Options (continued)
final question wording	only if victorious	topic	final response rule	final response activity
--	false	"r"	immediately restart the VM rule	--
4 Likes

Isn’t there also syntax like “restart the story abruptly”?

1 Like

There’s the restarting the game action, which translates into Inform 6 as “RESTART_THE_GAME_R”; then there’s what’s invoked in the end of game table, which translates into I6 as “IMMEDIATELY_RESTART_VM_R”. I know nothing of Inform 6, though, so wiser heads than mine would be needed to say what the difference between those two actually is – the second certainly sounds more serious!

1 Like

One difference is that the normal restarting action (during the game) asks the player “Are you sure you want to restart?”, whereas the immediate restart that’s offered at the end doesn’t ask for confirmation. I don’t know whether there are other differences.

3 Likes

Excellent, thank you!

2 Likes