Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Twine 1 Sugarcube 2.12 Disturbing warning message

::StoryInit
<<set a = "<<if $event1 eq 0>><<set $event1 to 1>><<endif>>">>

::SomePassage
<<print a>>
The code above is actually a small part of a lengthy 2-Dimension Array. It set $event1 to 1 in SomePassage inside a replace macro when a link is clicked. Getting the code outside the array would make life very difficult, as the array has billions (currently 4) entries each doing totally different thing.

I get a
You must use 'is' instead of '=' in <<if>> and <<else if>> tags. May I try to fix this for you?
friendly warning every time I close down my storyinit.

It is disturbing. What should I do?

Comments

  • Okay. Solved it myself on proof reading my own question.
    <<set a to "<<if $event1 eq 0>><<set $event1 to 1>><<endif>>">>
    

    That solved. I think this is some kind of bug as the syntax checker fail the checking. I leave it here for future reference.
  • The a variable in your example is missing the $ (dollar sign) or _ (underscore) required to indicate if it's a story variable or temporary variable.
  • doh. you are right. $a. thanks.
  • To be clear for anyone coming across this later, this is unrelated to SugarCube. The warning, and offer to "fix" the issue, comes from Twine 1.4 itself. Apparently the code that handles that check is broken enough to mistake the equal sign of the <<set>> as belonging to the <<if>>.

    Short of Twine 1.4 receiving an update, there's no way to fix the issue. As pingguo discovered, the simplest workaround is to switch from the JavaScript assignment operator (=) to the TwineScript assignment operator (to).
Sign In or Register to comment.