klembot / chapbook

A simple, readable story format for Twine 2.
https://klembot.github.io/chapbook
MIT License
80 stars 25 forks source link

Equivalent of SugarCube's StoryInit passage #62

Open jonagill opened 4 years ago

jonagill commented 4 years ago

Right now there doesn't seem to be any place to assign global default variables that get set every time you load the game. This means you have to assign these variables in the starting passage, which in turn makes it hard to use the "Test story starting here" feature to begin the game at a particular passage, since any variables are likely to be undefined.

SugarCube gets around this by having a special StoryInit passage that always gets interpreted however you start the story. This could be very useful in Chapbook as well.

klembot commented 4 years ago

A workaround for now is using state snapshots.

My initial reaction is, I don't love the complexity of having two separate passages or having to know a magic name for a passage. There's also a internationalization issue (which Chapbook hasn't embraced yet, but I want it to). I understand that lots of people want to be able to use 'test from here,' so I'll think about other ways we could tackle it.

ChapelR commented 4 years ago

Story JS may be a good option here, if you want to maybe just document that its a good place to initialize variables.

HenryLoenwind commented 4 years ago

Even without the "test from here" there's the issue of those boolean "done that" variables. You have to set them to false first somewhere if you want to use them without trickery...

dethe commented 3 years ago

Maybe related: If I add a variable to my story, with a passage that tests for it, players loading the new version who have saved state get an exception because the new variable hasn't been initialized. I've worked around this with the rather brute force story JavaScript:

window.onerror=function(){localStorage.clear;location.reload()}

But I'd love to have a better way to handle this, which I'm thinking something like the StoryInit passage would solve.

klembot commented 3 years ago

I've run into this kind of issue myself, agree that we should have a more graceful way of handling it. (But likely that would have to be something abrupt like forcing the player to restart--I don't see a better way offhand.)

dethe commented 3 years ago

Forcing a restart is preferable to a broken game with no way to fix it (assuming they don't know how to use developer tools).