Howdy, Stranger!

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

Click passage to set a variable?

Hi everyone,

New to Twine, Harlowe and everything else. I have been wondering if there is a way to make an if-connection between picking a certain passage and setting a variable, for instance.

So for example, I have one passage that asks the player to make a choice between three colors. I want the next passage to be the same, but with some difference in text depending on the choice.

Basically, what I want to do is this: Someone picks Green.->color and this, in addition to taking the player to the passage 'color' also sets the variable $favoritecolor to "green".

I hope that makes sense and I hope I have not missed something obvious. Thank you in advance.

Comments

  • The wiki really isn't clear on this matter. I know with sugarcube you can just go:

    Green->color][$favcolor to "green"

    I don't know if that works in harlowe too. It worked in Twine 1.0 so I'd assume it works in 2.0 too, but I can't test that right now.
  • Magnusaur wrote: »
    Basically, what I want to do is this: Someone picks Green.->color and this, in addition to taking the player to the passage 'color' also sets the variable $favoritecolor to "green".
    You probably want something like the following construct:
    (link: "Green")[(set: $favoritecolor to "green")(goto: "color")]
    
    SEE: (link:), (set:), and (goto:).

    MoLoLu wrote: »
    The wiki really isn't clear on this matter.
    The Twinery wiki really is not the primary source of information on the individual story formats. For Harlowe, you should see its own documentation.

    MoLoLu wrote: »
    I don't know if that works in harlowe too.
    It does not.
  • Thanks to the both of you. That sugarcube solution seems particularly elegant, but now I know what to do!
Sign In or Register to comment.