If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): Windows 11 home
PsychoPy version (e.g. 1.84.x): 2023.2.3
Standard Standalone? (y/n) If not then what?:Y
**What are you trying to achieve?:
Hi there - I have a task which shows you whether you can either win the answer to a question or a monetary amount if you click correctly between two stimuli. My experiment works well in giving a ‘correct’ or ‘incorrect’ response, which is great but I also need it to pull through the correct trivia answer from the spreadsheet linked to my loop.
my feedback routine has three elements in the loop - a code snippet which gives the correct/incorrect (working), a feedback text component and a trivia answer code snippet which is where I think my error may be.
What did you try to make it work?:
So far, I have insterted a code segment into my feedback called trivia answer and written the following code.
loop_data = Block_One.thisN
rew_type_value = Block_One.thisN[‘RewType’]
print(“RewType for current trial:”, rew_type_value)
if rew_type_value == ‘trivia’:
message = trivAns
text_color = ‘black’
else:
message = “”
text_color = ‘black’
I believe the issue could be with the [‘RewType’] so I’ve checked that my linked spreadsheet has a column called RewType.
What specifically went wrong when you tried that?:
This is the error I recieved which I belive is related to the type of information being incorrect. RewType is text data i.e. Money or Trivia.
Task\Study_1_Reward_Learning_Task_WORKING(Blue_Yellow)_lastrun.py", line 1061, in run
rew_type_value = Block_One.thisN[‘RewType’]
TypeError: ‘int’ object is not subscriptable
################ Experiment ended with exit code 1 [pid:17436] #################
thank you for any help in advance for a PyschoPy beginner