Problem with elseif in Script at the bottom of a Passage

:SugarCube: SugarCube 2

I'm trying to use the <<script TwineScript>> at the bottom of a passage for an elseif statement, but every time I test the story I get the Error: " <<script>>: bad evaluation: Unexpected token '{'"

Here is everything I have on the passage:

<<if not hasVisited("There")>><<set $items = null>><</if>>

<<link "More!">><<set $items += 1>><</link>>

<<script TwineScript>>

if ($items==1) {console.log("One")}

elseif ($items==2){console.log("Two")}

else {console.log("Nope")}

<</script>>

[[There]]

The passage 'There' contains only a link to send you back to the first passage.

Is this a normal problem? Is there a solution? This is a test I used to narrow down my problem, my actual project involves a slider and altering text when the slider receives input.

Posted Jun 15, 2025, 2:57 AM UTC

26
Loading comments…