Howdy, Stranger!

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

Links not Working withing If functions in Harlowe

I am pretty new to Twine, but i have looked in lots of tutorials and it never comes up or is mentioned as a Problem:

I want to have a Stituation, where the Player can make a decision early in the Game to pick up an item or leave it.
Later on in the Story it will effect his decisions, by making different options aviable. I just dont want to copy the paths and make two out of them, just for that little change. is there a way to solve that problem?

here is what my code looks like:

Would you dare to steal it?
next room stole or [[no|next room left]

Then in the two next room versions a variable ($stole) will be changed, and the paths will lead together again.

Later it will ask for it like that:

(if: $stole = 1)[ You were not Loyal! You need to go to Prison now!]
(if: $stole = 0)Market on!]

Sadly the options dont show up and just give out an Error. any Ideas what could be wrong?

Comments

  • edited March 2016
    You're using one of the assignment operators (=) when you should be using one of the equality operators (is, ==, ===). For example:
    (if: $stole is 1)[ You were not Loyal! You need to go to [[Prison]] now!]
    (else-if: $stole is 0)[ [[Carry|Market]] on!]
    

    Though, honestly, if $stole is meant to be boolean (i.e. only two states, either the player stole something or they did not), then you'd be better off using actual booleans. For example:
    → Setting $stole to true, when you've stolen something.
    (set: $stole to true)
    
    → The conditional check.
    (if: $stole)[ You were not Loyal! You need to go to [[Prison]] now!]
    (else:)[ [[Carry|Market]] on!]
    
  • Thanks!!! i didn't catch that mistakte :D
Sign In or Register to comment.