I'm editing my Squiffy project, and using 'build' to view the changes. Then closing the window, making more changes, and building the thing again.
But every time I have to click the Restart button, and it's annoying. Is there a way to force restart on every build? Or Force restart somewhere in the beginning of the Squiffy file?
Off the top of my head, I think that something like this in your first section will force the game to restart instead of resuming each time you open it:
squiffy.story.save = function () { squiffy.set('_output', squiffy.ui.output.html()); squiffy.set('_transition', 'squiffy.story.restart') };
Does that do what you need?
No the function doesn't seem to do anything at all for me.
If I manually hit 'restart' after adding the function, the entire screen turns white.
I'll have to take a look at the code, see where the mistake is. I was half asleep when I wrote that, so it's probably something silly.
OK, I've tried it and I'm confused. For me, it works exactly as intended. Can anyone with more experience maybe pin down the difference? It shouldn't depend on OS, because it's all javascript. (in case it does, I'm on Fedora)
I replaced the squiffy.story.save function in the 'story.js' file, however it is overridden every time i use the 'build' in the editor. I then tried to create a 'story.template.js' file and overwrite the function in there however it didn't work/ unlike style.template.css Squiffy doesn't seem to pull from the js template.
I also tried placing the Javascript function directly into my .sq file, at the beginning just to see if maybe that's how it would overwrite the function. But it didn't work there, which I figured it wouldn't.
Building the Squiffy file, then editing the story.js file to include the changed function before running the file from the .html also did not work.
EDIT: I also tried adding it at the very first (starting) passage surrounded with < script > and < /script > but that didn't work. All searches I do for script send me to Quest forum threads. Changing story.js to read only to preserve the changes only prevents the application from be able to 'build' my story.
Wow, that's a lot of complexity.
I just added the script at the start of the first section.
I also tried placing the Javascript function directly into my .sq file, at the beginning just to see if maybe that's how it would overwrite the function. But it didn't work there, which I figured it wouldn't.
Should work.
If your first section has a name, then putting the script before it would create a new, unnamed section which the player can't get out of. This was my best guess for the white screen you described.
The script needs to go in the javascript portion of the first section. So before any text or squiffy functions, but after the game title, global settings, and section name.
Don't forget the four spaces at the start of the line.