Inform7: How can I code a 'restart game' option

I’m entering my IF game into my uni’s summer show and as a result i need (it is a must) there to be a restart option which hopefully i can customize. Does anyone know of any easy way I can do this? I couldn’t find anything

thanks

What kind of customization do you need? The standard library already includes the RESTART command.

You can’t write before, instead or after rules for out of world actions, but you can easily do things like this:

Check restarting the game for the first time:
	instead say "No way. Not now."
	
Check restarting the game for the second time:
	instead follow the restart the game rule.
	
Check restarting the game for the third time:
	instead say "Again?! Can you make your mind up, please?"
	
Check restarting the game for the fourth time:
	instead follow the immediately restart the VM rule.

Test me with "restart / restart / yes / restart /restart / no / restart / restart".

The restart the game rule is what ordinarily fires when you type RESTART.
The immediately restart the VM rule asks no questions before it restarts the game.

Felix, that works as long as the player doesn’t actually restart the game (that is, replies “no” to the confirmation question). Once the game restarts the action counter resets.

Yes.

(The example was only meant to show a simple way to gain some control over the restart mechanism and to demonstrate the two restart rules.)