Hi,
I'm trying to create a simple stat system tracking things like gold etc.
The command I'm using is very simple, however somehow it's not working correctly for me.
<<set $gold to $gold + 200>>
<<set $tiredness to $tiredness + 25>>
As you can most likely deduct, I want to increase the $gold and $tiredness. However instead of going from 0 to 200, and from 200 to 400 I get a result which is
0200 and 0200200.
I have no clue what may be causing this though.
Thanks a lot in advance
Comments
SugarCube does give an un-initialised variable a default value because it can't know what data type you want that variable to be. (Boolean, String, Number, Array, Date, etc...)
I had another look at my init (where I set the stats to 0 initially).
The problem was caused because of the command
<<set $gold to "0">>
Once I removed the quotation marks it started working.