Howdy, Stranger!

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

Extremely new; trouble with setter links and variables

Hi! I've been trying to get help from wikis and forum posts on how to make setter links (that's what these are, right? links that not only send you to a new page, but also change variables?), but to no avail. I actually want two links to go to the same page, but give one variable a different value through each link. But this example sample page in Harlowe doesn't cut it, and neither will any rearrangements of brackets that I can think of:
(set: $store to 0)

[[Go to store|Store(set: $store to 1)]]
[[Don't go to store|Store(set: $store to 0)]]

How would I edit this?

Thank you in advance~

Comments

  • Harlowe does not support the Markup Link based Setter Links, that is a feature of SugarCube and the story formats that come with Twine 1.

    You will need to use a (link:) / (set:) / (goto:) macro combo like the following:
    (link: "Go to store")[(set: $store to 1)(goto: "Store")]
    (link: "Don't go to store")[(set: $store to 0)(goto: "Store")]
    

    note: If the $store variable is being used to represent a yes/no then it is better to make it a Boolean rather than a Number:
    (link: "Go to store")[(set: $store to true)(goto: "Store")]
    (link: "Don't go to store")[(set: $store to false)(goto: "Store")]
    
    ... and then in your Store passage you can check like so:
    Testing for true:
    (if: $store)[You selected the "Go to store" option]
    (else:)[You selected the "Don't go to store" option]
    
    or testing for false:
    (if: not $store)[You selected the "Don't go to store" option]
    (else:)[You selected the "Go to store" option]
    
Sign In or Register to comment.