Howdy, Stranger!

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

Twine 2 Harlowe 2.0.1 Validating Links

Hi everyone,
I am somewhat new to Twine, so I am looking for help on validating links.
The main problem I am having is I can't figure out how to to make a link that only works if a certain condition is met.
For example, if the player does not have enough money to purchase something, the link won't work.
Could someone explain this to me?
I know it involves "if" statements and macros, I just haven't been able to get this specific thing figured out.
I am using Harlowe 2.0.1 and I have Twine 2. If you have some advice, I'd be forever in your debt!

Comments

  • It depends on what you mean by "a link that only works"

    a. A link that is only displayed if a condition is met.
    (if: $variable is "value")[[[Link Text->Target Passage]]]
    
    ... notice the three open square brackets and the three close. The first open and the third close square brackets are the delimiters of the (if:) macro's associated hook, the other open and close square brackets are the delimiters of the markup based link.


    b. A link that is displayed when a condition is met and replaced with text similar to the Link Text when condition is not met.
    (if: $variable is "value")[[[Link Text->Target Passage]]]\
    (else:)[Link Text]
    
    ... notice the usage of Escaped line break markup to remove unwanted line-break from output, and the (else:) macro to display the replacement text.

    NOTE: Both of the above examples assume you have previously assign a value to the $variable story variable like so:
    (set: $variable to "value")
    
Sign In or Register to comment.