Hi there,
I'm using Twine 2 with SugarCube 1.0.29 and I'm trying to print variables along with some text on a few specific links. Is this possible?
If I write
$friend_1 it works, but if I change it to
You choose $friend_1 instead of $friend_2 it does not recognise "$friend_1" and "$friend_2" as variables and outputs the entire sentence literally. I've also tried "<<print $friend_1>>" inside a link but it still doesn't render it as a variable.
Is there a way around this?
Thank you
Comments
@TheMadExile Thanks! Same outcome though, it printed the link verbatim (quotation marks and plus signs included)?
I set them on the previous one and that did the job, thank you!
Could I trouble you with one last question? If I wanted to print user input variables in uppercase in those links, would that be possible? In HTML I can simply use a "<span>", but it doesn't seem to be the case here?
Thank you for sharing your valuable time, @TheMadExile
As far as uppercasing the $variables, unfortunately no, you cannot use markup inside the link (again, they're either plain text or a TwineScript expression). You can, however, make use of the string method toLocaleUpperCase(). For example:
If you wanted to uppercase the link text only, leaving the passage as-is, then it would be like the following:
Thank you for your time, @TheMadExile , and thank you for SugarCube!