This is incredible, can I use this and add you to the credits please?
Sure, feel free to use it, (I would even suggest you to do so and start using setup for constants)
I can do more to optimize the code (replace arrays with indexed objects so you don't have to duplicate the all array whenever you want to use it), but it will change the way it is written, so if you want to use it you'll have to understand what I've changed and adapt to it. Do you want me to do it ? I'm probably going to have some time this week.
If you want the details of what I've changed :
Stored all (or most) of the variables that are constant and never change in setup instead of state. To give you an explanation, state is stored in each savestate (meaning save slots but also history saves).
setup is not stored in the saves in anyway. setup variables only exist for the duration of your playthrough. When you quit the game and save a file (either in your browser or locally) setup disappear
. But they're loaded once again when you restart the game. How ? when you launch the game the game automatically runs the StoryInit passage. So whatever variables you declare there is automatically created before you even start a new save or load one.
So in short, all the variables you have in StoryInit can (should) be stored in setup if they're constant (and any constant should be declared in StoryInit (which I believe was already the case
)
There is a very important thing you have to know though. setup has a different scope than story variables ($), so you have to include them in a sugarcube macro so they're parsed. Most of the time the variables I changed were in a <<set>> macro so no change had to be made. But sometimes they weren't, so I had to add a <<print>> macro (I used <<->> ; <<=>> also work).
The other fixes I've made :
3 quotes missing in tooltips (2 in horny tooltips, 1 in gokkun tooltip)
all_treasure_list statement missing 'set'
minor_damage_buff_spell and minorheal_spell warning when not enough mana was missing .mana
typo in virgin trait tooltip (speical)
IMPORTANT note : Because when I play I don't use the in-game menu to edit image packs but edit the code instead, I've also put the packs in setup. So the version I've shared do not save image packs !
Here's a new version, with the image packs in-game menu working. It also should have all the constants assigned to setup now. (moved max_days_between_events variables declaration to StoryInit passage)