If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x):
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:
Hello I am trying to store a correct response in the results excel sheet. The program goes through a loop showing an image on each loop. The participant has to respond on the correct image. For example the loop is called trials_2 and currently psychopy stores a number for each iteration of the loop 0,1,2,3,4. I know that the correct answer is on the 3rd iteration of the loop.
What did you try to make it work?:
What I have tried in a number of different ways is adding code component into the routine within the loop (the loop only surrounds one routine). In this code component I tried something like this:
if trials_2==3 and key_resp_2 != None:
then after the loop ends I put a code component in later routine with somethign like:
if key_resp_2.corr != None:
trials.addData(‘Correct Hit’, 1)
trials.addData(‘Correct Hit’, 0)
What specifically went wrong when you tried that?:
This method does not work. There is currently no streamlined way of doing this in psychopy. I think a future model of psychopy would do well with a feature in the loop section settings where you can mark correct trials and it stores the data. For now though I am quite clueless how to implement this effectively. Thank you for your help and if need be I have attached my project file.
HL_ensemble_prestim.psyexp (2.5 KB)
Include pasted full error message if possible. “That didn’t work” is not enough information.