Closed HoweDaniel closed 1 year ago
Tested the save using the older inventory system and that worked.
Strange. If it works in saves it should work in export/import. I'll need to investigate this. Thanks for the report!
for what its worth, the save to slot behavior is the same. It loses the inventory contents. Im on sugarcube 2.36.1 . My machine is MacOS/Safari also tried MacOS/Firefox.
It should/did work with normal saves for sure in the past, but I'll check.
Ok. let me know if I can supply you with anymore info. Unfortunately I'll soon need to revert back to the V1 simple inventory. I tested that and it still works.
Checking my test projects, using both normal saves and saves to disk, both work as expected, preserving the inventory data as expected.
If possible can you send me the compiled HTML file that is misbehaving?
Sure. the attached example demonstrates the behavior. SaveBugExample.html.zip
Sorry it took me so long to get back to you. The issue is not with SI3, and older SI versions will also not work with this. The game state is only updated on passage navigation, and this has always been the case. Changes to in-engine variables after the last passage nav and before the next will never be (and have never been) reflected in saved games or serialized moments, it will revert to the state things were in the last time navigation occurred. Again, this is just a hard limitation of the engine, nothing unique to this library.
By picking up the item, navigating to a the same passage via the console, and then saving I was able to get the inventory state to update and work as expected in the example file you sent over.
Thank you for the update. Is there a way to force the l logic in the navigation prior to the save? Re-navigate to the room your in via javascript? maybe something more granular? I would greatly appreciate suggestions on ways to get around this. thanks.
Even if you play a big AAA video game, you'll find that most of the time, when you save and load, it'll put you back to a checkpoint, whether that's leaving or entering a room, just after or before a cutcsene, or the start or end of the most recent combat encounter. So my first question would be, how much actual progress so players stand to lose by being loaded in at the last passage navigation? If it's a small amount I wouldn't bother.
If you think the amount of progress players would lose would be significant, I would ask how far along you are and if it's possible to change your game to feature more consistent passage navigations, as they are important to the engine.
If neither of those works, you can use a save event to manually update the variable store (or just the inventory) before saving, but I think this is worth avoiding if at all possible.
Is there a known issue with exporting and importing? On my twine game the inventory systems works fine, but inventory content is not saved on export. I verified this with a button:
<<button "Serialize Game" >> <>
Doing this will empty out my inventory. The output from the Save.serialize() is logged and shows there is nothing in the inventory array. perhaps a problem with marshalling?