Actually, StoryInit only runs on start-up, not when saved games are loaded.* For example, maybe you have a variable $day that you set to 1 in StoryInit. If a player loads a save from day 15, the variable $day does not suddenly get set back to 1.
In Twine, you do not have to declare variables before you use them (though it will throw an error if you try to access information stored by a non-existent variable). Therefore it's not necessary to find somewhere to initialize them before you use them. However, if you want to keep old saves up to date then you should look into
You must be registered to see the links
.
Here's an example of what you can do:
* I realize that the
You must be registered to see the links
seems to say differently, but it's either wrong or worded incredibly badly. Yes, the StoryInit passage is run every time the browser loads the html file (so when you first open the file or when you somehow refresh the browser). However, loading saves does not refresh the browser, which means it does not reload the html file. Here's a slight modification of the sample code in the documentation:
Yes, the value for setup.y is set when you load up the game and it's still there when you load a save because it's stored separately from the regular variables. However, if StoryInit really did run whenever a save is loaded, then setup.y would change every time you load a save but that is not the case. Also, data stored in the setup object does not persist between sessions unless you
You must be registered to see the links
them.