Is there a way to state variables in the <<link>> macro in Twine 2, sugarcube 2-18?

+2 votes
asked Aug 3, 2017 by Olzme (440 points)
I'm trying to state a variable within a <<link>> <</link>> macro, for example this:

<<link [[Continue to Chapter 1 in $difficulty |Chapter 1: Loss Page 1]]>><<script>> Dialog.close()<</script>><</link>>
 

However Twine does not recognise $difficulty and shows "$difficulty" instead of it's actual value.

Is there a way around this?
Thanks in advance.

1 Answer

+1 vote
answered Aug 3, 2017 by Olzme (440 points)
commented Aug 3, 2017 by greyelf (76,610 points)

Or simply use the version of the <<link>> macro that accepts two String values.

<<set $difficulty to "Abcd">>

<<link "Continue to Chapter 1 in $difficulty" "Chapter 1: Loss Page 1">><<script>> Dialog.close()<</script>><</link>>

 

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...