Checking for correctness - 2 questions on 1 screen

Please help, can’t find the bug!
I made a screen with two questions in a row (part of an escape room, so it’s importent to me it’ll be in the same screen). I have two math input boxes for the two questions and an action button to change the question.
After much trial and error, I defined a parameter ‘correct’ in the first math input, set to 1 when first q is correct, 2 when second is correct and 0 otherwise. for some reason, it dosen’t change to 2 when the second is correct, and I can’t figure out what I did wrong.
Help anyone?

It’s just the order of the when's. If you have a when-when-otherwise, it checks the first then the second then the otherwise. If the conditions for the first when are met, it stops. So in your code it will never get to assigning correct=2. Switch the first two and it should be okay.

Also, you don’t need to use this.script.correct, you can just use correct since the variable is in that component.

1 Like

Thanks, that did it. And also for the tip!

1 Like