How to end experiment after certain number of incorrect trials
Hi,
Participants in my experiment need to perform a headphone check, which consists of 6 trials. They're allowed to pass if they get at least 4 correct, but if it is less, I want to end the experiment. I added a Javascript inline item at the end of the headphone check sequence but it doesn't actually end the experiment.
I suppose there is an issue with exp.end(); ?
Thanks!
Comments
Hi @sflu ,
The
exp.end()function is for internal use. It's not a way to end the experiment.In your case, to end the experiment, you probably want to use a run-if expression. The details depend on the structure of your experiment, but you can probably use a run-if expression such as
acc > thresholdfor the part of the experiment that you only want to run if the accuracy reaches this threshold. Do you see the logic?(Note that the run-if expression above is simply a Python expression, which is possible in OpenSesame 4.0, but not 3.3 and earlier.)
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi @sebastiaan
Thanks for your response! I haven't upgraded to 4.0 yet, so what I tried was putting [acc] > 67 in the Run if field of the parts of the experiment I want to run. This works in the sense that if you fall below 67 you are taken to the end of the experiment, and if you are above 67 you move on to the practice sequence.
However, then I think the acc value from the headphone check is overridden by that of the practice sequence, and you don't reach the experimental sequence if your answers are all incorrect in the practice, for example. I tried to define a separate accuracy variable in a javascript_inline like this var acc_check = (vars.correct_response / vars.count_headphone_sequence_1) * 100; and adjust the Run if fields accordingly, but that didn't seem to help either. Any idea what else I could try? I've never used OSWeb before.
Thank you!
Hi @sflu ,
In that case, you will need to 'save' the accuracy before the practice sequence by assigning it to a different variable so that it's not overwritten. You can do that in an
inline_javascriptitem as shown below. This should be in the run phase and the script should come right after the headphone check.And then you can use the
heaphone_check_accvariable in the run-if statements.— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
That worked, thank you very much, @sebastiaan !