Howdy, Stranger!

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

Save / Restore in Twine

Saving and Restoring Is Working in Harlowe!

I searched to see if there were any examples on this forum and didn't see any, so here are a couple for any who might be interested:
This is the start passage.
(live: 3s)[It is being saved(savegame: "A","Test Save")]
(live: 6s)[This is the next passage.]
(live: 9s)[This is a list of saves:(print: (savedgames:))]
(live: 12s)[Now I'm going to restore the saved game]
(live: 15s)[(loadgame: "A")]

And this works in a footer tag:
[Save]<save| | [Restore]<restore|
(click: ?save)[It is being saved(savegame: "A","Test Save")]
(click: ?restore)[It is being restored(loadgame: "A")]

Note: There is a bug I hope they resolve soon - "If, for instance, you put a changer command in a variable, like (set: $fancytext to (font:"Arnold Bocklin")), (savegame:) would no longer work." - [url="see https://bitbucket.org/_L_/harlowe"]see https://bitbucket.org/_L_/harlowe[/url]

Comments

  • I'd love to know how to use it in the sidebar.
  • edited August 2015
    nate wrote: »
    I'd love to know how to use it in the sidebar.
    The built-in sidebar is destroyed and recreated ever time the Reader moves from one passage to another, this means that anything you wish to display in the built-in sidebar needs to be re-added every time a passage is shown.

    You could try adding the content/links you want to be displayed in the sidebar to a header tagged passage and then either:

    a. Use CSS to position this content over the built-in sidebar, this would make it appear as if it is part of the sidebar.

    b. Use Javascript to actually move the generated HTML elements of the content to the sidebar.

    A more complex solution is to use Javascript to dynamically generate the content/links, this Javascript would need to be run each time a passage is shown which you could do using a header/footer tagged passage.
  • Using GreyElf's example elsewhere I now have Save & Restore in a sidebar -

    PassageName: Stats / Tag: Header
    <div id="stats">[Save]<save| | [Restore]<restore|
    (click: ?save)[It is being saved(savegame: "A","Test Save")]
    (click: ?restore)[It is being restored(loadgame: "A")]

    (if: $inv's length is 0)[You aren't carrying anything.]
    (else:)[You are carrying: $inv]

    </div>

    Edit Story StyleSheet
    #stats {
    float: left;
    padding-right: 1em;
    margin-right: 1em;
    border-right: 1px solid black;
    height: 100%;
    }
    The Inventory example comes from here.
Sign In or Register to comment.