Online experiment feedback message not working

URL of experiment:

Description of the problem:

Hi, I am receiving an error message when providing a mouse response since adding a feedback component to my experiment.

I have set my mouse component to response. I have clicked the storecorrect and included corrAnsprac as the variable storing the correct response. This is also the name of the column in my Excel file (also included in the LOOP).

I included the Excel file with the correct answer and named the column as corrAnsprac.

I have included a code component in the same routine as the clickable stimuli at the very top. In the code component and in the end routine tabe I have included this code:

if response.clicked_name == corrAnsprac:
corr = 1
else :
corr = 0
thisExp.addData(‘Score’, corr)

Within the same loop routine for feedback I have included a code component in the

begin experiment tab I have included

msg = ‘’ ’

begin routine:

if corr == 1:
msg="Correct! "
else:
msg=“Incorrect”

My task is not working

Thanks

In your code snippet here

I believe it’s missing the indexing square brackets after clicked_name so the code should be

if response.clicked_name[0] == corrAnsprac:

Hi

Thank you, but this doesn’t work online because of the 0. I think it needs to be in the begin routine of a section of the code

Ah yes I wasn’t sure how your experiment was built so I just thought it was a basic syntax error. Here’s a demo where there’s a code in the trial component to check accuracy and another one in the feedback to show feedback
demo.psyexp (21.5 KB)
cond.xlsx (8.4 KB)