|
Post by matia on Jan 25, 2021 11:11:57 GMT
Dear Psytoolkit users,
I have a quick question. Is there a way to shorten the following code:
l: a t: radio q: Which is correct?
- Answer one
- Answer two
- Answer three
l: B t: radio q: Which is correct? - Answer one - Answer two - Answer three
l: answerA t: set - if A = 2 then 1 - if A != 2 then 0
l: answerB t: set - if $B = 3 then 1 - if $B != 3 then 0
l: total_score t: set - sum $answerA $answerB
because when there are many such questions it can get annoying making a whole new variable just to get a score. I was thinking whether it is possible to set number of points as part of the question itself?
Thanks for your help, best, Matia
|
|
|
Post by PsyToolkit on Jan 25, 2021 17:29:36 GMT
Yes, you can do it simpler. You can use the "score" option for items. The sum with a * automatically takes all labels starting the same way...
(Note: For some reason, you cannot put the questions within page begin/end, I will figure out why...)
l: my_test_1 t: radio q: Question 1: Which is correct? - {score=0} Answer one - {score=1} Answer two - {score=0} Answer three
l: my_test_2 t: radio q: Question 2: Which is correct? - {score=0} Answer one - {score=1} Answer two - {score=0} Answer three
l: total_score t: set - sum $my_test_*
l: feedback t: info q: Your score is {$total_score}
|
|