So this is hopefully a really stupid and easy-to-answer question.
I am upgrading a twine game from 1.4 to 2 in Sugarcube.
Previously, I was able to use stuff like:
<<set $foo = 25 + Math.floor( $bar / 2 ) >>
But now I cannot put an expression like "$bar / 2" into a function call, apparently?
Can I surround the expression with some character or something that will allow it to be evaluated and then passed to the function?
Thanks much!
Comments
Are you sure it is not working because the following test worked for me in the 1.0.32, 1.0.34 and 2.3.1 versions of SugarCube
note: you can use parenthesis to control the order an expression gets evaluated in, the following forces the $bar / 2 to be evaluated before the 25 + Math.floor
I can't remember when/if SugarCube 1 changed so that an undefined variable is not equal to zero, but it has always been a good idea to assign a default value to your variables before the story starts.
You can do this in SugarCube by creating a special passage named StoryInit like so: