psychopy.org | Reference | Downloads | Github

Creating randomized blocks from several condition files

I have 6 conditions, with 20 or 40 items in each condition. I need the conditions to be evenly distributed throughout the experiment, i.e. repeatedly sampling 1 or 2 items from each condition, presenting the selected items (in a randomized order), and then again sampling 1-2 new items from each condition (presenting these items, sampling again, and so on - until all items are used).

If i understand correctly, in an offline experiment this would be done by creating a python script that runs at the begging of the experiment, the script creates (and saves) a new items file, and then this item file is read in a loop.
How do I do this in an online experiment? can I save a file and read it?

I would also extremely appreciate any help with the script itself, since I don’t really know JavaScript…

Thanks!
Tal

In case anyone else needs a solution for this in the future:
I created a script (in JS) that runs at the beginning of the experiment and creates an array of row number (in an order based on the randomization I want), and then instead of creating an items file to feed into a loop I just fad the variable that holds the array into the ‘Selected rows’ option in the loop.
The sequence in which the row numbers appear in the array determines the presentation sequence, so there is no need to save an actual file.