Code works locally but not online

URL of experiment:

Description of the problem:
In my experiment, participants will be presented an image. If that image has a green or red frame then participants should press ‘s’ but if that image has a grey frame then they should press ’ l’.

In my data file,
I must see ‘1 ’ if correct answer is s and participant’ s response is s
’ 1’ if correct answer is l and participant’s response is l

But I must see ‘0’ if correct answer is s but participant’s response is l
‘0’ if correct answer is l but participant’ s response is s

I added a code on Each Frame tab. Even though it works locally, it doesn’t work on Pavlovia. What can I do to solve this problem?

Thank you so much!

Why is your code in Each Frame rather than End Routine?


why do you code this yourself? You could store the correct key in an Excel-file, check the key-property Store correct of your key-component and specify the Excel column-name that contains the correct key.

BTW, the code should work if you put it in the End routine tab as suggested by @wakecarter

Best wishes Jens

Thank you so much for your reply. I put it in the End routine tab but it still does not work.

Thank you so much for replying quickly. I coded by myself because I did not how to do it by creating an Excel file.

Even though I put it in the End Routine tab, it still doesn’t work.

Hello belce,

if you want to use an Excel instead precede in the following manner:

Imagine an experiment in which the participants are asked to press one of two buttons: f & j

as shown in the picture above. Check Store correct and insert the proper column header of your Excelfile. You don’t have to name it correct as I did in this example. Choose a name that suits you.

Surround your routine by a loop


and specify the Excelfile that you plan to use:



is not sufficient as an answer. Is nothing stored? Do you get only 1 or 0 in your result file?

Best wishes Jens