Help: New to Twine... in Search of Best Macro for Project

(Harlowe 3.3.3)

Hey! I’m doing a project for university using Twine and I entered the class after they gave a workshop so I’ve had to figure out a lot out on my own. I can’t seem to figure out, however, which macro to use for a specific mechanic. I’ll try my best to explain:

There are 5 explorable situations. At the end of each one, the player is asked a yes or no question. I want the player to select yes for 3 of these paths, prompting an ending based on the 3 situations they answered “yes” for. If they choose “no”, they can explore another path (returning to the passage that allows them to select which option to explore next) . They cannot get an ending until they select “yes” three times. There will be 15 possible endings (since each ending is the result of combination of 3 yesses).

I guess my main question is… how do I generate an ending once “yes” has been selected three times, but have the ending be different depending on which passages they pressed “yes”?

Thank you so much!

There are a number of ways this problem can be solved, one of the simplest is to use a five element Array to store the Yes/No answers in, and to use an empty Sting "" to represent the situation where no Yes/No answer has been given yet.

(set: $answers to (a: "", "", "", "", ""))

You could then use the (count:) macro to determine when 3 of those elements have been changed to a “yes” String literal.

The following is a TWEE Notation based example that demonstrates the basic parts required, with the Start Passage being the 1st Passage of the project.

:: Start
(unless: (count: $answers, "yes") is 3)[
Explore:
[[Area 1]]
[[Area 2]]
[[Area 3]]
[[Area 4]]
[[Area 5]]
]
(else:)[ [[Endding]]]


:: Startup [startup]
(set: $answers to (a: "", "", "", "", ""))


:: Area 1
Area 1
 
Choice: {
	(link-reveal-goto: "Yes", "Start")[
		(set: $answers's (1) to "yes")
	]
	or 
	(link-reveal-goto: "No", "Start")[
		(set: $answers's (1) to "no")
	]
}


:: Area 2
Area 2

Choice: {
	(link-reveal-goto: "Yes", "Start")[
		(set: $answers's (2) to "yes")
	]
	or 
	(link-reveal-goto: "No", "Start")[
		(set: $answers's (2) to "no")
	]
}

:: Area 3
Area 3

Choice: {
	(link-reveal-goto: "Yes", "Start")[
		(set: $answers's (3) to "yes")
	]
	or 
	(link-reveal-goto: "No", "Start")[
		(set: $answers's (3) to "no")
	]
}

:: Area 4
Area 4

Choice: {
	(link-reveal-goto: "Yes", "Start")[
		(set: $answers's (4) to "yes")
	]
	or 
	(link-reveal-goto: "No", "Start")[
		(set: $answers's (4) to "no")
	]
}

:: Area 5
Area 5

Choice: {
	(link-reveal-goto: "Yes", "Start")[
		(set: $answers's (5) to "yes")
	]
	or 
	(link-reveal-goto: "No", "Start")[
		(set: $answers's (5) to "no")
	]
}

:: Endding
Endding