Multiple variables in a link?

I have a question I didn’t manage to find an answer to (also apologies if it in fact had been asked and resovled, I have poor detective skills :pensive:).

Is it possible to add two variables in a single link? I tried a few things but always end up with “invalid or unexpected token” error. What I aim for is something like this:

[[I like strawberry ice cream|1.1][$food to “icecream”][$flavor to “strawberry”]]

It works with one variable but I have no idea how to implement two of them in the same line and if it’s possible?

I’m using:
Twine Version: 2.3.14
Story Format: Sugarcube 2.34.1

You can do it like this:

[[I like strawberry ice cream|1.1][$food to "icecream"; $flavor to "strawberry"]]

Alternatively, you can use the “link” macro (which allows for executing more complex code upon clicking a link):

<<link "I like strawberry ice cream" "1.1">><<set $food to "icecream">><<set $flavor to "strawberry">><</link>>

(also, a small hint - use the “</>” (preformatted text) button when posting code examples to the forum; it prevents the forum from changing straight quotes into curly quotes, which cause errors when copied back into Twine, and also from eating parts of your code).

2 Likes

It worked, thank you so much! :slight_smile:

Also thanks for the quote advice, turns out I had a bunch of those in the code already and it messed up some things that now seem to be working fine. Well, time to stick to a text editor that does not force the curly quotes :relieved:

Cheers!

1 Like