Millisecond Forums

Randomizing item location and recording correct response

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

By Beth - 5/9/2017

Hi there - hoping to get some help with a coding problem I'm having.

I have my code set up so that two pictures are presented in one of two locations randomly and the picture from the first list is always the correct choice. I am hoping to record when they have made the correct choice (e.g. if the correct picture appeared on the left, they pressed "1", and if on the right they pressed "2").

However, two problems seem to be occurring when I introduce the "iscorrectresponse" element - 1) sometimes one of the shapes does not appear at all, or possibly underneath the other shape (this doesn't happen when the "iscorrectresponse" element is not there) and 2) the "iscorrectresponse" element is not working at all and no correct responses are being coded.

My code is below, any help is much appreciated - 

<trial Atrials>
/ stimulusframes = [1=ListA,wronglist]
/ validresponse = ("1", "2")
/ iscorrectresponse = [if(picture.ListA.hposition==40% && trial.Atrials.response=="1") if(picture.ListA.hposition==60% && trial.Atrials.response=="2")]
</trial>


<counter colorcounter>
/ items = (1,2)
/ select = noreplace
/ selectionrate = always
</counter>

<counter positioncounter>
/ items = (40%,60%)
/ select = noreplace
/ selectionrate = always
</counter>

<picture ListA>
/ items = ListA
/ select = colorcounter
/ hposition = counter.positioncounter.selectedvalue
/ size = (10%,10%)
/ vposition = 70%
</picture>

<picture wronglist>
/ items = ListB
/ select = colorcounter
/ hposition = counter.positioncounter.selectedvalue
/ size = (10%,10%)
/ vposition = 70%
</picture>



<item ListA>
/ 1 = "A.jpg"
/ 2 = "A.jpg"
/ 3 = "A.jpg"
/ 4 = "A.jpg"
/ 5 = "A.jpg"
/ 6 = "A.jpg"
/ 7 = "A.jpg"
/ 8 = "A.jpg"
/ 9 = "A.jpg"
/ 10 = "A.jpg"
/ 11 = "A.jpg"
/ 12 = "A.jpg"
/ 13 = "A.jpg"
</item>

<item ListB>
/ 2 = "B.jpg"
/ 3 = "C.jpg"
/ 4 = "D.jpg"
/ 5 = "E.jpg"
/ 6 = "F.jpg"
/ 7 = "G.jpg"
/ 8 = "H.jpg"
/ 9 = "I.jpg"
/ 10 = "J.jpg"
/ 11 = "K.jpg"
/ 12 = "L.jpg"
/ 13 = "M.jpg"
</item>

By Dave - 5/9/2017

Beth - Tuesday, May 9, 2017
Hi there - hoping to get some help with a coding problem I'm having.

I have my code set up so that two pictures are presented in one of two locations randomly and the picture from the first list is always the correct choice. I am hoping to record when they have made the correct choice (e.g. if the correct picture appeared on the left, they pressed "1", and if on the right they pressed "2").

However, two problems seem to be occurring when I introduce the "iscorrectresponse" element - 1) sometimes one of the shapes does not appear at all, or possibly underneath the other shape (this doesn't happen when the "iscorrectresponse" element is not there) and 2) the "iscorrectresponse" element is not working at all and no correct responses are being coded.

My code is below, any help is much appreciated - 

<trial Atrials>
/ stimulusframes = [1=ListA,wronglist]
/ validresponse = ("1", "2")
/ iscorrectresponse = [if(picture.ListA.hposition==40% && trial.Atrials.response=="1") if(picture.ListA.hposition==60% && trial.Atrials.response=="2")]
</trial>


<counter colorcounter>
/ items = (1,2)
/ select = noreplace
/ selectionrate = always
</counter>

<counter positioncounter>
/ items = (40%,60%)
/ select = noreplace
/ selectionrate = always
</counter>

<picture ListA>
/ items = ListA
/ select = colorcounter
/ hposition = counter.positioncounter.selectedvalue
/ size = (10%,10%)
/ vposition = 70%
</picture>

<picture wronglist>
/ items = ListB
/ select = colorcounter
/ hposition = counter.positioncounter.selectedvalue
/ size = (10%,10%)
/ vposition = 70%
</picture>



<item ListA>
/ 1 = "A.jpg"
/ 2 = "A.jpg"
/ 3 = "A.jpg"
/ 4 = "A.jpg"
/ 5 = "A.jpg"
/ 6 = "A.jpg"
/ 7 = "A.jpg"
/ 8 = "A.jpg"
/ 9 = "A.jpg"
/ 10 = "A.jpg"
/ 11 = "A.jpg"
/ 12 = "A.jpg"
/ 13 = "A.jpg"
</item>

<item ListB>
/ 2 = "B.jpg"
/ 3 = "C.jpg"
/ 4 = "D.jpg"
/ 5 = "E.jpg"
/ 6 = "F.jpg"
/ 7 = "G.jpg"
/ 8 = "H.jpg"
/ 9 = "I.jpg"
/ 10 = "J.jpg"
/ 11 = "K.jpg"
/ 12 = "L.jpg"
/ 13 = "M.jpg"
</item>


There are a number of minor (but consequential) syntax mistakes an other issues with your original code. I would recommend revising it along the following lines:

<values>
/ a_pos = 0%
/ wrong_pos = 0%
</values>


<block exampleblock>
/ trials = [1-4 = Atrials]
</block>

//numerical scancode for the "1" key (top of keyboard) is 2
//numerical scancode for the "2" key (top of keyboard) is 3
<trial Atrials>
/ ontrialbegin = [values.a_pos = counter.positioncounter.selectedvalue;
    values.wrong_pos = counter.positioncounter.selectedvalue;]
/ stimulusframes = [1=ListA,wronglist]
/ validresponse = (2, 3)
/ iscorrectresponse = [(values.a_pos==40% && trial.Atrials.response==2)
    || (values.a_pos==60% && trial.Atrials.response==3)]
</trial>

<counter colorcounter>
/ items = (1,2)
/ select = noreplace
/ selectionrate = always
</counter>

<counter positioncounter>
/ items = (40%,60%)
/ select = noreplace
/ selectionrate = always
</counter>

<picture ListA>
/ items = ListA
/ select = colorcounter
/ size = (10%,10%)
/ hposition = values.a_pos
/ vposition = 70%
</picture>

<picture wronglist>
/ items = ListB
/ select = colorcounter
/ hposition = values.wrong_pos
/ size = (10%,10%)
/ vposition = 70%
</picture>

<item ListA>
/ 1 = "A.jpg"
/ 2 = "A.jpg"
/ 3 = "A.jpg"
/ 4 = "A.jpg"
/ 5 = "A.jpg"
/ 6 = "A.jpg"
/ 7 = "A.jpg"
/ 8 = "A.jpg"
/ 9 = "A.jpg"
/ 10 = "A.jpg"
/ 11 = "A.jpg"
/ 12 = "A.jpg"
/ 13 = "A.jpg"
</item>

<item ListB>
/ 2 = "B.jpg"
/ 3 = "C.jpg"
/ 4 = "D.jpg"
/ 5 = "E.jpg"
/ 6 = "F.jpg"
/ 7 = "G.jpg"
/ 8 = "H.jpg"
/ 9 = "I.jpg"
/ 10 = "J.jpg"
/ 11 = "K.jpg"
/ 12 = "L.jpg"
/ 13 = "M.jpg"
</item>


By Beth - 5/9/2017

Dave - Tuesday, May 9, 2017
Beth - Tuesday, May 9, 2017
Hi there - hoping to get some help with a coding problem I'm having.

I have my code set up so that two pictures are presented in one of two locations randomly and the picture from the first list is always the correct choice. I am hoping to record when they have made the correct choice (e.g. if the correct picture appeared on the left, they pressed "1", and if on the right they pressed "2").

However, two problems seem to be occurring when I introduce the "iscorrectresponse" element - 1) sometimes one of the shapes does not appear at all, or possibly underneath the other shape (this doesn't happen when the "iscorrectresponse" element is not there) and 2) the "iscorrectresponse" element is not working at all and no correct responses are being coded.

My code is below, any help is much appreciated - 

<trial Atrials>
/ stimulusframes = [1=ListA,wronglist]
/ validresponse = ("1", "2")
/ iscorrectresponse = [if(picture.ListA.hposition==40% && trial.Atrials.response=="1") if(picture.ListA.hposition==60% && trial.Atrials.response=="2")]
</trial>


<counter colorcounter>
/ items = (1,2)
/ select = noreplace
/ selectionrate = always
</counter>

<counter positioncounter>
/ items = (40%,60%)
/ select = noreplace
/ selectionrate = always
</counter>

<picture ListA>
/ items = ListA
/ select = colorcounter
/ hposition = counter.positioncounter.selectedvalue
/ size = (10%,10%)
/ vposition = 70%
</picture>

<picture wronglist>
/ items = ListB
/ select = colorcounter
/ hposition = counter.positioncounter.selectedvalue
/ size = (10%,10%)
/ vposition = 70%
</picture>



<item ListA>
/ 1 = "A.jpg"
/ 2 = "A.jpg"
/ 3 = "A.jpg"
/ 4 = "A.jpg"
/ 5 = "A.jpg"
/ 6 = "A.jpg"
/ 7 = "A.jpg"
/ 8 = "A.jpg"
/ 9 = "A.jpg"
/ 10 = "A.jpg"
/ 11 = "A.jpg"
/ 12 = "A.jpg"
/ 13 = "A.jpg"
</item>

<item ListB>
/ 2 = "B.jpg"
/ 3 = "C.jpg"
/ 4 = "D.jpg"
/ 5 = "E.jpg"
/ 6 = "F.jpg"
/ 7 = "G.jpg"
/ 8 = "H.jpg"
/ 9 = "I.jpg"
/ 10 = "J.jpg"
/ 11 = "K.jpg"
/ 12 = "L.jpg"
/ 13 = "M.jpg"
</item>


There are a number of minor (but consequential) syntax mistakes an other issues with your original code. I would recommend revising it along the following lines:

<values>
/ a_pos = 0%
/ wrong_pos = 0%
</values>


<block exampleblock>
/ trials = [1-4 = Atrials]
</block>

//numerical scancode for the "1" key (top of keyboard) is 2
//numerical scancode for the "2" key (top of keyboard) is 3
<trial Atrials>
/ ontrialbegin = [values.a_pos = counter.positioncounter.selectedvalue;
    values.wrong_pos = counter.positioncounter.selectedvalue;]
/ stimulusframes = [1=ListA,wronglist]
/ validresponse = (2, 3)
/ iscorrectresponse = [(values.a_pos==40% && trial.Atrials.response==2)
    || (values.a_pos==60% && trial.Atrials.response==3)]
</trial>

<counter colorcounter>
/ items = (1,2)
/ select = noreplace
/ selectionrate = always
</counter>

<counter positioncounter>
/ items = (40%,60%)
/ select = noreplace
/ selectionrate = always
</counter>

<picture ListA>
/ items = ListA
/ select = colorcounter
/ size = (10%,10%)
/ hposition = values.a_pos
/ vposition = 70%
</picture>

<picture wronglist>
/ items = ListB
/ select = colorcounter
/ hposition = values.wrong_pos
/ size = (10%,10%)
/ vposition = 70%
</picture>

<item ListA>
/ 1 = "A.jpg"
/ 2 = "A.jpg"
/ 3 = "A.jpg"
/ 4 = "A.jpg"
/ 5 = "A.jpg"
/ 6 = "A.jpg"
/ 7 = "A.jpg"
/ 8 = "A.jpg"
/ 9 = "A.jpg"
/ 10 = "A.jpg"
/ 11 = "A.jpg"
/ 12 = "A.jpg"
/ 13 = "A.jpg"
</item>

<item ListB>
/ 2 = "B.jpg"
/ 3 = "C.jpg"
/ 4 = "D.jpg"
/ 5 = "E.jpg"
/ 6 = "F.jpg"
/ 7 = "G.jpg"
/ 8 = "H.jpg"
/ 9 = "I.jpg"
/ 10 = "J.jpg"
/ 11 = "K.jpg"
/ 12 = "L.jpg"
/ 13 = "M.jpg"
</item>



Thanks so much - it's working!