My corrective feedback is delayed

OS ( macOS Big Sur 11.5.2):
PsychoPy version (2021.1.4):
Standard Standalone? (y)
What are you trying to achieve?:
I am trying to add corrective feedback to the practice section of my aural lexical decision task. When participants press a key after hearing the stimulus, they should receive a message on the screen saying whether they answered correctly or not.

What did you try to make it work?:
I emulated the procedure from the stroopExtended demo experiment. The practice section of my task has a fixation point and sound, the aural stimuli, and the response. The keyboard input is labeled “prac_resp”. Here is the practice routine:

The feedback routine had a text component copied directly from the extendedStroop demo experiment:

In the the code component, I have written the following:
Begin Experiment
msg=’’
Begin Routine
if prac_resp.corr:#stored on last run routine
msg=“Correct”
else:
msg=“Incorrect”

What specifically went wrong when you tried that?:
The experiment worked, but the feedback is delayed by one item. For instance, the first item does not show any feedback. The second item showed feedback, but it was for the first item.

I have uploaded the PsychoPy file if it is helpful. Any help as to what I should do to rectify this problem will be greatly appreciated.

Thank you

Rob
ALDT Ver 1…psyexp (39.0 KB)

Hi @Rob_Kerrigan,

PsychoPy processes components from top to bottom. Therefore, you must make sure to place your code component above the text component that should display the output from the code component:

code

Jan

Hi Jan,

Thank you for your help. It now works perfectly.

Rob