0 votes
by (240 points)
Help, please. I have a page that says: You have 20 coins. [[To dig a chest]] [[Buried treasure chest]] I need to make it so that if a player clicked on [[Dig the chest]], next the page that reads: You've successfully dug up the chest. To the number of coins (20) added 10. But if [[close the trunk]] and then the number of coins ON the NEXT PAGE must take away 10.

On Harlowe. Twine 2-1-0

1 Answer

0 votes
by (156k points)

You can use a combination of a (link:) macro, a (set:) macro, and (go-to:) macro to create what is known as a Setter Link, which will allow you to achive the effect you want. The following example shows two such Setter Links, the first increases the number with the $coins variable by 10, and the second decreases the same variable by 10.

(link: "Dig the chest")[
	(set: $coins to it + 10)
	(go-to: "Name of the next passage")

(link: "close the trunk")[
	(set: $coins to it - 10)
	(go-to: "Name of the next passage")

note: You will need to repace the "Name of the next passage" String value in both of the above Setter Links with the actual name of the Passage you want each link to target.

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.