| Reference | Downloads | Github

Problem of feedback coding in IAT test

If this template helps then use it. If not then just delete and start from scratch.

win10 (e.g. Win10):
PsychoPy 3

What are you trying to achieve?:
I am not very familiar with builder. Here i want to achieve:
if the participant answers correctly, the experiment must continue to the next trial.
if they answer incorrectly, feedback appears an “X” in the screen and participant can not get into next until they choose the correct answer.

What did you try to make it work?:
Here I read
and here i attach my trial and code


What specifically went wrong when you tried that?:
The problem is that I inset the code but it does not work. It works just like without the code. I really hope anyone can help me I am quite new with Builder and my research can not advance more :pensive:.
Thanks a lot in advance.

This code is in the “Begin routine” tab, so it will run just once, before the subject has even had a chance to make a response.

There may be other issues with the code logic, but the key issue is to move the code to where it can actually have an effect (e.g. in the “Each frame” tab, so that it runs on every screen refresh during the trial).

Hi Micheal,
Thank you so much for your response. Now I tried to find the coding error and did some changes:
Begin Experiment:
End Rountine:
if resp1.keys:

thisExp.addData(‘rt’, rt)
thisExp.addData(‘corr’, corr)

Find attached the screenshots:

I read this openIAT resource: demos / OpenIAT · GitLab
Here I have some question:

a. Now the experiment can judge right or wrong answer, but what I need is that when the respondent chooses a wrong answer, he/she can not continue until he/she chooses the right answer.

b. If he/she chooses the right answer, the test goes directly to the next word.
I tried to code it, but it did not work.
I read this tip: Feedback depending on correctness of answer inside a trial
Could you give please me advice?
Thanks in advance.

I have done some changes in my test.
Begin Experiment:
Each frame:
if key_resp_part_1.keys: # ie if the list isn’t empty:
if key_resp_part_1.keys[-1] != respond: # check the latest response
elif key_resp_part_1.keys[-1] == respond: # check the latest response
msg=" "
if len(key_resp_part_1.rt)>1:
continueRoutine = False

But the problem is the code can not work. when the wrong answer is choosen, the respond “x” does not appear.
I do not know where i should change.