I am currently programming an Attention Network Task. After each trial, a blank screen is presented for a variable duration. The duration depends on the reaction time on the previous trial (left, right key to determine the direction of the arrows). More specifically, the duration of the blank screen will be 3.2s - the reaction time (which is 1.7ms max, or the routine will end so there will not be any negative durations). I have tried to add this feature using code component in the builder view:
if t >= 3.2 - key_resp_3.rt:
continueRoutine = wrong
and then added $t to the condition box for stop of the empty screen image. When running the experiment this error message comes up: TypeError: unsupported operand type(s) for -: ‘float’ and ‘list’
################ Experiment ended with exit code 1.
This sounds to me as if key_resp_3.rt is a list containing a number, which cannot be subtracted from a number. Maybe it’s enough to use key_resp_3.rt[0] instead. Also, use False, instead of wrong.
So, in sum
if t >= 3.2 - key_resp_3.rt[0]:
continueRoutine = False
Hi @ninaz, I just noticed that what I coded was not exactly what you were asking for. So just in case you did not notice I wanted to make you aware of it and edited the solution accordingly.