I'm working on an idea in which the reader answers a series of yes/no questions that are compiled all together in a page at the end. For example:
Do you like Ice Cream?
Yes.
Do you Like Strawberry Ice Cream?
No.
At the end, the final page would say:
I like ice cream. I do not like strawberry ice cream.
What I'm planning is a vast series of questions, so I wouldn't be able to do it by creating some sets of linear stories as there would be too many possible outcomes at the end.
Is this possible? Is it possible to refer to other pages in coding etc?
Thanks
Comments
I am going to assume you are using Harlowe and that you are using Yes/No markup links to move the Reader from one question (passage) to another (passage).
You can use the (set:) macro to assign the answer for each of your questions to story variables.
eg. The first question passage would contain something like the following: ... and the second question passage (Question 2):
You can then use the (if: ) macro and the (else: ) macro to check the values of the variables in the final passage:
note: I have added extra indentation and line-breaks to the above examples to make them more readable, these indentation and line-breaks can be removed.
At the start of your story assign a default value of "unanswered" to all of your question variables, Harlowe has a special startup tag which can be assigned to a passage to do this. Then change the question passages to assign "yes" and "no" instead of true and false: Then change the final passage to take the three possible values into account: