Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Can a single link lead to a passage randomly chosen from several possible ones?

I'm trying to create a story where a character is climbing a tree. They can choose to climb down, in which case they return to the ground and all is well - straightforward enough. But if they choose to continue climbing the tree, I would like for them either to reach a safe branch to take a break, or to fall to their death. I've experimented with the either() function within the link [[link|passage]] syntax, but to no avail so far.

Is this kind of story structure supported by Twine, and if so how would I go about realizing it? I have some experience in Java and Javascript, so I can handle code if that's what it takes!

Comments

  • Did you try something like this?

    /% Even odds of either %/
    [[Continue climbing?|either("Climb higher", "Fall to death")]]
    For stacked odds, simply repeat a passage:

    /% 2-to-1 in favor of "Climb higher" %/
    [[Continue climbing?|either("Climb higher", "Climb higher", "Fall to death")]]
    That should work fine as long as you don't have too many possibilities.
  • Thanks MadExile! I have tried something very similar before, but just to be sure I copy-pasted your text into my passage. Unfortunately, when I pressed enter the brackets turned kind of reddish instead of their normal light purple. When I closed that particular passage, I didn't get the prompt to create any new passages. On the story board, that passage has a light purple dot in its bottom left corner. Does any of this help explain what's going on?
  • Because you are using the either() method in a link Twine does not know how to create the extra passages for you, so you will need to do so your self.
    Just use the 'New Passasge' option to create two new passages, title one of them Climb higher and the other Fall to death

    The syntax highlighter in Twine (thing that changes the links color) does not understand more complex links and the purple dot is just indicating the same thing but the link will work anyway.
  • Add some commented out links and it'll help the editor (and you) deal with it

    /% [[Good climb|Climb higher]] %/
    /% [[Bad Climb|Fall to death]] %/
Sign In or Register to comment.