Quantcast
Channel: Twine Forum
Viewing all articles
Browse latest Browse all 3830

Dynamic Linking

$
0
0
Pre-face: I'm torn choosing between workshop and chit-chat. Is there any rules regarding on what is for what?
Pre-face 2: This is also not a question. Just a brain dump and acts like a note for me. People are free to jump in with better ideas and solutions though.

I'm trying to make a sort of dynamic link passage. This passage will change it's link details to whatever $variable it is passed to. I've tried using the following:
[[Link Text|$variable]]
[[Link Text|<<$variable>>]]
[[Link Text|<<print $variable]]
The all didn't work and created new passages which is not what I do not want it to do.

I poked around the Twinery wiki and found the link documentation via sitemap. There's an example there:
<<set $actor to "Ginger">>
<<if $location[$actor] is passage()>>
<<print "[[Talk to " + $actor + "|Talk_" + $actor + "][$chat to '" + $actor + "']]">>
<<endif>>
And I thought, maybe it might work. Then it did. The below code now makes the link in the passage act dynamically.
<<print "[[Link Text|" + $variable + "]]">>
It still made a passage but when I played the passage with the dynamic link, it took me where I want to go. I deleted the created passage and it still works. I just don't know how to remove the flow chart line, but I guess that's ok for now.


Other notes:
Twine Version: 2.1.0
Current Story Format: SugarCube 2.16

Other note to me: You big dummy read the title of the paragraph of the documentation next time.

Viewing all articles
Browse latest Browse all 3830

Trending Articles