Hi,
I am a new to working with twine and want to include some variables.
I have this example:
Which value?
(link: "Select a")[(set: $var to 1)(goto: "show selected value")]
(link: "Select b")[(set: $var to 2)(goto: "show selected value")]
It does work but I miss the handy arrow that points me from the passage where I wrote the code above to the passage "show selected value". Can you explain to me why the arrow is not there and how I can make it appear?
Thanks a lot!
Comments
link text[b][color=red]->[/color][/b]passage
Is that the arrow you mean?
I also tried this:
The result is that var is always 2 even if I select 1. So I do get the arrows in the overview but screw up the variables.
Your other attempt just sets the variables procedurally regardless of clicks. Your code tells Twine to set $var to 1, then your code tells it to set $var to 2. So, $var is set to 2. Working as intended.
Oh, too bad
Is there no way to have both at once? The connector arrows visible and the variables as I intend it?
Something I do when I want to use the (link:) option and still have the connecting arrows between passages is to put a standard passage link within an (if:) statement that will never be true.
For example, using what you posted above, I would add the following code to the bottom of that passage:
Since I never set $invisibleLink as true, the link itself will never show, but the arrow within the Twine interface will connect both passages. This gives me more control over how to see the connections between passages.
Note: I put a space between the [ hook bracket and the passage link because sometimes Twine misreads it if all the brackets are joined together.