0 votes
by (200 points)

So, I'm writing a detective story. I used the set marco to name all of my passage variable. The problem is, when I use the if macro, I want it to link to two passages. It will not let me do that.


(set: $blah to true)

(if $blah is 'true') [
[[Passage 1 Link Here]]
[[Passage 2 link here]]

I'm using this code in variations but the links won't show.


Also, How would I name a variable if  the following scenario happened: 


A player has three options. He clicks one in a random order. He heads and then clicks from the two remaining passages. After that, he clicks the last one. On the last passage, there is a single 'Continue' link.


I'd like this scenario to occur if the person clicks the passages in a different order.


If I need to clarify, I can. Thanks in advance!

1 Answer

0 votes
by (158k points)

I want it to link to two passages. It will not let me do that.

The (set:) macro in your example is assigning a Boolean true value to the $blah story variable but in your (if:) macro you are comparing the current value of $blah to a String value, and this is why that condition expression never evaluates to to true. The following example show the correct way to check if a Boolean based story variable equals true or false.

(set: $variable to true)

(if: $variable)[Shown if the variable currently equals true.]

(if: not $variable)[Shown if the variable currently equals false.]

So the if macro in your example should look like the following

(if $blah)[
[[Passage 1 Link Here]]
[[Passage 2 link here]]

note: There should be no white-space characters between the closing parentheses ")" of the macro and the open square bracket "[" of the macro's associated hook.

How would I name a variable if  the following scenario happened

There are a number of ways you can achieve the effect you want, the following solution uses three Boolean based story variables to track if each of the three passages have been seen yet.

1. Initialise the three varaibles within your project's startup tagged special passage.

(set: $seen1 to false)
(set: $seen2 to false)
(set: $seen3 to false)

2. In each of the three passages use a (set:) macro like the following to update the relavent variable to true, you will need to change which variable is updated based on which of the three passages you are editing.
eg. name the variable $seen1 in the 1st passage, $seen2 in the 2nd passage, and $seen3 in the 3rd.

(set: $seen1 to true)

3. Add the (if:) macro to all three passages, it conditionally displays the relevant (link-goto:) macro based link when all three variables equal true

(if: $seen1 and $seen2 and $seen3)[(link-goto: "Continue", "Target Passage)]


by (200 points)
Thanks!  That really helped
asked Mar 9 by (200 points) More Help With Passage Links
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.