Howdy, Stranger!

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

Can I link two stories? (Harlowe)

I'm very new to Twinery (2.0) so this might be a stupid question...

Is it possible to link two stories together, kind of like Story 1 being a chapter and Story 2 being the second chapter, etc.? By that, I mean can I use the same variable inputs from the first Story and then use them in the second?


Let me explain if I need to:
In my first "Story," I have it possible for the user to choose what they'd like their character to look like.
They can choose, lets say for their eye color, "Green," "Blue," "Brown," and some others.
I have this saved under "$eyecolor," which I use frequently throughout "Story 1."
In "Story 1" the user plays all throughout one area where they need to survive and figure out how to escape the area alive.
Now, let's say that the user finishes the adventure in this area, which was an opening area to set up the main story.
By the end of this one huge adventure, the user has already set up about 20 variables from deciding their name to their skin color, hair color, to their background.
That's a lot of variables in my opinion.
I have this huge opening adventure saved as "Story 1."
Now, I'd like to consider "Story 1" a chapter.
But, I'd like to have "Story 1," the opening aka chapter 1, lead on to another Story and be chapter 2.
WITHOUT having to ask the user for every single detail over again for the variables.
Of course, I'd like it to continue on and on with all the Stories becoming more chapters, like a book.
I'd like the chapters to flow fluently into one another and have the variables still intact from the last chapters.
I want to do this for organization purposes and for the sake of having a more "Congrats, you did't die!" vibe to it.


So if there is no possible way to link two or more stories together (while keeping the same variables), I'm okay with that. I can simply have it in one heap in "Story 1" and I'll be happy. I can't think of any way that linking Stories is possible, other than starting over with the variables, but it doesn't hurt to ask. I'd be more than glad to hear that this is feasible. :)

Thank you!

Comments

  • am also waiting for the answer to this
  • There are a number of ways this can be implemented using Harlowe, the following is one of the simpler.

    warning: The below works because Harlowe currently does not correctly protect each story's saved game data, this allows one story to overwrite the saved games of another. If this effect is fixed then the below solution will no longer work.

    Currently it is possible for one Harlowe based story to load the saved games data of a different Harlowe based story as long as:

    a. Both stories are accessed from the same location (local hard-drive, website, etc..)
    b. Both stories were/are viewed in the same web-browser on the same machine.
    c. A Passage with the same name exists within both stories.

    You can test this yourself by doing the following:

    1. Create a new Story, it's name is not important but I named it Story1

    2. Place the following in the main passage.
    Story 1
    
    (set: $gold to 100)
    gold: $gold
    
    [[Go to save game page->End of Story 1]]
    
    note: the name of the End of Story 1 passage can be anything you like as long as that passage exists in both stories.

    3. Place the following in the End of Story 1 passage.
    Click on the ''Save Game'' link to save the final state of all the variables.
    
    (link: "Save Game")[
    	(save-game: "Story 1 Data")
    	State Saved!
    ]
    
    note: you can name the saved game anything you like, as long as you use that same name when you load Story1's data in Story2.

    4. Use the Publish to File option to create the Story1.html file.

    5. Create a new Story, it's name is not important but I named it Story2

    6. Place the following in the main passage.
    Story 2
    
    (set: $gold to 0)
    gold: $gold
    
    (link: "Restore Story 1 State")[
    	(if: (saved-games:) contains "Story 1 Data")[
    		(load-game: "Story 1 Data")
    	] (else:)[Story 1 Data not found]
    ]
    

    7. Create a new passage with the same name as the Target Passage of point 2's markup link, mine was named End of Story 1. The contents of this new passage is not important but I placed the following in mine for testing purposes.
    gold: $gold
    

    8. Use the Publish to File option to create the Story2.html file.

    9. Open the Story1.html file in your web-browser, click on the link to view the End of Story 1 and then click on the Save Game link. You have now stored the state of all the variables within your web-browser's localStorage.
    Now Open the Story2.html file in your web-browser and click on the Restore Story 1 State link, you should now see Story2's version of the End of Story 1 passage with the value of $gold updated.
  • Thanks greyelf, you saved my ass ^^
Sign In or Register to comment.