Would you like to RESTART, RESTORE a saved game, QUIT or UNDO the last command?
I want to keep this, but add some text and another option. I can’t find an example in the docs, probably because there are hundreds of examples that include “end the story” code, and I don’t want to read them all to find one that deals with adding stuff. Can someone point me to one? Is it just something like some “report ending the story” code?
I looked into it after seeing the thread. I was curious. So it does seem rather tortuous. First, like the thing says, you have to add to a table (you can find the table of final question options in the standard rules). In this example, I added a “Joyce” command that quotes the beginning of A Portrait of the Artist as a Young Man.
The first column in the table is the text displayed in the end-of-story list. The second column is fine as false, unless you have multiple final endings. The third column is the command that fires that option, and the third column is the rule that kicks off. In this case, the rule just displays some extra text. The last column is for an activity, but that’s a lot of trouble if you don’t need one.
Edit: Let me know if you can’t seen the Borogrove snippet. It shows sample code and is playable.
One other thing I’ve found from personal experience tinkering with the ending.
First, it’s valuable to have a “win” command to just win the game right away to test things.
It may also be valuable to have a sandbox project to prototype things. In other words, have an otherwise empty game you can win on the first move, so you can tinker with the end menu.
If you want control over the text, you can poke at the Table of Final Questions in the standard rules, or you can even combine two rules like so. I’ve found this useful for detailed punctuation tweaks.
to win-the-game: end the story finally saying "Everybody betrayed you. You're fed up with this world!";
Table of Final Question Options (continued)
final question wording only if victorious topic final response rule final response activity
"Continue as [b]MARK[r], [b]LISA[r], or [b]DENNY[r]" true "mark" the continue as Mark rule --
-- true "lisa" the continue as Lisa rule --
-- true "denny" the continue as Denny rule --
While it would be possible to put “mark” and “lisa” in separate final question wordings, or say “Continue as Mark, Continue as Lisa, Continue as Denny,” this makes slightly smoother text.
Also note the blanks in the final question wording can be used to create a dummy or hidden option.
I have a good cheat in place, and hopefully it will pass the smell test. If a tester complains then I’ll fool with these tables. Definitely good to know how Inform handles ending the story, though. I like writing teeny tiny games just to mess with one thing, and this is next on my list to tinker with.
The end-of-game machinery has… never seemed to me to have a payoff commensurate with how clunky and cumbersome it is.
lab is a room.
The player carries the foil-jacketed potato.
The oven is an open container in the lab.
Endgame is a scene.
Endgame begins when the potato is in the oven.
When endgame begins: say "You won! You can now Restore, Restart, Quit, or Amusing."
amusing is an action out of world.
understand "amusing" as amusing when endgame is happening.
carry out amusing: say "Try putting the potato in the oven."
[ "endgame action" is a totally arbitrary label that has no connection to the scene name
and "action" is just part of the arbitrary label. It could be Amusing is garglefoop.]
restarting the game is an endgame action.
restoring the game is an endgame action.
amusing is an endgame action.
quitting the game is an endgame action.
before doing anything except an endgame action when endgame is happening,
instead say "Only Restore, Restart, Quit, or Amusing are available."
I think the intended payoff is circumventing all the usual game loop machinery, which means you don’t need to rewrite your “every turn” rules to turn off once the endgame starts, or watch out for overly-broad “after reading a command” rules, and so on. It’s the same reason “if the player consents” circumvents the usual input-parse-execute loop instead of just using the “saying yes” and “saying no” actions.
eh, The every turn stage rule does nothing when endgame is happening. And maybe deactivate a few other turn sequence rules. Yeah, you’d have to remember to add when endgame is not happening to After reading a command rules. But all of that still sounds easier to me than trying to customize behavior with the existing framework.
I do agree with that. But in another thread zarf pointed out that various design decisions in Inform have to take into account the tendency of authors to do all their parsing in “after reading a command” rules, or in “understand as a mistake” lines.
As a side note, out-of-world actions ignore “before” rules, so I don’t think the “endgame action” category is currently doing anything. (The idea being, “instead of doing anything except waiting during My Scene” shouldn’t prevent restoring a game or quitting.)
I think it’s a bit overcooked, but it isn’t bad if you get the structure of the table and understand appending it. I feel the documentation could be more granular in this regard. I also think the sample shouldn’t feature a footnote-style rule with another table to deal with. Finally, I got tripped up examining the original table in the Standard Rules because the options all seem to fire off I6 rules, which I don’t know anything about. I’m speaking as a novice who thinks, theoretically, this is a straightforward task I can complete: add to a table and write a rule.
Something simple (as a recipe) would have been better. Advanced coders shouldn’t have trouble figuring out what to do if they want something more sophisticated, since it’s ultimately just implementing a rule (though I can’t speak to the activity option).
E: Note, I actually made an activity first because I didn’t fully understand the table.
Good point. In fact, the consequences for my code above are worse than that: since out of world actions short-circuit the whole early action-processing sequence and go straight to the action-specific rules, I’d need individual Check rules to print the “only these are available” message for Verify and Superbrief and whatnot.
Yeah, and of course any of these rules could alter the game state arbitrarily, so you could fully re-implement the standard rules if you wanted to do something that wasn’t just a CYOA-hack… it’d be fairly tedious for a joke game but maybe worth it.
ok, there’s more to ending the game than I’d thought about. I just pushed an Endgame extension to my fork of the Friends of I7 repo that I think this does a reasonably thorough job of deactivating things. As written, though, it doesn’t work for versions prior to the current development version, 'cause the scene changing rules used to be anonymous; they didn’t get names till right after 10.1’s release.
As @Draconis pointed out, one would also have to be mindful of adding when game on to any of several things one might have added (or that the extensions one has included might have added): after reading a command, understand statements, or any rules added to the action-processing or turn sequence rules. And of adding check statements similar to the ones in the extension to any new Out of World actions. And you’d probably want to deactivate or rewrite the status bar.