Howdy, Stranger!

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

Changing Variables Incrementally?

edited June 2016 in Help! with 2.0
Hello! So you know, I am using Harlowe on Twine 2.0 My question is regarding Variables. My question is something like this:

If $variable equals 10 how do I subtract / add 1, without manually setting $variable to 11 or 9?

-Bumpkin
1806e6bff7047ece0d4f3e8418a7da5f.jpg

Comments

  • (set: $variable to $variable + 1)
  • There are a number of ways to do what you want, @stray showa one of them, and the following shows all the main ways to increment and decrement a variable.
    ''Incrementing''
    (set: $variable to $variable + 1)
    (set: $variable to it + 1)
    (set: $variable += 1)
    
    ''Decrementing''
    (set: $variable to $variable - 1)
    (set: $variable to it - 1)
    (set: $variable -= 1)
    
  • Ok thank you guys very much! I didn't expect to be answered so quickly. I tried what @stray had said, but it didn't work. I only realize now, I had misspelled a variable, and that was the reason it had not worked.

    Again thank you both very much.

    -Bumpkin
Sign In or Register to comment.