New to Twine but liking it lots so far. I've only done very simple operations so far so apologies for the noobness.
I want to create a "What kind of [whatever] are you?" type survey in Twine2 of about 10 questions, with A, B, and C as multiple choice options. At the end of the survey, I want to display a message reading "You answered 'B' [or whatever] most often. That means you are most likely a [whatever]."
So it seems my tasks are:
1. To create a tally of which options are chosen
2. To determine which response was the most common one given
3. To display the "That means you are a [whatever]" message based on the result of
#2
4. To then erase results and start over for the next quiz-taker
I can only get as far as setting up the questions, options, and moving to the next question after a response. I don't know anything about how to approach the steps above. What do I need to learn?
Comments
You can use $variables to track information in your stroy, like what choices are selected.
The following example is made up of four passages named Startup, Question 1, Question 2, and Results.
1. Startup
This passage is where you initialize the main variables of your story, create a new passage and name it Startup, assign it a startup tag, and add the following to it: note: You could name the above passage anything you wished, the important part was the startup tag which lets Harlowe know that this passage need to be executed before the main passage of the story is displayed.
2. Question 1
This passage is the starting point of of your story, Add the following code to it: The above uses a variable ($answers) to track each option that is selected, and three variables ($countA, $countB, $countC) to track how many times each option was selected.
note: I have added extra line-breaks to the above code to make more readable, these line-breaks can be removed.
3. Question 2
You will need to create this (and all the other question passages) yourself because Twine 2 does not recognize Harlowe's (goto:) macro so it will not create the passage for you.
It is similar to Question 1 but it leads to the Results passage instead.
4. Results
Again you will need to create this passage yourself. It first determines what the maximum count ($maxCount) was and then determines which option counts ($countA,$countB,$countC) are equal to that maximum.
The above should be enough to get you started.
And yes, I'm using Harlowe—sorry I didn't mention it.