Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

$variable in link name?

I'd like to have a passage link that contains normal text and the contents of a variable, something like this:

[[Turn off the <<$device>>|turnoff]]

I tried looking for this, and found the below thread. Is there an built in way to do this now? I'm running Sugarcube, by the way.

https://groups.google.com/forum/#!topic/tweecode/9OggpvgERWA

Comments

  • I'm assuming that the angle-brackets were notational and you don't actually want to print them.

    Try this:
    <<print "[[Turn off the " + $device + "|turnoff]]">>
    A bit clunky, but it works.

    If the $variable contained the entirety of the link text, you could just do this:
    [[$linkText|turnoff]]
  • That's perfect, thanks!
  • mostly wrote:

    I'd like to have a passage link that contains normal text and the contents of a variable, something like this:

    [[Turn off the <<$device>>|turnoff]]
    That line should work unaltered in Twine's built-in formats, FWIW.
Sign In or Register to comment.