﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Millisecond Forums » Millisecond Forums » Inquisit 6  » Presenting a random number of dots</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Sun, 28 Jun 2026 13:37:41 GMT</lastBuildDate><ttl>20</ttl><item><title>Presenting a random number of dots</title><link>https://forums.millisecond.com/Topic35785.aspx</link><description>G'day,&lt;br/&gt;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. &lt;br/&gt;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).&lt;br/&gt;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 &amp;lt;%%&amp;gt; code in this way. I can't figure out another way though.&lt;br/&gt; &lt;br/&gt;&amp;lt;trial dottrial&amp;gt;&lt;br/&gt;/ ontrialbegin = [list.dotlist.reset();&lt;br/&gt;&amp;nbsp; var i = 0; &lt;br/&gt;&amp;nbsp; while (i &amp;lt; values.selectnumber) {&lt;br/&gt;&amp;nbsp;&amp;nbsp;  shape.&amp;lt;%list.dotlist.nextvalue%&amp;gt;.color = white;&lt;br/&gt;&amp;nbsp;&amp;nbsp;  i += 1;&lt;br/&gt;&amp;nbsp; };&lt;br/&gt;]&lt;br/&gt;/ stimulusframes = [1 = dot1, dot2, dot3, dot4, dot5, dot6, dot7, dot8, dot9, dot10, dot11, dot12, dot13, dot14, dot15, dot16, dot17, dot18, dot19, dot20]&lt;br/&gt;/ validresponse = (57)&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;Could I get there with this approach? Or is this never going to work?</description><pubDate>Sat, 25 Nov 2023 10:16:35 GMT</pubDate><dc:creator>Lizzy</dc:creator></item><item><title>RE: Presenting a random number of dots</title><link>https://forums.millisecond.com/Topic35792.aspx</link><description>Thank you Dave, that solved the issue. I hadn't thought of the 'insertstimulusframe' function. Thanks so much for your help!!</description><pubDate>Sat, 25 Nov 2023 10:16:35 GMT</pubDate><dc:creator>Lizzy</dc:creator></item><item><title>RE: Presenting a random number of dots</title><link>https://forums.millisecond.com/Topic35787.aspx</link><description>&lt;blockquote data-id="35785" class="if-quote-wrapper" unselectable="on" data-guid="1700829950076" contenteditable="false" id="if_insertedNode_1700829949367"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="35785" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="35785" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="35785" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Lizzy - 11/24/2023&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-35785"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;G'day,&lt;br/&gt;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. &lt;br/&gt;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).&lt;br/&gt;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 &amp;lt;%%&amp;gt; code in this way. I can't figure out another way though.&lt;br/&gt; &lt;br/&gt;&amp;lt;trial dottrial&amp;gt;&lt;br/&gt;/ ontrialbegin = [list.dotlist.reset();&lt;br/&gt;&amp;nbsp; var i = 0; &lt;br/&gt;&amp;nbsp; while (i &amp;lt; values.selectnumber) {&lt;br/&gt;&amp;nbsp;&amp;nbsp;  shape.&amp;lt;%list.dotlist.nextvalue%&amp;gt;.color = white;&lt;br/&gt;&amp;nbsp;&amp;nbsp;  i += 1;&lt;br/&gt;&amp;nbsp; };&lt;br/&gt;]&lt;br/&gt;/ stimulusframes = [1 = dot1, dot2, dot3, dot4, dot5, dot6, dot7, dot8, dot9, dot10, dot11, dot12, dot13, dot14, dot15, dot16, dot17, dot18, dot19, dot20]&lt;br/&gt;/ validresponse = (57)&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;Could I get there with this approach? Or is this never going to work?&lt;a class="if-quote-goto quote-link" href="#" data-id="35785"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;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.&lt;br/&gt;&lt;br/&gt;[code]&amp;lt;trial dottrial&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;trial.dottrial.resetstimulusframes();&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;list.dotlist.reset();&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;values.selectnumber = round(rand(5, 20));&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var i = 0; &lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (i &amp;lt; values.selectnumber) {&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;trial.dottrial.insertstimulusframe(list.dotlist.nextvalue, 1);&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i += 1;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;};&lt;br/&gt;]&lt;br/&gt;/ stimulusframes = [1=clearscreen]&lt;br/&gt;/ validresponse = (57)&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;list dotlist&amp;gt;&lt;br/&gt;/ items = (shape.dot1, shape.dot2, shape.dot3, shape.dot4, shape.dot5, shape.dot6, shape.dot7, shape.dot8, shape.dot9, shape.dot10,&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;shape.dot11, shape.dot12, shape.dot13, shape.dot14, shape.dot15, shape.dot16, shape.dot17, shape.dot18, shape.dot19, shape.dot20)&lt;br/&gt;/ selectionmode = sequence&lt;br/&gt;/ selectionrate = always&lt;br/&gt;&amp;lt;/list&amp;gt;[/code]</description><pubDate>Fri, 24 Nov 2023 12:53:55 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>