Here is my program:
https://www.guidedtrack.com/programs/bxnyn3y/run
I want to ask a checkbox question and give feedback on which answers are correct or false. I've changed the question to a simple example. I want to ask my physics students questions and give explain to them later on why their chosen answers are correct or wrong.
This looks a bit convoluted, because I usually have very long question and feedback strings and don't want to copy paste them all over the code in case I change it later on.
Also, I want to use this program for different questions with different amounts of possible answers. That's why I have the *if: A2 line. This way, I can add more answers and still use the program even for questions with fewer answer options.
When I run the program, I get the feedback for the second answer option only if I also clicked the first one. If I only click the second one, I don't even get the "next question" button.
Why? Thank you in advance for the help! In addition: Sorry if I look like a complete coding fool to you, I'm not a programmer and very aware that there are probably much less convoluted ways of coding this.
These are my lines:
-- the question
>> Q = "What is 1+1"
-- possible answers
>> A1 = "2"
>> A2 = "42"
-- feedback for the chosen answers
>> R1 = "Yes"
>> R2 = "That's the answer to a different question."
>> answers_points = [1,-1]
*question: {Q}
*type: checkbox
{A1}
{A2}
*save: answerschosen
{Q}
*if: A1
*component
*if: A1 in answerschosen
*component
Your answer:
*component
{A1}
*component
{R1}
>> points = points + answers_points[1]
*if: A2
*component
*if: A2 in answerschosen
*component
Your answer:
*component
{A2}
*component
{R2}
>> points = points + answers_points[2]
*button: Next question