<span id="scene1">//scene as yet unlocked//</span>
<<if $unlockedScenes.includes("scene1")>><<replace "#scene1">>[[Scene 1|Scene1]]<</replace>><</if>>\
So, the idea behind this one is to present the user with a fully locked listing at the start, but to unlock scenes one by one as they get to them. It's a scene recall mechanism. But it's not working. And I don't know why.
If I replace the if statement with a button, using the exact same constructs, it works. Like this:
<<button "show">><<replace "#scene1">>[[Scene 1|Scene1]]<</replace>><</button>>
That works no worries. But, I've looked at some code from the sugarcube docs, and it seems to show that I can use <<replace>> with if statements, as seen with the example under <<silently>>. So, what gives? Am I using this wrongly somehow?
I need to get this sorted out, before I write too many more scenes, because I think I need to design them with this recall feature in mind. I'd like to capture variables at the time, so that the recollections use those, instead of the current ones. The user could conceivable look at the scene near the end of the story, and I'd like them to see the scene as they played throught it, not with the stats they have currently. So, I record them somehow. I preserve them. But, I think I need to sort out what things I need to preserve, and get this functional so I can play with it. Do the first one, and the others will follow from that.
So... what think? The error I get is this: "Error: <<replace>>: no elements matched the selector "#scene1"" I get no such error when I use that stupid button thing.