I’m a beginner and trying make a little game to have fun, and learn stuff (I like to start complex to learn more stuff faster)
I was trying store some questions for better player experience and avoid some stuff some people might dislike, but for some reason I’ve noticed that variables are not storing? Here’s the code
<div class="game-setup"><h1>Would you like to enable Incest?</h1>
<div class="questions">[[Yes->Watersports Question<<set $incest to true>>]]</div>
<div class="questions">[[No->Watersports Question<<set $incest to false>>]]</div>
</div>
The $incest is stored already by default as false in a different passage
LLMs that have (also?) been trained on programming languages like Python, HTML, CSS, and/or JavaScript will have issues generating valid code for the macro languages & run-time engines of any of the Twine Story Formats. Because there simply isn’t enough Twine related documentation & code examples available to train such an LLM, which is why those LLM’s hallucinate when making up code suggestions.
1: The syntax for the SugarCube variation of a Markup based Link that supports variable assignment upon selection can be found in the Link section of the Story Format’s documentation. Such a link is commonly known as a Link with Setter, or a Setter Link.
[[Link Label->Target Passage Name][$variableName to "value"]]
eg. to set a $lightLamp variable to Boolean true upon link selection…
[[Light the Lamp->Explore the Dark Cave][$lightLamp to true]]
Another way a Setter Link can be created is to combine a <<link> macro with a <<set>> like so…
<<link "Light the Lamp" "Explore the Dark Cave">>
<<set $lightLamp to true>>
<</link>>
2: SugarCube’s variable initialisation special Passage is named StoryInit, whose contents is process before the 1st Passage shown to the end-user.
Or if you prefer to use a Passage Tag to indicate which Passage(s) to process before the 1st Passage is shown to the end-user, then you can assign it/them the special init tag.
note: The startup Passage Tag has no special meaning in SugarCube. It is however used by the Harlowe Story Format to perform the same special action as SugarCube’s init special tag. If the startup tag’s usage was suggested by the LLM, then that is the type of hallucination I mentioned earlier.