Last year I wrote a couple of blog posts explaining how to use external files to save the player’s progress automatically, as was used to jaw-dropping effect in Ryan Veeder’s Authentic Fly Fishing. I also intimated that I would write a third post explaining techniques left unexplained in the first two posts.
That was in September. Today I have written that third post, so the series is complete, unless someone wants me to explain something else. Here are the posts:
Basic Autosaving in Inform 7 - Acceptable data types; representing progress as a number; writing and reading external files;
Advanced Autosaving in Inform 7 - Fancier ways of representing progress; autosaving inventory; constructing tables on the fly; starting over completely
It seems to me that it wouldn’t be very difficult to integrate your autosave mechanism with the Inform SAVE and RESTORE functions. (My thoughts are that you could use the external file to fill (say) a Table of Saving Progress before saving. Then an “every turn” rule could check whether that table was non-empty, and if so write it to the external file, then empty it.)
A way I’ve intercepted undo/save/restore actions (when I need to look up, edit or read in an autosaved file after such an action has been taken by the player) is by adding ‘to say’ phrases to their responses.
For instance, if you want the game to run some cleanup/checks after the player used UNDO, you can change the message that tells them they undid like so:
now the immediately undo rule response (E) is
"Previous turn undone.[recovery-mechanic]";
To say recovery-mechanic:
(put your cool external file cleanup code here)