Howdy, Stranger!

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

Remembering choice

Hello fellow Twiners.

Am pretty new to this and am having some issues with choices made in 1 passage that's should link to another passage. The difference in choices affects the story.

For example, in passage 5 "David wants to buy a gift for his wife. Choice A a bag, choice B shoes"

Now in passage 10 " David gives his wife the gift. If he bought the bag (choice A) he gets kisses, and if he bought shoes (choice B) he gets hugs.

Now i can't seem to figure the codes out.

Any help would be highly appreciated :)

Comments

  • edited October 2016
    You need to state which Story Format (name and version) you are using when you as a question, as answers can be different for each one. I will assume you are using Harlowe.

    You can use a variable record which option was selected and then late use the value of the variable to determine what should be displayed to the Reader.

    1. First passage:
    Use a (set:) macro to record which option was selected in the $gift variable.
    Which gift for your wife do you want to buy David?
    
    (link: "a bag")[
    	(set: $gift to "bag")
    	(go-to: "Second")
    ]
    (link: "a pair of shoes")[
    	(set: $gift to "shoes")
    	(go-to: "Second")
    ]
    

    2. Second passage:
    Use an (if:) macro combined with an (else:) macro to determine what to displayed.
    David rushes home and gives his wife the $gift, she is so happy she gives him (if: $gift is "bag")[some sweet kisses](else:)[a hug].
    

    The same functionality can be achieved using both Snowman and SubarCube but the syntax of the passage content would be different.
  • Thanks greyelf! Worked like a charm. Yes am using harlowe btw.
Sign In or Register to comment.