Hmm, I think it did as it's vanished. Mth (I think) had posted some helpful examples about how to code up a 'fake choice' that didn't generate a new node using <if> and variables. Any chance of getting it back, or did it get swept away with all of the crazy spam? :-[
Edit: I updated the title of the post so it could be helpful in future as the original post was accidentally deleted. Basically I am just looking on guidance on how to write passages which might have 'fake choices', a bit similar to the concept used in
choicescript.
Comments
Fortunately I still had the code in a file, since I tested it before posting. Here it is again:
We're working on things like spam mods and Anti-Spam Verification Questions right now so we don't have this problem again.
Again, sorry.
Mth, you mentioned using <<replace>> or using a <<div>> to achieve the same as above but without a transition...is it possible you could give me an example? No worries if not, as the first example was helpful anyway, I think it was just for curiosity's sake.
Thanks
This is the basic version: I tested it with SugarCube; I don't know if Leon's <<replace>> macro works exactly the same and whether his macros include <<click>> as well.
In any case, the essential part is that <<replace>> takes a jQuery selector as its argument so it knows what HTML tag (more accurately, DOM node) to replace. The simplest form of selector is the ID, which looks as "#foo" in the selector and <span id="foo"> in the HTML.
Since I don't like duplicated code, I put the click-and-replace mechanism in a widget: This certainly requires SugarCube.
Anyway, thanks for the help with this, it's really appreciated!
For implementing this, only a custom macro in JavaScript would do it, I think. Widgets cannot have any contents, so they would not be an option, even if you were using SugarCube.
Edit: Getting a bit further with trial and error.
It would be possible to take a different approach and instead of manipulating CSS do replacement of actual DOM nodes. That might be better if you'd want to use <<set>> macros inside replacement texts, since you could then evaluate only the chosen option, while with CSS you evaluate everything but hide the irrelevant parts from view.
Also, thanks for looking at it and giving me at least an idea of where to go.
Made some more changes thanks to some helpful people at Stackoverflow: codepen
Do you think this is something that would be workable?
I guess it'd end up being something like:
<<choiceblock>><<choice "1">><<choice "2">><choice "3">><<endchoiceblock>>
<<answer "1">>You picked 1<</answer><<answer "2">>You picked 2<</answer>><<answer "3">>You picked 3<</answer>>
Not quite as neat as what you originally proposed, but I couldn't quite figure out how to replace the choices with the right answer.
Codepen: here
Hopefully the code will also play nicely with other Twine macros (I'm hoping that I can still set variables within the various options), although that's probably too much to hope, but that will require further testing. For getting this to work in Twine, see this post here.
Edit: A more Twine friendly method on how to achieve choices without multiple passages can be found here.