OS (e.g. Win10): Win 10
PsychoPy version (e.g. 1.84.x): v2022.2.2
**Standard Standalone? (y/n): Yes
I have a loop which runs 3 times over a list of 4 excel spreadsheets (12 different files nested in 3 files corresponding to the runs) in a counterbalance experiment. At the end of the trial the answer is stored and a trigger is sent. My problem is that I store the answer in a variable and set it with value 0 at the beginning of the experiment in order to provide feedback and at the end of the routine, this variable increases by 1. So in run 1 the feedback is correct, but in the second and third are wrong. I assume that is because the variable that stores the answer is not set in 0 again. I would like to create 3 different variables depending on the run (1, 2 or 3) without creating a new routine.
begin experiment tab: var_store_correct = 0 var_store_total = 0 end routine tab #check for correct answer if m_vo_t1.leftButton==corrAns: port.write(tCorr) answer = 1 var_store_correct+= 1 else: port.write(tInc) answer = 0 var_store_correct += 0 #append the value of correct or incorrect thisExp.addData('ans_vo1', answer) #update variable for trials and correct responses var_store_total += 1 # this is called in a feedback routine ``` At the end I would like to have var_store_total_0, var_store_total_1, var_store_total,2, var_store_correct_0, var_store_correct_1, var_store_correct_0 and, ans_vo1_0, ans_vo1_1, ans_vo1_2