0 votes
by (2.5k points)
Here's a simple one. I'm making a huge project. It's so big that I've estamated that I'll run out of space by the time I finish it. (I'm on chromebook so I can't use the app version.) To combat this, I've separated the project into parts. There will be 3 or 4 (Each route is going to be separated). One of the ending can only be played if you beat the main ending. This means once that ending is beaten a variable will change letting the game know that it had been beaten. Then the game save and load a identical version of the main menu. And here is what I'm trying to do.

In the real main menu, when the player first opens the game, I want to make it so that the game automaticly loads the save moving the player to the identical main menu with the variable for the ending being beat set to true. But if the player hasn't beaten that route, the save won't exist. How do I make it so that if the save doesn't exist, it doesn't give a warning saying it doesn't exist.

1 Answer

+1 vote
by (159k points)
selected by
Best answer

Please use the Question Tags to state the name and full version number of the Story Format you are using, as answers can vary based on this information. I will assume that you are using Harlowe v2.1.0

Each story project you create is assigned a unique identifier (known as a IFID), this identifier is embedded within each Harlowe 2.x based story HTML file you create, and it is used by the (save-game:) macro when it persists a copy of the game's current History in the web-browser's Local Storage area.

This is why the (load-game:) macro won't load the saves created in a different story, and why multiple story HTML files can use the same Slot Name when saving.

You can use JavaScript to access & persist data stored within a web-browser's Local Storage area, if that area exist within the web-browser being used by the end-user, and the following two questions contain answers showing two different ways to do that:
Making achievements in Harlowe
Global Stats - How do you create global stats that are shared between games?

However Harlowe (both 1.x & 2.x) has been deliberately designed to restrict what access an Author has to the story format's JavaScript based engine, and there is no documented API for using JavaScript to interact with the story variables stored within the engine's History system.

There are a number of ways you can get around this limitation, two of them being:
1. using JavaScript to hack Harlowe's engine.
2. using TwineScript to assign the value returned from a JavaScript expression to a story variable.

The following example shows how to do the second method with the Global Stats related solution.

(set: _totalKills to GlobalStats.totalKills)

DEBUG: totalKills: _totalKills


by (2.5k points)
Thanks I'll look into this. I thought I had figured out a loop hole around this, but upon reconsideration, I've realized it wouldn't be possible because there's no way for the original project to know if the other project was finished. Using your suggestions I'm going to try to fix this.