Can't get $name variable to print in link text

Twine Version: 2.3.5
Story Format: Sugarcube

Hi, I’m trying to get a passage to read out a $name variable in the link to the next passage. Currently what I have is:

[[Goodmorning, Mr. Eytui. I’m $name $name2, and this is my partner, Mag. The Harrow and Kine agency is at your service.|I’m name, a pleasure.]]

However, it always just reads out the raw variable without printing it.

I’ve tried mucking around with the << link >> << /link >> command also with no success. Any suggestions?

Try this kind of syntax, where you let the variable values be interpreted first outside of the link structure.

<<set $name = "John", $name2 = "Doe">>
<<set _linktext = "Goodmorning, Mr. Eytui. I’m " + $name + " " + $name2 + ", and this is my partner, Mag. The Harrow and Kine agency is at your service.">>
[[_linktext|I’m name, a pleasure.]]
1 Like

Thank you so much, that works perfectly!

1 Like