Hi,
I'm very new to Twine and have started creating a project using the Web-version of Twine. I'm comfortable with the use and function of variables and use them quite extensively, but I'm running into issues and inconsistencies in my game and want to try and get it sorted out once and for all.
I've done a lot of searching through the web and looked at multiple resources on how to properly format my coding so it works the right way with my configuration, but I'm still not comfortable with the results. My question is, with my version of Twine and story format, what is the correct way/syntax to set and check a variable? I think I may have it incorrect, because there are so many ways listed depending on which version of Twine is used and which format you are using, and they seem to vary slightly between them.
I've been setting my variable using this syntax:
And checking it using this syntax:
Which works 90% of the time just fine, but there are some instances where using this same syntax with another variable throws out errors of not being able to set the variable, or bad <<if>> statement.
In those cases, if I change it to:
And checking it using this syntax:
Then it works....however, there are at least three-dozen other variables using the other syntax that work with no issues...and don't get me started on the use of 'eq'.
What syntax should I use in this configuration that is the 'correct' way based on the game engine and story format? Is there a time/place that the ""s are used and some where they shouldn't be? I've tried searching to get the answer, but always seem to find only a partial answer (example given for Twine 2, but Harlow format, or Sugarcube format, and Twine 1).
Thanks in advance!!
I'm very new to Twine and have started creating a project using the Web-version of Twine. I'm comfortable with the use and function of variables and use them quite extensively, but I'm running into issues and inconsistencies in my game and want to try and get it sorted out once and for all.
I've done a lot of searching through the web and looked at multiple resources on how to properly format my coding so it works the right way with my configuration, but I'm still not comfortable with the results. My question is, with my version of Twine and story format, what is the correct way/syntax to set and check a variable? I think I may have it incorrect, because there are so many ways listed depending on which version of Twine is used and which format you are using, and they seem to vary slightly between them.
I've been setting my variable using this syntax:
<<set $sky_color to "blue">>
And checking it using this syntax:
<<if $sky_color is "blue">>"Oh look, the sky is blue today."<<endif>>
Which works 90% of the time just fine, but there are some instances where using this same syntax with another variable throws out errors of not being able to set the variable, or bad <<if>> statement.
In those cases, if I change it to:
<<set $sky_color to blue>>
And checking it using this syntax:
<<if $sky_color is blue>>"Oh look, the sky is blue today."<<endif>>
Then it works....however, there are at least three-dozen other variables using the other syntax that work with no issues...and don't get me started on the use of 'eq'.
What syntax should I use in this configuration that is the 'correct' way based on the game engine and story format? Is there a time/place that the ""s are used and some where they shouldn't be? I've tried searching to get the answer, but always seem to find only a partial answer (example given for Twine 2, but Harlow format, or Sugarcube format, and Twine 1).
Thanks in advance!!