Twine - using links where the destination is a variable leads to "dead links with a red cross" in the UI

If you are requesting technical assistance with Twine, please specify:
Twine Version: 2.3.14
Story Format: sugarcube-2 2.35.0

I have a number of links in passages where the destination is a variable (holding a passage name)

<<set $the_variable to “landing page”>>
… text of passage …
[[Some text|$the_variable]]

It works (excellent!) and a click lands the user on the passage whose name is the value of the variable, but on the twine UI it shows as a dead link (line + red cross) - as there is no passage named “$the_variable”.

Is there a way to either remove the “line + red cross”, or avoid this in the first place? I need dynamically generated destinations.

Thanks, as ever, for any help


This is because when you write the link like that, Twine automatically creates a passage named “$the_variable”, and when you delete that, you get the “broken link” displayed. As far as I know, it doesn’t affect your game in any way, but if it bothers you, you can always use the <<link>> macro:

<<link "Some text" $the_variable>><</link>>

This way, Twine won’t create a new passage for you automatically.

(On a side note, you should use the preformatted text (</>) button above the edit window when writing code examples, as it prevents the forum from changing your straight quotes into curly quotes that don’t work when copied back into Twine, and from “eating up” parts of the code.)

1 Like

Thanks you - excellent suggestion to use the <> macro to avoid this, as you say, purely aesthetic problem !

And thanks for the heads up about the pre-formatted text button.