I'm new to TWINE and have been writing a story for the past month. I've read through several tutorials as well as some of the information on the wiki. However, I'm having trouble piecing it all together to solve my problem.
I want to make one choice in my story set a variable that will be referenced later. Here's an example:
"You are leaving the house, but you realize you forgot something. You rush back to in to retrieve your...
Choice 1) knife
Choice 2) lucky rabbit's foot"
Choosing the knife or the rabbit's foot will set variable $item to "knife" or "foot", but both choices should then proceed to the same passage next. How do I actually script that? I can imagine how to do it by creating new passages for choosing the knife or the rabbit's foot, but I would rather not create an extra passage since it seems unnecessary. Ideally, the flow would look like this:
(Passage 1) Leaving House (choose knife or rabbit's foot) ---> (Passage 2) On the Road
I hope I'm explaining this well. Can someone offer me some insight?
Comments
I think the easiest way to do this would be to use 'setter links'. These are links that set variables when you click them as well as moving you to a new passage. You can read more here : http://twinery.org/wiki/link#setting_variables_with_setter-links
Essentially, to use them in your example, you'd do this: Hope this helps!
[[displayed text|title of passage][$variable = expression]]
[[Choose Knife|On the Road][$item = knife]]
[[Choose Foot|On the Road][$item = foot]]