Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

harlowe - keeping variables through savegames?

yo
so i've got a save/load game function in my game at the moment (works if you close the tab, lets you visit the main menu, etc)

(this is a footer on every page:)
[Save Game]<save| || [Load Saved Game]<restore|
(click: ?save)[*Saved!*(savegame: "A")] (click: ?restore)[*If you're seeing this, the game failed to load.*(loadgame: "A")]

but!
i also have some settings id like the players to be able to customise (e.g 'show lock-in options' shows the final chances to see options)
You (if: $showlockin is "yes")[have](else:)[do not have] lock-in options enabled.
[Show Lock-In Options]<showlockin|
(click: ?showlockin)[You will now see lock-in options with LO tags.
(set: $showlockin to "yes")][Hide Lock-In Options]<hidelockin|
(click: ?hidelockin)[You will no longer see lock-in options.
(set: $showlockin to "no")]

the only problem is...
if a player saves the game, then goes to the menu, and changes the options... restoring their save game will reset the options to whatever they were when the save was made. making a new save keeps the options, but stops them returning to their previous point (deleting the old save forever; they have to restart).
is there any way to make certain variables carry over between saves?

TL;DR can't keep flags through savegames, how fix

Comments

  • Yup. That's the problem.
  • bump, anyone found a solution to this?
  • bump, anyone found a solution to this?
    Yup. Code in Sugarcube.

  • FIF wrote: »
    Yup. Code in Sugarcube.

    +1
  • edited January 2017
    @FIF and @DairynGM
    It is not very helpful just telling someone to change to another Story Format if you also don't explain why or how doing so may help resolve their issue.

    @CrestOfFire
    By default most story formats generally only have two categories for values: Variable and Other, and by default the current values of all currently known Variables are stored within a Save while all Other values are not.

    SugarCube (depending on the exact series and version being used) has more categories for values: Variable, Temporary Variable, Settings, Setup, and Other.

    The Variable and Other categories basically behave the same as before (eg. the Variable values will be stored in a Save while the Other values will not), the Temporary Variable and Setup category values are also NOT stored within a Save.

    The Settings category is handled differently, it's values are stored between play-through but not within the Save system. This is why loading a Save does not effect the current value of a setting.

    Unfortunately Harlowe does not have a built-in equivalent of the Settings category.
  • There's also a fix using Java script to store and retrieve persistant values, but that won't work from Harlowe either...
  • Have you tried omitting those variables from your save function? I haven't tried that yet, but it's what comes to mind as a possibility.
  • greyelf wrote: »
    @FIF and @DairynGM
    It is not very helpful just telling someone to change to another Story Format if you also don't explain why or how doing so may help resolve their issue.

    @CrestOfFire
    By default most story formats generally only have two categories for values: Variable and Other, and by default the current values of all currently known Variables are stored within a Save while all Other values are not.

    SugarCube (depending on the exact series and version being used) has more categories for values: Variable, Temporary Variable, Settings, Setup, and Other.

    The Variable and Other categories basically behave the same as before (eg. the Variable values will be stored in a Save while the Other values will not), the Temporary Variable and Setup category values are also NOT stored within a Save.

    The Settings category is handled differently, it's values are stored between play-through but not within the Save system. This is why loading a Save does not effect the current value of a setting.

    Unfortunately Harlowe does not have a built-in equivalent of the Settings category.

    Apologies GreyElf. For all wondering, here's why you want to use Sugarcube. It truly is built for more advanced features than Harlowe. There are things in Sugarcube that can be done rather quickly that would take much more code to complete in Harlowe. Even getting the saves to persist seemed to be rather difficult. There's a definite learning curve and i'm still learning but I'd use sugarcube for large release type games. Harlowe for small web-based games.
Sign In or Register to comment.