I'm guessing the answer is 'no,' but I figured I'd ask:
Is there an easy way to set a default value for a variable (like, say, the player's $name), such that wherever I "test play" from, it'll be initialized to that default -- but if it's set in the course of the game, it'll be overridden with the new value?
Comments
SugarCube also has the StoryInit special passage, which runs before Start and could contain initialization code like this. But I'm not sure whether that exists in the "vanilla" headers.
SugarCube's StoryInit special passage does work with Test Play From Here feature (and initialization is exactly what it's for), but it's a SugarCube specific special passage.
You could do somewhat clumsily it in the vanilla headers via the prerender task object. Something like this should work: That gets checked every time you render a passage though, hence the need for the conditional.
I think this would be a useful feature for all story formats. Would anyone object if I add it to engine.js?
Maybe I'll make "StorySetup" and "StoryInit" do the same thing.
(No I won't.)
(Maybe I won't.)
EDIT: I just realised that "StorySetup" has this delicious verbal commonality with the <<set>> macro, which is the macro that will be used most within it. Right, that's it, changing it now, English itself decrees it.