I am trying to implement a block feedback to show the participant their accuracy and mean RT.
I used the instructions given here: https://www.psychopy.org/recipes/builderFeedback.html
All runs well locally. However, when I try to run it online, it does not run. I believe this is because when I write the code below while having the Auto>JS selected in the code window, the conversion finds issues.
The code is (Practice is the name of the block that will provide the data for the feedback, it has 32 trials):
nCorr = Practice.data[‘response.corr’].sum()
pernCorr = (nCorr100)/32
meanRt = Practice.data[‘response.rt’].mean()
meanRt_1000 = meanRt1000
if pernCorr >= 80:
msg = ‘Good job!\n\nIn this block, you got %i percent of trials correct.\nYour reaction time= %i ms.\n\nPress space to continue.’ %(pernCorr,meanRt)
msg = ‘Pay attention!\n\nIn this block, you got %i percent of trials correct.\nRemember to get at least 80 percent of trials correct.\nYour reaction time= %i ms.\n\nPress space to continue.’ %(pernCorr,meanRt)
Then I get this: /* Syntax Error: Fix Python code */
If I delete this specific part “%(pernCorr,meanRt)” the conversion runs well, but of course I do not get the feedback values, only the message text. How can I solve this? I cannot find what the problem is because apparently adding “%(pernCorr,meanRt)” is correct in order to generate formatted strings…
I really appreciate the help.