0 votes
by (240 points)
edited by
Help, please! I have the value of the variable "Gold" - 50. I need to make sure that when you select a specific answer, such as" Dig a treasure", this value was added 20 units. And Vice versa: when choosing the option "to Bury the treasure", from the value of 50 20 units were subtracted. How to do? On Harlowe

1 Answer

0 votes
by (159k points)

Please use the Question Tags to state the name and full version number of the Story Format you are using, as answers can vary based on this infromation. You have listed two different story formats in your Question Tags (SugarCube and a missnamed Harlowe) but indicate in your Question that you only want a Harlowe related answer.

1. Using the (set:) macro to initialising a variable.

(set: $gold to 50)

note: Idealling variable initialisation should be done within your project's startup tagged special passage.

2. Using a (link:) macro combined with a (set:) macro to increase the value of a variable.

(link: "Dig a treasure")[
	(set: $gold to it + 20)
]

3. Using a (link:) macro combined with a (set:) macro to decrease the value of a variable.

(link: "Bury the treasure")[
	(set: $gold to it - 20)
]

 

...