I'm trying to create cycle links that are dependent on previously chosen variables.
Code right now is a scramble between if/else statements and cyclingLink code, but basically I want it to do the follow:
Page 1: set $food to cycle "fruit" or "vegetable" --> I can do this much
Page 2: if $food is "vegetable," set $favorite to cycle "carrots", "broccoli", "potatoes"
else set $favorite to cycle "apples", "oranges", "grapes"
Comments
One possible solution is to use a String variable to store which favorite's link you want to use and then to use a (print:) macro to show the link.
note: Because the cycle link code contains string values internally I am going to use both single and double quotes to delimit strings, I will also need to escape some of the single quotes using a backslash \ character.
The following solution consists of three passages.
1. First Passage: 2. Second Passage:
note: I have used indents and line-breaks to make the following more readable, these can be safely removed. 3. Third Passage:
You did cut-n-pasted the contents of the each of the three passage examples into your story without editing the contents?
I have attached a Twine archive which contains the story I used for creating and testing the solution. Use Twine's Import From File option to view it.
Thanks so much for the help!