Online Problems (key response and nested loops) v2022.2.4

URL of experiment: Pavlovia

Hi there,

So I am doing a paced serial addition test in psychopy v2022.2.4 on Mac. I have managed to get it working offline but once I try to sync it into Pavlovia the nested loops do not work nor does it store any responses in the excel sheet.

This is the code I have used for the nested loops
Begin routine
if ((trials.thisN === 0)) {
score = 0;

End Routine
if (key_resp_3.corr) {
score = (score + 1);
if (((score / (trials.nTotal + 1)) >= 0.75)) {
trials.finished = true;
trials_2.finished = true;

This is what my loop looks like

This is the keyboard settings
Force end of routine - yes
Allowed keys = ‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’,‘0’
Store all keys
Store correct - yes
correct answer $correctAns
and the rest checked off as well

This is what shows up in the excel sheet when I do the experiment and put in key responses

I have tried many things but nothing seems to be working, I would appreciate any help.

Thank you

Here are screenshots of the other factors


Key response settings


I am surprise to see that the offline version worked, although I am not sure whether this error causes your online problems (the JS-part looks ok.) . You wrote

if ((trials.thisN === 0)) {
    score = 0;

an the Python side. But it has to be

if trials.thisN == 0:
    scorce = 0

Any reason why you set the Code Type to Both instead of Auto-JS? When you surround the code by triple `, it is properly displayed. You did not show the correctAns-column in the result-file which might help. How does a trial end? 400 ms is rather short for a RT-task. If you are not doing a simple detection this might be to short.

Best wishes Jens


BTW, trials.nTotal returns the number of trials in your loop. So, trials.nTotal + 1 will always be larger by 1 than trials.nTotal.

The attached toy-experiment finishes after 5 correct responses.
Score.psyexp (11.8 KB)
Score.xlsx (8.4 KB)

Best wishes Jens