way to restore later versions or code from published game?

ive been working on a game and published an unlisted version for friends to test, but then accidentally deleted all of the code. it was saved to the website. the published game still functions. is there a way to restore a previous version of the game, or extract the code from the published version? thanks.


I lost hundreds of lines in one of my short games this way. I had been working on it on my office desktop, classroom desktop, and personal laptop without saving anywhere but textadventures.co.uk. Then I published, immediately found several bugs and tried to go back in. There's no way I was able to discover to get my Squiffy code back. Now I save all my changes in a Google Drive doc.


If you have a link to the published game, go there. Play the game.

Once the game is loaded, your URL should be something like this:

https://media.textadventures.co.uk/games/d-TTazJ0f0a-TjcA5RUZjQ/index.html

Click up there and change "index.html" to "story.js". Like so:

https://media.textadventures.co.uk/games/d-TTazJ0f0a-TjcA5RUZjQ/story.js


The beginning of the file is just the JS Squiffy functions, but, after scrolling down (way down), you'll find your Squiffy code in JS format. It ain't Squiffy format, but it might be better than nothing?

SCREENSHOT


Would you be interested in a program that could extract the original code from the compiled version?
I thought about creating one that could do the job for you.
But I didn't know how it would be received by other authors if their source code could be extracted and looked at.
But then again... no one would be loosing money or bragging rights to a bit of code.


Would you be interested in a program that could extract the original code from the compiled version?

Yes, please!

I mean... Email it to me if no one else wants it. (I'm more interested in seeing how it works than anything else.)


Creation starts now, But, it will an EXE, not Quest.
I know Basic MUCH better than Quest.
But I can show you the basic code, with explanations of what's happening.


Awesome!!!


Ver 0.01 "works"...
At least it reads the compiled Game.aslx, (currently the default file and will save the new file as the game name.aslx)
Now, I just need to "teach" it what code blocks to cut out.
This may be the hard part.


At least it reads the compiled Game.aslx, (currently the default file and will save the new file as the game name.aslx)

Are you doing this for Quest, or Squiffy games?

I already built one for Quest; but it's a rather flaky command line tool that requires a little manual correction.

This is the Squiffy forum, and in Squiffy the compiled code is stored in story.js. It should be fairly easy to work backwards I think, which can probably be mostly done with regular expressions.


Now I got myself trying to do this. It's getting there :)

But I don't know all the features of squiffy, so there's bound to be a whole load of things it's missing.


OK… after a little under 3 hours (including meal break mandated by family) I have a very ugly first draft.

http://angelverse.mrangel.info/desquiff.html

Paste your story.js file into the box, and hit the 'Go!' button at the bottom. It should give you something that looks like Squiffy code.

If it finds anything it doesn't recognise inside a section, it'll include an error message starting with ***. It may mangle complex HTML, because it's using a bunch of regular expressions to turn the body of each section from HTML back into text; if you can give me an example of an original Squiffy source, the code that it turns into in story.js, and what my script outputs, I can try to fix that for you.


I know Quest, but, I may be able to get it to extract Squiffy as well.


I know Quest, but, I may be able to get it to extract Squiffy as well.

I assume you'd be starting over to do Squiffy, as there's nothing in common between the files. (Quest is XML; Squiffy is JSON Javascript… I almost got that wrong there. It's not JSON if it contains lambda functions).

I'm curious how you handled the editor modules for Quest. My approach was … (click to expand)

I'm curious how you handled the editor modules for Quest. My approach was to scan for functions and objects that are identical in one of the libraries, add an include line for each library that is used, and then include GamebookCoreEditor.aslx if it includes any functions that are in GamebookCore.aslx and nowhere else; or CoreEditor.aslx if it includes functions from the other libraries apart from CoreFunctions.aslx and CoreOutput.aslx than it does from gamebook (because a lot of people import functions from those two into gamebook). And similarly from language libraries, import the one that has the most matching templates in it, and import the corresponding editor language if it exists (or EditorEnglish otherwise).

Making it handle third party libraries correctly would be a challenge, but I think it should be doable.


I guess we need to continue this in the Quest section.
I think, if I followed your idea, that was what I thought about first.
But right now, I'm trying to identify what Quest adds when it publishes the user script and copy the rest into a new file.
Single lines are easy, multiple lines is frustrating.
It's frustrating that quest will add some code at the start, some in the middle , and more at the end.
It would be better if Quest just added it's code at the end, or the beginning, just as long as it was all in one place.


Slightly updated. Now you can paste a game URL. But it has to be the address of the game, not the listing (because for some reason I can't get the actual game URL… looks like there's some security restriction)


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

Support

Forums