0 votes
by (560 points)

Sugarcube 2.18.0

Hi there,

I'm looking to export answers at the end of a game to a survey via a clickable link (survey then reads the URL variables for various scores).

Without the https://, the link isn't clickable (would need to manually copy and paste), however the variable does display as the number and therefore gives the correct output.

Conversely, the https:// is obviously clickable, but still displays as gp=$duration rather than gp=874 for example.




It's just to see if there's some way around this to make the link clickable, but also have the value of the variable displayed in the link?

Thanks a lot

1 Answer

+1 vote
by (159k points)
edited by
Best answer

You can use a String variable to build the URL and then use that variable as the target of a Markup based link.

<<set $term to "ABC">>

<<set _url to "https://www.google.com.au/search?q=" + $term>>

[[Send Data|_url]]

WARNING: The Automatically Create Missing Passages feature of the Twine 2 application will incorrectly create a Passage named _url because that feature doesn't understand advanced Markup based links, you will need to manually delete the _url Passage for the external link to work correctly.

by (560 points)
That's fantastic, works perfectly! Thank you so much for your help! :)