In Twine (at least in Sugarcane), when a set incrementor macro is called like <<set $testVar += 1>> when the variable $testVar has not been previous set, that variable is automatically initialized with the value of 0 and is then incremented.
Currently in Cradle, this generates the line Vars.testVar += 1; which, if testVar hasn't been initialized yet, generates an error: VarTypeException: Cannot combine null with Int32 using Add.
I'm going to look into how this can be achieved, but wondering if you might have any insight into where you think would be a good place to start, @daterre?
Hi, I'll look into a codebase fix, but in the meantime you can workaround this by initializing your variable in a startup passage (named StoryInit in Sugarcube).
In Twine (at least in Sugarcane), when a
set
incrementor macro is called like<<set $testVar += 1>>
when the variable$testVar
has not been previous set, that variable is automatically initialized with the value of0
and is then incremented.Currently in Cradle, this generates the line
Vars.testVar += 1;
which, iftestVar
hasn't been initialized yet, generates an error: VarTypeException: Cannot combine null with Int32 using Add.I'm going to look into how this can be achieved, but wondering if you might have any insight into where you think would be a good place to start, @daterre?