OS: Windows, presumably latest version
PsychoPy version (e.g. 1.84.x): 1.90.3
**What are you trying to achieve?: A two-alternative forced choice learning task with four conditions and probabilistic outcomes. I need to save those outcomes.
**What did you try to make it work?: I wrote the component below to generate and record the feedback. It generates feedback just fine. Now I need to save the content of the variable “outcome” in each trial. The text in the variable “msg” shows up in the log file. If I had enough time, or knew how to write R scripts, I might recover the data I need from there. I don’t know how to write R scripts, and I need to know the sum of outcomes as soon as the experiment is over, because people win money and will need to be paid. Is there any way I can tell PsychoPy in the _Builder to save this information?
In case the solution is to write Python code, I don’t know Python either, I wrote the code component by extrapolating from page 87 in the book. So I am hoping for a solution that can be implemented in Builder, so the student who needs that software doesn’t have to wait for me to learn Python.
if condition == '90pos':
if key_resp_2.corr:
if random() > 0.1:
msg = "Win!"
outcome = 1
else:
msg = "No change"
outcome = 0
else:
if random() > 0.9:
msg = "Win!"
outcome = 1
else:
msg = "No change"
outcome = 0
elif condition == '80pos':
if key_resp_2.corr:
if random() > 0.2:
msg = "Win!"
outcome = 1
else:
msg = "No change"
outcome = 0
else:
if random() > 0.8:
msg = "Win!"
outcome = 1
else:
msg = "No change"
outcome = 0
elif condition == '90neg':
if key_resp_2.corr:
if random() > 0.1:
msg = "No change"
outcome = 0
else:
msg = "Loss!"
outcome = -1
else:
if random() > 0.9:
msg = "No change"
outcome = 0
else:
msg = "Loss"
elif condition == '80neg':
if key_resp_2.corr:
if random() > 0.2:
msg = "No change"
outcome = 0
else:
msg = "Loss!"
outcome = -1
else:
if random() > 0.8:
msg = "No change"
outcome = 0
else:
msg = "Loss"
outcome = -1
else:
msg = "Error: PsychoPy doesn't know this condition.
Check the Excel file that lists the reward sensitivity pictures and conditions."