Howdy, Stranger!

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

Increasing variable value on button click.

edited November 2016 in Help! with 2.0
Sorry if my description doesn't make sense, I'll try my best to explain.

I'm using Twine to make a "Pick a choice" kind of game. Each option adds a point into one section before moving onto a random passage. I wish to increase the point when a choice is made and go straight to the next "choose an option card".

I know that increasing variables is, set: $Name to $name + 1, and that it is usually done within a new passage.

Is it possible to increase the variable when clicking a button that links to a new passage. Like ((set: $Name to $name + 1))? Or do I need a to have a passage inbetween that'll increase the value?

Thanks

Comments

  • You need to state which Story Format (name and version) to are using when you ask a question, as answers can be different for each one. Based on your markup link example I will assume you are using Harlowe 1.2.2

    You can use a (link: ) macro combined with both a (set: ) macro and a (go-to: ) macro to achieve the effect you want. This combination of three macros is Harlowe's version of what is generally known as a Setter Link.
    (link: "Link text to show")[
    	(set: $variable to "value")
    	(go-to: "Name of target passage")
    ]
    
  • greyelf wrote: »
    You need to state which Story Format (name and version) to are using when you ask a question, as answers can be different for each one. Based on your markup link example I will assume you are using Harlowe 1.2.2

    You can use a (link: ) macro combined with both a (set: ) macro and a (go-to: ) macro to achieve the effect you want. This combination of three macros is Harlowe's version of what is generally known as a Setter Link.
    (link: "Link text to show")[
    	(set: $variable to "value")
    	(go-to: "Name of target passage")
    ]
    

    That did it thanks!

Sign In or Register to comment.