Millisecond Forums

Counter issue

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

By shareli - 1/28/2016

Dear all
I would like the participant to repeat the same task a few times if s/he wants to change a specific choice. Am using a block that picks randomly a picture. When I use the branch function to go back to he same block, it picks a different picture. I would like that a picture for that block will be picked randomly only on the fist time so that no matter how many times the participant goes back to the block later, s/he will get the same picture. Any way I tried to do it with the select function, it dis not work properly. 
Thanks 
Shlomo
By Dave - 1/28/2016

Pick an item number from a <counter> /onexptbegin, store it in a <values> entry. Use said value in the <picture> element's /select attribute.

<values>
/ pictureitem = 1
</values>

<expt>
/ onexptbegin = [values.pictureitem = counter.pictureitemnumbers.selectedvalue]
...
</expt>

<counter pictureitemnumbers>
/ items = (1,2,3)
/ select = noreplace
</counter>

<picture mypicture>
/ items = ("a.jpg", "b.jpg", "c.jpg")
/ select = values.pictureitem
</picture>

Alternatively, a less flexible option is to reference the <counter> directly in the <picture>'s /select attribute and set the <counter>'s /selectionrate to 'experiment'

<picture mypicture>
/ items = ("a.jpg", "b.jpg", "c.jpg")
/ select = pictureitemnumbers
</picture>

<counter pictureitemnumbers>
/ items = (1,2,3)
/ select = noreplace
/ selectionrate = experiment
/ resetinterval = 0
</counter>
By shareli - 1/28/2016

Dear Dave
Thank you very much
Shlomo