Thanks, Dave. This is working half-perfectly. I am using pictures and sounds, and this code is working perfectly for the pictures, but something is going wrong with the sounds. I initially set the picture elements to "blank.jpg" and the sound elements to "silence.wav". In the trial element, I follow your strategy and randomly select a set of stimuli for each quadrant from the counter "Position". I then assign the picture and sound based on the random position. It's strange...the sounds that plays is always the initial sound set at the beginning (i.e., silence or a test sound), but my debug code shows the current sound item to be the correctly assigned filename. Is there something different with the way that sounds are processed that I am not aware of?
Create dummy picture and sound elements for each quadrant (Upper Left shown here)
<picture Pic_UL_pic>
/ items = ("BLANK.JPG")
/ position = (25, 25)
/ size = (20%, 20%)
</picture>
<sound Label_UL_snd>
/ items = ("silence.wav")
</sound>
Assign random positions
/ ontrialbegin = [values.UL = counter.position.selectedvalue;
values.UR = counter.position.selectedvalue;
values.LL = counter.position.selectedvalue;
values.LR = counter.position.selectedvalue]
Assign picture for Upper Left quadrant
/ ontrialbegin = [if(values.UL=="A") values.correct_pic=="Pic_UL_pic";
if(values.UL=="A") picture.Pic_UL_pic.item.1=getitem(item.Pic_A, values.Item_index);
if(values.UL=="B") picture.Pic_UL_pic.item.1=getitem(item.Pic_B, values.Item_index);
if(values.UL=="C") picture.Pic_UL_pic.item.1=getitem(item.Pic_C, values.Item_index);
if(values.UL=="D") picture.Pic_UL_pic.item.1=getitem(item.Pic_D, values.Item_index)]
Assign sound for Upper Left quadrant
/ ontrialbegin = [if(values.UL=="A") Sound.Label_UL_snd.item.1=getitem(item.Label_A, values.Item_index);
if(values.UL=="B") Sound.Label_UL_snd.item.1=getitem(item.Label_B, values.Item_index);
if(values.UL=="C") Sound.Label_UL_snd.item.1=getitem(item.Label_C, values.Item_index);
if(values.UL=="D") Sound.Label_UL_snd.item.1=getitem(item.Label_D, values.Item_index)]
The full code is attached.
Thanks,
Jeff