Run if functions
Hello everyone, Im doing an experiment resembeling the digit span, the usual working memory experiment. Im trying to make the experiment finish after two mistakes in the same level, that means that after two mistakes in the D2 loop it cancels de other loops, which go from D3 to D9, and it passes to a finishing message. I have tried using the if function of a loop, but it just pass to the other level. Any suggestions?
Comments
Hi Andres,
Per level, you need to do three things:
1) Have a counter variable that keeps track of the number of consecutive errors
2) Depending on that counter, have a variable that decides whether the current block is continued or not
3) Depending whether a block has been aborted or not, decide whether the next blocks will be run or not (probably you can re-use the variable from 2 for that)
To have such a counter variable you need to initialize it before a loop in an inline_script (e.g. var.counter = 0), then during the loop you need to update whether an error has been made (increment by one) or not (set to zero). If the counter hits 2, set the variable whether to abort or not to true. In the run if field you have every loop only run if abort is False (therefore you have to initialize this variable as False in the beginning of the experiment).
Does that make sense?
Eduard