I just added this extension to my game. I have yet to set up any options or rules at all related to the extension, I’ve just added it, so by default all undoability should be on and operating as normal, I think.
Undo still works when I type it in the game, but if I try to undo from the end of game menu (IE by following the immediately undo rule), that doesn’t work now. It just loops back to the end of game menu. Is this a bug, or could there be some extension conflict or something going on? I’m not using any other undo extensions, I have no undo-related code of my own, and I’m not using any of the built-in undo prevention.
This is a bug in UOC–thanks for bringing it to my attention! Undo Output Control’s basic method for allowing you to prevent UNDO is to first check the “before undoing an action” rules; if those fail, the author has disallowed UNDO. I overzealously required a check of this rulebook in the end-of-game undo rule, which is unfortunate because Inform blocks consultation of that rulebook after the game has finished, returning a failure result and thereby preventing undo from happening.
To fix this, open up your copy of Undo Output Control, then scroll down to and delete the section “End of Game Undo” (it contains one I6 inclusion). Or you can just download the new version attached to this post (see below).
This means that the only way to control UNDO at the end of the game is by controlling the presentation of the option to the player. This is the best option anyway–it would be a bit silly to say “You can UNDO the game” and then respond with “Undo is disallowed”. Here’s how to do that if you need to:
When play begins:
choose row with a final response rule of immediately undo rule in the Table of Final Question Options;
delete the final question wording entry.
You can do this conditionally as well, if needed. Just put the two lines of codes in a different rule, and make sure that rule files before the command to end the game.
I’ve submitted a new version (version 3) of UOC to the extensions library. I’ve also attached it to this post (change the extension to i7x after downloading).
Undo Output Control.txt (29.8 KB)
Thanks for the explanation and the quick fix.
Edit: … Though ironically, what you just told me about the way Inform ignores those rules if the game has ended means I can’t actually use the extension for what I wanted to use it for But this already led to me working out the solution, as well.
The goal was that if the game ended in certain circumstances, if you then undo’d from the game over menu, certain text from the last turn would be reprinted before you were given the prompt again. I was going to use a ‘before undoing’ rule for this, but Inform won’t heed those after a game over. But I realised I can just store the text during the previous turn, and have it printed as a part of the library message that is printed after a successful undo. I tested this and, to my pleasedness, it works.