Millisecond Forums

Seeking Advice for Random Image Presentation Script

https://forums.millisecond.com/Topic36297.aspx

By TBParis - 6/15/2024

Hello everyone, I don't really know how to start my script, so I am asking for your advice. I would like to present 10 images to participants only once for 1000 ms, with an interval of 1000 ms between each image as well. I would like these images to be presented in a random order.

But the real sticking point for me is that I want one image out of the 10 to be randomly selected and presented 5 times instead of just once, but still randomly among the others.
This makes a total of 14 presentations, with one image being repeated 5 times.

Does anyone have an idea of where to start?
Thank you :)
By Dave - 6/17/2024

TBParis - 6/15/2024
Hello everyone, I don't really know how to start my script, so I am asking for your advice. I would like to present 10 images to participants only once for 1000 ms, with an interval of 1000 ms between each image as well. I would like these images to be presented in a random order.

But the real sticking point for me is that I want one image out of the 10 to be randomly selected and presented 5 times instead of just once, but still randomly among the others.
This makes a total of 14 presentations, with one image being repeated 5 times.

Does anyone have an idea of where to start?
Thank you :)

<item picitems>
/ 1 = "image01.jpg"
/ 2 = "image02.jpg"
/ 3 = "image03.jpg"
/ 4 = "image04.jpg"
/ 5 = "image05.jpg"
/ 6 = "image06.jpg"
/ 7 = "image07.jpg"
/ 8 = "image08.jpg"
/ 9 = "image09.jpg"
/ 10 = "image10.jpg"
</item>

<list allitems>
/ poolsize = 10
/ selectionrate = always
</list>

<list picitemnumbers>
// maxrunsize = 1 // if you want to avoid consecutive presentations of the repeated item (if possible), set maxsrunsize to 1
</list>

<text pic>
/ items = picitems
/ select = values.picitemnumber
</text>

<trial pictrial>
/ ontrialbegin = [
    values.picitemnumber = list.picitemnumbers.nextvalue;
]

/ stimulustimes = [0=pic]
/ trialduration = 2000
/ posttrialpause = 1000
</trial>

<block picblock>
/ onblockbegin = [
    values.repeatpicitemnumber = list.allitems.nextindex; // pick one item number to be repeated
    var i = 0;
    // and add it to the item numbers list 5 times
    while (i < 5) {
        list.picitemnumbers.appenditem(values.repeatpicitemnumber);
        i += 1;
    };
    // then just add the remaining 9 item numbers to the list
    i = 0;
    while (i < 9) {
        list.picitemnumbers.appenditem(list.allitems.nextindex);
        i += 1;
    };
]
/ trials = [1-14 = trial.pictrial]
</block>

<values>
/ repeatpicitemnumber = 0
/ picitemnumber = 0
</values>
By TBParis - 6/18/2024

Hello Dave,

Thank you for your help ! It works very well :)
Have a nice day,