0 votes
asked by (120 points)

I'm trying to get my links to update variables when the user clicks it but it's setting the variables automatically. I've included the code below.

(link: "Is the phone number you're calling from the best one to reach you at?")[(goto: "phone")]
(link: "Are you calling to file a new claim or follow up on an existing claim?")[(set: $phonenumber to "no")(set: $email to "no")(goto: "filter")]

Thanks in advance.

1 Answer

0 votes
answered by (115k points)

I did the following to test your example.

1. Initialised the two variables within a startup tagged special passage.

(set: $email to "yes")
(set: $phonenumber to "yes")


2. I added your example to the main Passage of a new Harlowe 2.x based project.

(link: "Is the phone number you're calling from the best one to reach you at?")[
	(goto: "phone")
]
(link: "Are you calling to file a new claim or follow up on an existing claim?")[
	(set: $phonenumber to "no")
	(set: $email to "no")
	(goto: "filter")
]


3. I added both a phone and a filter passage to my project and placed the following debugging code in both of them

email: $email
phone number: $phonenumber


4. I tested the project, clicking on each of the two links in turn and both worked correctly.

eg. When I used the 1st link to viewed the phone passage the two variables hadn't changed from their initial values so the output was "yes" for both of them, and when used the 2nd link to viewed the filter passage both of the outputs had changed to "no".

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...