I think you might want to move your current code snippet into the “End Routine” tab. Because you won’t know which key was pressed until the end of the routine. Then add a seperate “feedback” routine within your “animals_01” loop but following your “trial” routine, add a text component in the feedback routine and set the text parameter in that component as $response.
thanks a lot for the reply. I could fix the code somewhat but not completely yet (I needed to change my Text component to “set every repeat”).
The response variable is being changed now.
I am still facing some problems, but I am getting there.