| 
	Group: Forum MembersPosts: 26, 
    Visits: 105
 
 | 
                    
			            Thank you Dave, that solved the issue. I hadn't thought of the 'insertstimulusframe' function. Thanks so much for your help!!                
			            				
			            
 | 
			
        
				| 
	Group: AdministratorsPosts: 13K, 
    Visits: 109K
 
 | 
                    
			            +xG'day, I'm trying to set up a task where participants will see a cluster of dots on the left hand side of screen, and another cluster of dots on the right. The task is to indicate which cluster has more dots in it.  I want each trial to present a random number of dots (between 50 and 100) on one side. The other cluster will have x number of dots more or less than the first cluster (x will vary across trials to manipulate difficulty). My problem is that I can't figure out how to present a random number of dots. I've tried a few things but always get stuck somewhere. My latest idea was to always present the maximum number of dots (i.e. 100), and then try to make a small subset of them the same colour as the background, essentially making them go away. I've attached the script I tinkered with, which presents 20 dots on the left. The bit of code I tried to use in the trial element to make some of the dots white isn't working because clearly I can't use the <%%> code in this way. I can't figure out another way though.  <trial dottrial> / ontrialbegin = [list.dotlist.reset();   var i = 0;    while (i < values.selectnumber) {     shape.<%list.dotlist.nextvalue%>.color = white;     i += 1;   }; ] / stimulusframes = [1 = dot1, dot2, dot3, dot4, dot5, dot6, dot7, dot8, dot9, dot10, dot11, dot12, dot13, dot14, dot15, dot16, dot17, dot18, dot19, dot20] / validresponse = (57) </trial> Could I get there with this approach? Or is this never going to work? You should put all dot shapes in a list, figure out how many you want to present /ontrialbegin (e.g. draw a random value between min dots and max dots), then add the requisite number of dots to the trial's stimulus presentation sequence by using the insertstimulusframe() function in a loop. <trial dottrial>/ ontrialbegin = [
 trial.dottrial.resetstimulusframes();
 list.dotlist.reset();
 values.selectnumber = round(rand(5, 20));
 var i = 0;
 while (i < values.selectnumber) {
 trial.dottrial.insertstimulusframe(list.dotlist.nextvalue, 1);
 i += 1;
 };
 ]
 / stimulusframes = [1=clearscreen]
 / validresponse = (57)
 </trial>
 
 <list dotlist>
 / items = (shape.dot1, shape.dot2, shape.dot3, shape.dot4, shape.dot5, shape.dot6, shape.dot7, shape.dot8, shape.dot9, shape.dot10,
 shape.dot11, shape.dot12, shape.dot13, shape.dot14, shape.dot15, shape.dot16, shape.dot17, shape.dot18, shape.dot19, shape.dot20)
 / selectionmode = sequence
 / selectionrate = always
 </list>
 | 
			
        
				| 
	Group: Forum MembersPosts: 26, 
    Visits: 105
 
 | 
                    
			            G'day,I'm trying to set up a task where participants will see a cluster of dots on the left hand side of screen, and another cluster of dots on the right. The task is to indicate which cluster has more dots in it.
 I want each trial to present a random number of dots (between 50 and 100) on one side. The other cluster will have x number of dots more or less than the first cluster (x will vary across trials to manipulate difficulty).
 My problem is that I can't figure out how to present a random number of dots. I've tried a few things but always get stuck somewhere. My latest idea was to always present the maximum number of dots (i.e. 100), and then try to make a small subset of them the same colour as the background, essentially making them go away. I've attached the script I tinkered with, which presents 20 dots on the left. The bit of code I tried to use in the trial element to make some of the dots white isn't working because clearly I can't use the <%%> code in this way. I can't figure out another way though.
 
 <trial dottrial>
 / ontrialbegin = [list.dotlist.reset();
 var i = 0;
 while (i < values.selectnumber) {
 shape.<%list.dotlist.nextvalue%>.color = white;
 i += 1;
 };
 ]
 / stimulusframes = [1 = dot1, dot2, dot3, dot4, dot5, dot6, dot7, dot8, dot9, dot10, dot11, dot12, dot13, dot14, dot15, dot16, dot17, dot18, dot19, dot20]
 / validresponse = (57)
 </trial>
 
 Could I get there with this approach? Or is this never going to work?
 
 |