I got this:
<center>(if: $wayone = 0)[(link: "Minus")[(goto:"subtraktion")] |](if: $waytwo = 0)[(link: "Addition")[(goto:"addition")] |]</center>
[(if: $waytwo = 1) "hello"]
$waytwo
In the passage before I set $waytwo = 0.
First time I enter this passage $waytwo is 0, great!
But Hello is visible. Not good.
If I click addition and go back, I get $waytwo set to 1.
Then Hello should be visible and menu addition should not be shown.
What am I doing wrong here?
Comments
In programming "=" on its own is always used to set a variable and "==" is used to test the value of a variable - otherwise, how is the computer to know the difference?
Twine 2 does not recognise "==" as a method for testing the value of a variable.
To avoid this problem altogether use to and is.
The second passage with the chest also has:
(if: $key is 1)[[open]]
Same issue as above, even if the key is generated to 0, the link still displays. I tried to do it with letters just to get the same effect. Another version I tried to do was with (if: (history:) contains "key")[[open]] in the "chest" passage. Sad to say that nothing changed - the link is still there, taunting me.
One thing that might have happened was that the (if:) statements are taking in the account the set variables from the entire file, rather than that specific passage, but then again why is (history:) not working either? Strange. I've done this trick with generated variables before, and it worked as intended. However, I've accidentally deleted that file, so I can't be certain that what I've done matches what I'm doing right now.
You've misunderstood the difference between a hook and a link. This is a hook: This is a link: If you want to use a link inside a hook you must use both.
That also took me three days of crying over what's wrong with my strings when all it was was just formatting. Thanks again