The following code usually works fine, but when I add an if statement into the Vegetables link, I get a whole bunch of errors. Is there any way to use if statements or evaluate conditions within a link?
You have arrived at the store. You start off by buying some fruit.
<<silently>>
<<set $fruits to ["apple","orange","pear"]>>
<<set $vegetables to ["carrot","cabbage","potato"]>>
<<set $nuts to ["walnut","hazlenut"]>>
<<set _showFruit to true>>
<<set _showVegetables to true>>
<<set _showNuts to true>>
<<set _lastLookedAt to "fruit">>
<</silently>>
@@#list;@@
<<fadein 2s 4s>>
<<link "__Fruits__">>
<<set _showFruit to true, _showNuts to false, _showVegetables to false, _lastLookedAt to "fruit">>
<</link>>
<<link "__Vegetables__">>
<<if _lastLookedAt == "fruit>>
<<append "#list">><<print "You stop looking at fruits, and switch to vegetables">><br><</append>>
<<elseif _lastLookedAt == "nuts">>
<<append "#list">><<print "You stop looking at nuts, and switch to vegetables">><br><</append>>
<</if>>
<<set _showFruit to false, _showNuts to false, _showVegetables to true, _lastLookedAt to "vegetables">>
<</link>>
<<link "__Nuts__">>
<<set _showFruit to false, _showVegetables to false, _showNuts to true, _lastLookedAt to "nuts">>
<</link>>
<<link "__Check Out__">>
<<set _showFruit to false, _showVegetables to false, _showNuts to false>>
<</link>>
<</fadein>>
<<silently>>
<<repeat 2s>>
<<if _showFruit>>
<<append "#list">><<print either($fruits)>><br><</append>>
<<elseif _showVegetables>>
<<append "#list">><<print either($vegetables)>><br><</append>>
<<elseif _showNuts>>
<<append "#list">><<print either($nuts)>><br><</append>>
<<else>>
<<append "#list">><<print "You are done shopping">><br><</append>>
<<append "#list">>[[another passage|another passage]]<br><</append>>
<<stop>>
<</if>>
<</repeat>>
<</silently>>