[solved] Referring only to one column of a loop
Hello!
I'm using nested loops, so that cells in the main loop contains variables that refers to specific column
in the nested loop:
The idea (and what I need to have) is that one picture of the column is chosen randomly and than I return to the main loop,
so something like this:
(every color represent one trial):
But in practice, every time the nested loop is referred to, it goes through all the columns before getting back to the main loop:
Is there any way to avoid it? I have 32 columns and I need to add even more...
Any insight will be really helpful! (-:
P.S here is a link to the file, if that helps:
https://www.dropbox.com/s/jpr9b0fesefyk83/Ordinalitysymbolic.opensesame?dl=0
Tali

Comments
Hi Tali,
every
loopitem has abreak ifargument. There you can add something like:[count_nested_loop] >0.OpenSesame has built in variables that count how often each item was called. If I remember right, the general shape is "count_NameOfItem", you can check the it in your
logger.Does this help?
Good luck,
Eduard
Hi Eduard
Thank you for your help!
I tried what you suggested: in my nested practice loop (in break if)
I wrote:[count_Nested_practice] >0
Now, I get only 2 trials (the picture that was chosen from the nested and the picture from the column to the right), and then the practice ends...
What am I doing wrong?
Thanks again!
Tali
Mh, I'm not sure about the exact sequence, in which these variables are written. I suppose if this happens in the end of an iteration, the first loop is 0th trial, so, the next trial will start, too. Now, the counter reaches 1, corresponding to the 2nd trial, so that no more trials are started.
Anyway, the exact reasoning is not really important here, just set
[count_Nested_practice] =0and you should be fine ( I hope).Eduard
Hello again (-:
I tried this too, and it doesn't get out of the practice after 2 trials,
but with or without "break if" I get the same result:
The nested loop is sampled twice (from tasted columns) and only then returns to the main list...
Here is the experiment if you want to see how it looks...
https://www.dropbox.com/s/jpr9b0fesefyk83/Ordinalitysymbolic.opensesame?dl=0
Thank you!
Tali
Hi Tali,
In case you can't work around this problem, you could also simply put all the picture names in a list, and then use random.shuffle(list) and list.pop[0] to take one picture every time you go through your main loop.
Good luck!
Cheers,
Josh
Hi Josh
Thank you for your suggestion!
The problem is that I will have to create 32 different lists and use shuffle for each one of them... and while doing it I can make mistakes... That's why I preferred to use loops
Hi Tali,
If the strategy with using the built-in counters doesn't work, you can always create your own counters and make sure that they do work. So, in the beginning of your experiment (or in the outer loop), you set a trial_counter to 0. Later, when you're in the nested_loop, you can increment it to 1 or break it right away. This you should do from within an
inline_script. Alternatively, you can also leave theloopitem untouched and add thisbreakstatement as last element in the nested sequence. In doing so, it will also not run more than once.Do you understand what I mean?
Btw. I think, you have a few nested sequences too much in your experiment. Maybe you should check, whether you can remove some of them to make the experiment less complicated.
Good luck,
Eduard
Thank you Eduard! I'll try that!
Hi!
With the help of Yoni Melman we found a way to have a
nested that is very similar to that of E-prime:
In this example, in the main loop we wanted to define the font size as a variable.

So we wrote the name of the variable within []:
Then, the nested table will have a column by that name:

To allow font size to change as variable, in the "Target" sketchpad we edit the script so the font size will be the variable [Fs]:

(This is only an example, but it is possible to use more columns for more variables)
Some steps to make sure that the nested loop will only be sampled once:
In the "run" section of "flag_down" write:
self.experiment.set("flag",0)
in the "run" section of "flag_up" write:
self.experiment.set("flag",1)
in the "nested-loop", check "show advanced options" (see picture above) and under "break if" write: [flag]=1
Here is a link to the file:
https://www.dropbox.com/s/wvenrkre52tmtpq/nested.opensesame?dl=0
Hi Tali,
Thanks for sharing!
Eduard
Hi all,
I noticed that some of the images in this discussion appear to be gone. Is there any way to retrieve them, as I'm very interested in the solution Tali proposed.
Kind regards,
Kerwin
Hi @kolfers ,
Unfortunately not 😕 Some images (and attachments) got permanently lost in some server issues some time ago. Unless, of course @labovich still has them.
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!