Millisecond Forums

Response by Producing some dots

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

By nakayama - 10/14/2015

Hi, inquisit community,
I am wondering whether I can response to the stimuli by clicking some keyboard buttons (or one) which produce some unoverlapped red dots or shapes on the screen? Or maybe I should put a certain numbers of white dots on the screen first, and put them on red color by clicking some buttons?
Could you show me a sample script?
Thank you for your attention!
Nakayama
By Dave - 10/14/2015

Both is possible. But in order for me to give you a useful example, you need to provide more detail re. what you want to do.

The description

> I am wondering whether I can response to the stimuli by clicking some keyboard buttons (or one) which produce some
> unoverlapped red dots or shapes on the screen? Or maybe I should put a certain numbers of white dots on the screen first, and
> put them on red color by clicking some buttons?

is far too vague. How many are "some" dots? What do you want to happen once those dots are either drawn to the screen or colored red? What are "some" keyboard buttons, and what do you want each of those respective buttons to do?
By nakayama - 10/14/2015

Thank you for your quick response Dave!
If both is possible, I prefer the first one.
So participants response to the designated stimuli by tapping "space", so each click provides one red dot on the screen. The location of produced for Is random on the screen, and each dot is not overlapped by one another. The number of dots is controlled by how many times the space bar is clicked. Participants can click any times they want to make dots.
I hope this make sense. and Thank you in advance!
By Dave - 10/14/2015

To prevent dots from overlapping, you pretty much have to divide the screen into some sort of grid of X (however many) *potential* positions. As for there being no maximum, that is a problem. As the number of dots on-screen grows with each key press, at some point they'll have to overlap because there simply isn't any uninhabited space left. Imagine, for example, that a participant decides to draw several hundred dots to the screen.

You also need to allow for some kind of response that indicates the participant wants to *stop* drawing dots to the screen.

That said, here's an example that illustrates the gist of the above. Press the spacebar to draw a dot. Press the Escape key to erase the screen and start a new "trial". There are 3 such "trials" in the example.

<defaults>
/ canvasaspectratio = (1,1)
</defaults>

<values>
/ dotpos = 0
/ dotx = 0
/ doty = 0
/ dotcount = 0
/ jitterstep = 1%
</values>

<expt>
/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1-3=starttrial; ]
</block>

<trial starttrial>
/ ontrialbegin = [list.dotpos.reset(); values.dotx=-10%; values.doty=-10%; values.dotcount=0;]
/ stimulusframes = [1=clearscreen]
/ branch = [trial.drawdot]
/ trialduration = 0
</trial>

<trial drawdot>
/ ontrialend = [if(trial.drawdot.response==57) {
    values.dotcount+=1;
    values.dotpos=list.dotpos.nextvalue;
    values.dotx=list.x.item(values.dotpos)+(values.jitterstep*list.randomjitter.nextvalue);
    values.doty=list.y.item(values.dotpos)+(values.jitterstep*list.randomjitter.nextvalue);
    }
]
/ stimulusframes = [1=dot, debug]
/ validresponse = (57, 1)
/ branch = [if (trial.drawdot.response!=1) trial.drawdot]
</trial>

<shape dot>
/ shape = circle
/ color = red
/ size = (3%,3%)
/ hposition = values.dotx
/ vposition = values.doty
/ erase = false
</shape>

<shape clearscreen>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text debug>
/ items = ("Number of dots drawn: <%values.dotcount%>")
/ position = (50%, 2%)
/ erase = false
</text>


<list dotpos>
/ items = (1,2,3,4,5,6,7,8,
    9,10,11,12,13,14,15,16,
    17,18,19,20,21,22,23,24,
    25,26,27,28,29,30,31,32,
    33,34,35,36,37,38,39,40,
    41,42,43,44,45,46,47,48)
/ selectionrate = trial
</list>

<list randomjitter>
/ items = (-3,-2,-1, 1, 2, 3)
/ selectionrate = always
/ selectionmode = random
/ replace = true
</list>

<list x>
/ items = (6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%,
    6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%,
    6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%,
    6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%,
    6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%,
    6.25%, 18.75%, 31.25%, 43.75%, 56.25%, 68.75%, 81.25%, 93.75%)
</list>

<list y>
/ items = (8.33%, 8.33%, 8.33%, 8.33%, 8.33%, 8.33%, 8.33%, 8.33%,
    25.00%, 25.00%, 25.00%, 25.00%, 25.00%, 25.00%, 25.00%, 25.00%,
    41.67%, 41.67%, 41.67%, 41.67%, 41.67%, 41.67%, 41.67%, 41.67%,
    58.33%, 58.33%, 58.33%, 58.33%, 58.33%, 58.33%, 58.33%, 58.33%,
    75.00%, 75.00%, 75.00%, 75.00%, 75.00%, 75.00%, 75.00%, 75.00%,
    91.67%, 91.67%, 91.67%, 91.67%, 91.67%, 91.67%, 91.67%, 91.67%)
</list>
By Nakayama Yao - 10/14/2015

Thank you Dave. This script helps a lot!