This is really straight forward: Is there any way to use a variable as a link? Say, if the variable equals a passage name, is there any way to get Twine to recognize that? Or do you just have to go with a wall of "if" statements if you want to have a variable link like that?
Comments
Yes. The wiki link markup can accept a $variable as its link component straight up. How you use a $variable for the optional text component differs between the vanilla formats and SugarCube.
Vanilla story formats [Jonah, Sugarcane, Responsive] (see: link):
SugarCube (see: Links):
Alternatively, you could also <<print>> the entire link, like so:
I have to say, I've found that last trick to be *very* useful when printing links within loops when the link depends on the loop variable (a distinct link to act on a particular item in an inventory list, for instance). Regular links won't resolve until the user clicks them, which is long after the loop is already finished and the loop variable is either at its final value or reset. Constructed links will resolve when they're constructed and the variable is at the correct place in the loop.