Kajot-dev / Twine-Harlowe-Save-To_File

Harlowe utility for saving and loading game progress to encrypted file
MIT License
3 stars 0 forks source link

Causes issues with (saved-games:) macro? #9

Open bandcandyliz opened 4 months ago

bandcandyliz commented 4 months ago

First off, thank you for working on this! My game became quite hefty and this could be a lifesaver for me.

The macros appear to work for me, however, there seems to be some sort of conflict with the (saved-games:) macro?

I was planning on using a Quicksave option as the only save slot that goes into DOM storage, then another 5 save slots that would save to disk instead. If I save to one save slot and then load it, it appears to work correctly, but the following code throws out errors ONLY after loading a game through your save-to-file macros:

(set: _existing to (saved-games:))

Which throws out the error: Internal error occurred while trying to run (set: _existing to (saved-games:))

EDIT: Clearing the DOM storage appears to temporarily fix the error until another save-to-disk is made.

Unless I'm missing something, it appears the only solution would be to change my code to rely solely on the save-to-disk option, that way I won't need to mess with the (saved-games:) macro at all?

Kajot-dev commented 3 months ago

What version of Harlowe are you using? From time to time, it breaks compatibility and I need to modify it to make it work again.

Breaking (saved-games:) macro is definitely not intended. Please provide exact version of Harlowe so I can reproduce and fix this

bandcandyliz commented 3 months ago

What version of Harlowe are you using? From time to time, it breaks compatibility and I need to modify it to make it work again.

Breaking (saved-games:) macro is definitely not intended. Please provide exact version of Harlowe so I can reproduce and fix this

I was using 3.3.8 at the time, but I'm making the switch to 3.3.9 and have yet to test it with this version.

Kajot-dev commented 3 months ago

Ok, will try to make it compatible with 3.3.9

Kajot-dev commented 3 months ago

@bandcandyliz I just tested this with 3.3.9 and cannot reproduce the bug.

I'm testing with something like this:

(link-repeat: "Show saved games")[(replace: ?s)[(set: _existing to (saved-games:))(if: (dm-names: _existing)'s length is 0)[There are no saved games.](else:)[(verbatim-print: (joined: ", ", ...(dm-names: _existing)))]]] []<s|

And for me it works every time (even after reading a save from file)

Here is an updated demo, try to import it and test with 3.3.9: https://raw.githubusercontent.com/Kajot-dev/Twine-Harlowe-Save-To_File/master/SaveToFileDemo.html

Can you send me your exported story with step-by-step explanation how to trigger the bug?