This page will show you some ways you can use variables to change the way that links to other passages show up (or don't show up) on a page AND also how you can have a link that will take you to more than one page depending on a variable. Yes, I know this is a confusing intro to the topic, so look at the examples below for more clarity (I hope!).
In the example below, the variable $orb will determine which link you see on a page. In other words, if you go to the page titled 'The Chasm' you will see either a link called 'Try the orb' (if you got the orb in The Treasury) or one titled 'Try to jump across' if you don't yet have the orb. Let's just say that the two end up in VERY different results. The important coding to do this is below the image.
Here is the important coding:
In the beginning passage (titled 'The Orb Quest) the variable must be set to false:
(set: $orb to false)
In this example, you need to find an orb in order to continue through one branch of the story. Go to the room titled 'the chasm' first and see what links appear. Next, go back to the start and go to 'the treasury' room instead.
Now go back to 'the chasm' and see what happens.
[[The Entry Hall]]
In the room where you want to get The Orb, in the case The Treasury, you now just set The Orb variable to true:
(set: $orb to true)
As you enter the treasury, you see a gleaming orb suspended above an altar. You approach it and quickly grab it. Come on, it is a gleaming orb--must be good for something!!!
[[The Entry Hall]]
Now, the critical final bit! In the passaged titled The Chasm, we tell the story link to show IF you have the orb and what other link to show if you DO NOT. There is also a link back to The Entry Hall that shows up no matter what (which is why it is put in separately from any of the IF statements.
As you approach the chasm, the lights fade and you know there is a deep, deep, REALLY deep rift in the ground before you. The big question is how far across it is. You got a quick look before the lights faded...
(if: $orb is true)[
[[Try the orb->Floating Across]]
]
(else-if: $orb is false)[
[[Try to jump across->Death becomes you.]]
]
[[The Entry Hall]]
Pretty easy, right??