I’m working on a tutorial extension which adds a separate mini-game which is separate from the author’s game.
Everything works fine, but if the player selects the tutorial, I need the parser to discard the remainder of the “when play begins…” rules so none of the author’s setup (such as adding stats to the player, or displaying a post-banner graphic) will run.
Essentially I’d like it to behave like “stop the action” for the entire “when play begins” rulebook.
If your whole when play begins rulebook is in one rule, all you should need is an if-test. If it’s spread out all over everywhere, you’ll need the advice of an expert…
You can just cut the When play begins rulebook off with a “rule succeeds,” like this:
[code]Actual First Room is a room. Minigame room is a room.
When play begins:
say “Starting the real game now! Whoop whoop!”
First when play begins:
say “Would you like a tutorial?”;
if the player consents:
move the player to Minigame room, without printing a room description;
rule succeeds.[/code]
Now the problem is, how do you get the When play begins rules to run when the player starts the real game? I guess you could set a flag and call them by hand:
[code]Actual First Room is a room. Minigame room is a room. “Jump now.”
When play begins:
say “Starting the real game now! Whoop whoop!”
Tutorial taken is a truth state that varies.
First when play begins when tutorial taken is false:
say “Would you like a tutorial?”;
if the player consents:
move the player to Minigame room, without printing a room description;
rule succeeds.
After jumping in Minigame room:
now tutorial taken is true;
follow the when play begins rules;
move the player to actual first room.[/code]
though note that this won’t print the banner or do an initial “look” for you (here the room heading gets printed when you move the player to the first room). Might want to look into how to do that more cleanly.
Yeah, according to section 19.11 of Writing with Inform “rule succeeds” (or fails) stops the whole rulebook unless it’s a rulebook like “Every turn” that never produces an outcome. Why does it work in “When play begins” but not “Every turn”? I don’t know.
…in fact, on a little checking, I think section 19.11 is wrong and “rule succeeds” halts the Every Turn rulebook. Mantis ho! (Or maybe it’s not meant to work in “Every turn” and “When play begins” rules, in which case this solution will not be long for this world.)
It’s possible that the manual tries to say that you shouldn’t stop rulebooks like every turn rules, not that it’s impossible, but even then it’s worth a ticket to have the wording clarified.