0 votes
by (220 points)
edited by
I am making a passage in which the player gets to click the stat(s) he/she wants to boost 3 times. There is a link for each stat which adds +5 to the corresponding stat and at the same time adds -1 to the number of choices you have left(you start out with three). I also wanted each link to be able to direct the player to the next passage once the number of choices was reduced to 0, but it hasn't been working. The link for boosting Strength is below.

(link: "Strength + 5")[(set: $str to $str +5)(set: $statchoice to $statchoice -1)(if: $statchoice = 0)[(goto: "CharacterDev5")]]

Thank you in advance.

2 Answers

+2 votes
by (159k points)
selected by
 
Best answer

Please use the Insert Code Snippet button when adding code examples to a question, it makes them easier to find and read.

In Harlowe a single equals sign '=' means assignment and is equivalent to the TO operator. To compare two values you need to use either the double equals signs '==' or the IS operator. This means that your (if: $statchoice = 0) statement is actually first assigned the value 0 (zero) to the $statchoice story variable and then checking if the end result is true, which it isn't.

I suggest changing your examine to something like the following:

(link: "Strength + 5")[{
	(set: $str to it + 5)
	(set: $statchoice to it - 1)
	(if: $statchoice is 0)[
		(goto: "CharacterDev5")
	]
}]

 

+1 vote
by (63.1k points)
...