Setting a list and referencing it from a loop object
Hello,
I am pretty new to Open Sesame (and Python generally). I am trying to create a list, shuffled for each participants, then continuously reference it from different loops throughout the experiment. I need this so that an item which appeared in one block or trial type will be poped and not displayed again in another routine. I tried doing this with an inline in the beginning of the experiment (var.target = [1,2,3,4]) shuffle(var.tagret)) - but how do I get my experimental objects to recognize that [target] is a variable? it's not in the variable list.
I also tried, rather than using an inline, embedding my different loops within a bigger loop which contains this list - so that all my routines are contained within it and reference the same list - but this doesn't work either.
What would be the smartest simplest way to do this?
Additionally, I want to set [target] to be different depending on experimental condition. I tried to define this in an inline either in the beginning of the experiment, or within the loop which contains a table with [target] or contains [noun] and [verb] - which are the targets for the different groups - but none of these options work.
Again, there must be a super easy way I am missing
Here's what I tried:
if var.subject_nr%2 == 1:
var.group = 'verb'
else:
var.group = 'noun'
##define stimuli for group
if var.group == 'verb':
var.target = var.verb #var.verb could be defined through a list in the inline or a table, I tried both
var.dist = var.noun
else:
var.target = var.noun
var.dist = var.verb
Thanks in advance!!
Comments
Hi Naomi,
Did you manage to fix this by now?
This approach looks very reasonable (except the typo...). Can you test whether this works? So, just create a brief testing experiment and see whether you can access the list at a later stage in the script.
You could create a list per condition, and decide in the loop table which list should be accessed given a condition, e.g.
Does that make sense?
Eduard
I did manage to fix it by now, and have really learned tons in the past two weeks.
Thank you for your help!