Howdy, Stranger!

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

Stats with Sugarcube.

edited July 2016 in Help! with 2.0
I've decided to undertake making a pseudo-sandbox RPG, so far I have been able to wrap my head around most of the coding I have attempted but I just can't get addition working for the stat system. Each time I test the stats rather than raising the amount, the number that is suppose to be added is placed at the end. EG. Jog makes stamina to 5025 rather than raising it to 75. The test code I am using is this;

<<set $Stam += 25>>

What I find especially frustrating is

<<set $Stam -= 25>>

does exactly what I want it to. Any help with how to properly get it adding properly is greatly appreciated.

Comments

  • try <<set $Stam to $Stam + 25>>
  • Still giving the same issue unfortunately.
  • edited July 2016
    Are you initialising your $Stam value to a string?

    Eg

    <<set $Stam to "0">>.

    That will cause the issue.

    That's the only thing I can think of, since I just posted working code from my own SugarCube game. It should work if you're initialising correctly.
  • edited July 2016
    As Claretta noted, you're setting $Stam to a string someplace. That's the only way that adding something like 25 to 50 will get you 5025, rather than 75. Check every instance where you assign to $Stam, the numbers within the expressions should not be quoted.
  • PERFECT! Thanks so much you two. Removing the quotation marks from each instance seems to have cleared up my issue fantastically.
Sign In or Register to comment.