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

+2 votes
asked Aug 3 by Olzme (270 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 by Olzme (270 points)
commented Aug 3 by greyelf (32,200 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>>

 

...