Editing in HTML ruined save feature. Help!

I started making this game with squiffy, but I deleted a crap ton of progress after a terrible autosave accident. Luckily, I was able to salvage the html/css/js code from the previews of the game in my browser history.

Anywho, the game is published. It's lovely. But I still don't understand what exactly happened to saving on your local storage (is that the thing that affects autosave?) because players can't restore progress in the game after they've exited out of it.

Can someone help me out with this funk? Something in the metadata or js that I can implement or check for to get my autosave feature back? Thanks.

Diego


Do you mean that you've published the game from the preview?
I'm not sure, but I think that uses a cut down version of the engine without the save feature. This sounds more like an issue in the common parts of the game code, rather than your source.

There's a recent topic where I linked to a utility that transforms a story.js file back into Squiffy source. Not sure if it would work in this case, but going back to Squiffy and recompiling the game might help.

If not, it might be worth letting someone familiar with the engine take a look at it. Can you give a link to the game in question?


https://textadventures.co.uk/games/view/pnmno4m7guu6zyjropbleg/the-world-ends-today-i-think


OK… it looks like your file is missing a game ID, and has persist set to false.

It might help to find this part which disables saving in preview mode:

$('#squiffy').squiffy({

persist: false

});

I'm not sure if you need to change it to true, omit that line, or omit the whole section. I'm not too familiar with the code flow outside of story.js.
This might still break because of the lack of a story ID (resetting in this case could possibly corrupt a player's saves for other Squiffy and Quest6 games)

If that doesn't work, I've got a decompiler, but it's designed to take the story.js of a published game as its input, and this preview HTML is just different enough that it can't find the right parts.
Then you'll have the Squiffy source you can paste back into the editor, so that you can compile/publish normally.

Edit: I got it kind of working.
In your HTML file, look for the big script section, between <script> and </script> tags. There are several, but the one you want takes up 95% of the document and starts with // Created with Squiffy 5.1.3.

This is the part that would normally be in the file story.js for a published game.
Copy this part of the file.
Within it, you will find the line:

var squiffy = {};

Remove that line.

Take the resulting file, and paste it into the left box on https://angelverse.mrangel.info/desquiff_noparse.html - Press go, and your Squiffy source should appear on the right. Sections might not be in a sensible order, but I think it should work. It does its best to turn the HTML from the final game's text parts back into the Squiffy code that would have generated it (such as removing automatically-inserted <p> and turning <a data-section="whatever">Some text</a> back into [[Some text]](whatever). But there might be some HTML left that's not tidied up.

If anything doesn't convert properly, please let me know. I'm interested in improving this system.

But in any case, once you have the Squiffy source back you can paste it into Squiffy and compile to get HTML/JS files which should have a game ID and save properly.

(If anyone finds this post in future who has similar issues, if you have a story.js file you can just use https://angelverse.mrangel.info/desquiff.html and paste in the whole file rather than having to manually find bits first)


Very nice! The only thing that I saw was that sections don't collapse properly and

is still on it. Other than that, the transfer was nice and smooth. Working on it right now!


Haha! It works! I can save again! Thank you!


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums