Millisecond Forums

Iscorrectresponse and drogtargets elements

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

By Beth - 4/25/2018

Hi - I am just trying to work out how to code a correct response for when a certain dropsource is put into a certain droptarget (for example, if "picture A" was in pos1, and "picture B" was in pos2). Is there a way to code multiple correct responses for each time a specific dropsource is placed in the correct droptarget within the same trial?

Thanks in advance.


<trial trial>
/ stimulustimes = [0 = pos1,pos2,pos3,pos4,pos5,pos6,A,B,C,D,E,F]
/ inputdevice = dragdrop
</trial>

<picture A>
/ items = ("A.jpg")
/ position = (25,20)
/ dropsource = true
</picture>

<picture B>
/ items = ("B.jpg")
/ position = (35,20)
/ dropsource = true
</picture>

<picture C>
/ items = ("C.jpg")
/ position = (45,20)
/ dropsource = true
</picture>

<picture D>
/ items = ("D.jpg")
/ position = (55,20)
/ dropsource = true
</picture>

<picture E>
/ items = ("F.jpg")
/ position = (65,20)
/ dropsource = true
</picture>

<picture F>
/ items = ("F.jpg")
/ position = (75,20)
/ dropsource = true
</picture>



<shape pos1>
/ hposition = 25
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos2>
/ hposition = 35
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos3>
/ hposition = 45
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos4>
/ hposition = 55
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos5>
/ hposition = 65
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos6>
/ hposition = 75
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>





By Dave - 4/25/2018

Beth - Wednesday, April 25, 2018
Hi - I am just trying to work out how to code a correct response for when a certain dropsource is put into a certain droptarget (for example, if "picture A" was in pos1, and "picture B" was in pos2). Is there a way to code multiple correct responses for each time a specific dropsource is placed in the correct droptarget within the same trial?

Thanks in advance.


<trial trial>
/ stimulustimes = [0 = pos1,pos2,pos3,pos4,pos5,pos6,A,B,C,D,E,F]
/ inputdevice = dragdrop
</trial>

<picture A>
/ items = ("A.jpg")
/ position = (25,20)
/ dropsource = true
</picture>

<picture B>
/ items = ("B.jpg")
/ position = (35,20)
/ dropsource = true
</picture>

<picture C>
/ items = ("C.jpg")
/ position = (45,20)
/ dropsource = true
</picture>

<picture D>
/ items = ("D.jpg")
/ position = (55,20)
/ dropsource = true
</picture>

<picture E>
/ items = ("F.jpg")
/ position = (65,20)
/ dropsource = true
</picture>

<picture F>
/ items = ("F.jpg")
/ position = (75,20)
/ dropsource = true
</picture>



<shape pos1>
/ hposition = 25
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos2>
/ hposition = 35
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos3>
/ hposition = 45
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos4>
/ hposition = 55
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos5>
/ hposition = 65
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos6>
/ hposition = 75
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>






> I am just trying to work out how to code a correct response for when a certain dropsource is put into a certain droptarget
> (for example, if "picture A" was in pos1, and "picture B" was in pos2).

I don't quite understand how you wish the trial to behave based on that description. Could you please provide a more detailed explanation? As in: Which objects and how many objects are supposed to be dropped where to be considered a correct response and how is the trial supposed to behave otherwise (i.e. what is an "incorrect" but valid response)?
By Beth - 4/25/2018

Hi Dave,

Thanks for your reply. Sorry, the code I may have posted was a simplistic version of the actual code. I am hoping participants will be able to rank 6 out of 12 possible shapes (A-L) and it will code for the correct response (for example, A in pos1, B in pos2, C in pos3, D in pos4, E in pos5, F pos6). Any other shapes in a box, or one of the correct 6 in the wrong box would be an incorrect response.

<trial trial>
/ stimulustimes = [0 = pos1,pos2,pos3,pos4,pos5,pos6,A,B,C,D,E,F,G,H,I,J,K,L,posrep1,posrep2,posrep3,posrep4,posrep5,posrep6,posrep2_1,posrep2_2,posrep2_3,posrep2_4,posrep2_5,posrep2_6
]
/ inputdevice = dragdrop
/ timeout = 100000000000
</trial>


<picture A>
/ items = ("A.jpg")
/ position = (25,20)
/ dropsource = true
</picture>

<picture B>
/ items = ("B.jpg")
/ position = (35,20)
/ dropsource = true
</picture>

<picture C>
/ items = ("C.jpg")
/ position = (45,20)
/ dropsource = true
</picture>

<picture D>
/ items = ("D.jpg")
/ position = (55,20)
/ dropsource = true
</picture>

<picture E>
/ items = ("E.jpg")
/ position = (65,20)
/ dropsource = true
</picture>

<picture F>
/ items = ("F.jpg")
/ position = (75,20)
/ dropsource = true
</picture>


<picture G>
/ items = ("G.jpg")
/ position = (25,40)
/ dropsource = true
</picture>

<picture H>
/ items = ("H.jpg")
/ position = (35,40)
/ dropsource = true
</picture>

<picture I>
/ items = ("I.jpg")
/ position = (45,40)
/ dropsource = true
</picture>

<picture J>
/ items = ("J.jpg")
/ position = (55,40)
/ dropsource = true
</picture>

<picture K>
/ items = ("E.jpg")
/ position = (65,40)
/ dropsource = true
</picture>

<picture L>
/ items = ("L.jpg")
/ position = (75,40)
/ dropsource = true
</picture>



<shape pos1>
/ hposition = 25
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos2>
/ hposition = 35
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos3>
/ hposition = 45
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos4>
/ hposition = 55
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos5>
/ hposition = 65
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos6>
/ hposition = 75
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>



<shape posrep1>
/ hposition = 25
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2>
/ hposition = 35
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep3>
/ hposition = 45
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep4>
/ hposition = 55
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep5>
/ hposition = 65
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep6>
/ hposition = 75
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>


<shape posrep2_1>
/ hposition = 25
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_2>
/ hposition = 35
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_3>
/ hposition = 45
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_4>
/ hposition = 55
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_5>
/ hposition = 65
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_6>
/ hposition = 75
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>


By Dave - 4/25/2018

Beth - Wednesday, April 25, 2018
Hi Dave,

Thanks for your reply. Sorry, the code I may have posted was a simplistic version of the actual code. I am hoping participants will be able to rank 6 out of 12 possible shapes (A-L) and it will code for the correct response (for example, A in pos1, B in pos2, C in pos3, D in pos4, E in pos5, F pos6). Any other shapes in a box, or one of the correct 6 in the wrong box would be an incorrect response.

<trial trial>
/ stimulustimes = [0 = pos1,pos2,pos3,pos4,pos5,pos6,A,B,C,D,E,F,G,H,I,J,K,L,posrep1,posrep2,posrep3,posrep4,posrep5,posrep6,posrep2_1,posrep2_2,posrep2_3,posrep2_4,posrep2_5,posrep2_6
]
/ inputdevice = dragdrop
/ timeout = 100000000000
</trial>


<picture A>
/ items = ("A.jpg")
/ position = (25,20)
/ dropsource = true
</picture>

<picture B>
/ items = ("B.jpg")
/ position = (35,20)
/ dropsource = true
</picture>

<picture C>
/ items = ("C.jpg")
/ position = (45,20)
/ dropsource = true
</picture>

<picture D>
/ items = ("D.jpg")
/ position = (55,20)
/ dropsource = true
</picture>

<picture E>
/ items = ("E.jpg")
/ position = (65,20)
/ dropsource = true
</picture>

<picture F>
/ items = ("F.jpg")
/ position = (75,20)
/ dropsource = true
</picture>


<picture G>
/ items = ("G.jpg")
/ position = (25,40)
/ dropsource = true
</picture>

<picture H>
/ items = ("H.jpg")
/ position = (35,40)
/ dropsource = true
</picture>

<picture I>
/ items = ("I.jpg")
/ position = (45,40)
/ dropsource = true
</picture>

<picture J>
/ items = ("J.jpg")
/ position = (55,40)
/ dropsource = true
</picture>

<picture K>
/ items = ("E.jpg")
/ position = (65,40)
/ dropsource = true
</picture>

<picture L>
/ items = ("L.jpg")
/ position = (75,40)
/ dropsource = true
</picture>



<shape pos1>
/ hposition = 25
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos2>
/ hposition = 35
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos3>
/ hposition = 45
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos4>
/ hposition = 55
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos5>
/ hposition = 65
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos6>
/ hposition = 75
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>



<shape posrep1>
/ hposition = 25
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2>
/ hposition = 35
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep3>
/ hposition = 45
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep4>
/ hposition = 55
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep5>
/ hposition = 65
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep6>
/ hposition = 75
/ vposition = 20
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>


<shape posrep2_1>
/ hposition = 25
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_2>
/ hposition = 35
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_3>
/ hposition = 45
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_4>
/ hposition = 55
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_5>
/ hposition = 65
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_6>
/ hposition = 75
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>



Thanks for the clarification. Basically, you'll need to do much the same thing as the Tower of London script does:
https://www.millisecond.com/download/library/v5/toweroflondon/toweroflondon.iqzip

You need basically need to loop your trial continuously until all boxes have been occupied, updating whether a given box is still "free" / empty from trial to trial. In the ToL script linked above, most of that work happens in <trial choice>. As for changing a box's droptarget status, see the /available_a_slots, /available_b_slots and /available_c_slots <expressions> and the values involved.

Once all are occupied, you evaluate the end state and determine whether the ranking is correct, much like the ToL script determines whether the state produced by the participant matches the "target" state (cf. expressions.targetachieved).

Does that make sense?
By Beth - 4/25/2018

Okay, great, thanks. I was also just wondering, at the very least, how to get it to output the record of where each participant had put each shape in the results file? It doesn't seem to be recording it by default at the moment.
By Dave - 4/25/2018

Beth - Wednesday, April 25, 2018
Okay, great, thanks. I was also just wondering, at the very least, how to get it to output the record of where each participant had put each shape in the results file? It doesn't seem to be recording it by default at the moment.

You should be able to get that by logging the respective object's horizontal and vertical position (available per the hposition and vposition properties) as in

<data>
/ columns = (..., picture.a.hposition, picture.a.vposition, picture.b.hposition, picture.b.vposition, ...)
...
</data>

By Beth - 4/25/2018

Great - thank you~! That should suffice.

Just couple more things (sorry!)
1) Is there a way to make sure they can't put more than one dropsource on one droptarget?
2) is there a way to make sure they can't progress from the trial until all the droptargets have been filled with one dropsource?
By Dave - 4/25/2018

Beth - Wednesday, April 25, 2018
Great - thank you~! That should suffice.

Just couple more things (sorry!)
1) Is there a way to make sure they can't put more than one dropsource on one droptarget?
2) is there a way to make sure they can't progress from the trial until all the droptargets have been filled with one dropsource?

> 1) Is there a way to make sure they can't put more than one dropsource on one droptarget?

Yes.

> 2) is there a way to make sure they can't progress from the trial until all the droptargets have been filled with one dropsource?

Yes.

The ToL script essentially does both of these things (the expressions and logic in <trial choice> referenced in my previous reply takes care of that), but let me code up a toy example for you based on your code, give me half an hour or so.
By Dave - 4/25/2018

Dave - Wednesday, April 25, 2018
Beth - Wednesday, April 25, 2018
Great - thank you~! That should suffice.

Just couple more things (sorry!)
1) Is there a way to make sure they can't put more than one dropsource on one droptarget?
2) is there a way to make sure they can't progress from the trial until all the droptargets have been filled with one dropsource?

> 1) Is there a way to make sure they can't put more than one dropsource on one droptarget?

Yes.

> 2) is there a way to make sure they can't progress from the trial until all the droptargets have been filled with one dropsource?

Yes.

The ToL script essentially does both of these things (the expressions and logic in <trial choice> referenced in my previous reply takes care of that), but let me code up a toy example for you based on your code, give me half an hour or so.

Here's a quick sketch:

<block myblock>
/ trials = [1-2=start]
</block>

// expressions determine whether a box is available as a drop target (empty) or not (full)
<expressions>
/ available_p1_slots = (1-values.p1_count)
/ available_p2_slots = (1-values.p2_count)
/ available_p3_slots = (1-values.p3_count)
</expressions>

<values>
/ p1_count = 0
/ p2_count = 0
/ p3_count = 0
</values>

// starts a new round
// sets the values "counting" whether a box is occupied or not back to zero
// places the objects A to F in their original start positions
<trial start>
/ ontrialbegin = [
values.p1_count=0;
values.p2_count=0;
values.p3_count=0;
text.A.hposition = 25%;
text.A.vposition = 20%;
text.B.hposition = 35%;
text.B.vposition = 20%;
text.C.hposition = 45%;
text.C.vposition = 20%;
text.D.hposition = 55%;
text.D.vposition = 20%;
text.E.hposition = 65%;
text.E.vposition = 20%;
text.F.hposition = 75%;
text.F.vposition = 20%;
]
/ branch = [
    trial.mytrial
]
/ trialduration = 0
</trial>

// this trial is looped until all boxes are occupied with exactly one item
<trial mytrial>
/ ontrialbegin = [

shape.pos1.droptarget = expressions.available_p1_slots;
shape.pos2.droptarget = expressions.available_p2_slots;
shape.pos3.droptarget = expressions.available_p3_slots;

]
/ stimulustimes = [0 = pos1,pos2,pos3,A,B,C,D,E,F]
/ validresponse = (pos1,pos2,pos3)
/ isvalidresponse = [
if (trial.mytrial.response == "pos1")
{
    values.p1_count += 1;
    shape.pos1.droptarget;
}
else if (trial.mytrial.response == "pos2")
{
    values.p2_count += 1;
    shape.pos2.droptarget;
}
else if (trial.mytrial.response == "pos3")
{
    values.p3_count += 1;
    shape.pos3.droptarget;
}
else
    true;
]
/ inputdevice = dragdrop
/ branch = [
    if (values.p1_count + values.p2_count + values.p3_count >= 3) trial.end else trial.mytrial
]
</trial>

// this trial is invoked when all boxes have been filled
// any evaluation of the "correctness" would happen here
<trial end>
/ stimulusframes = [1=endtext]
/ validresponse = (57)
</trial>

<text endtext>
/ items = ("All boxes filled.")
</text>

<text A>
/ items = ("A.jpg")
/ position = (25,20)
/ dropsource = true
</text>

<text B>
/ items = ("B.jpg")
/ position = (35,20)
/ dropsource = true
</text>

<text C>
/ items = ("C.jpg")
/ position = (45,20)
/ dropsource = true
</text>

<text D>
/ items = ("D.jpg")
/ position = (55,20)
/ dropsource = true
</text>

<text E>
/ items = ("F.jpg")
/ position = (65,20)
/ dropsource = true
</text>

<text F>
/ items = ("F.jpg")
/ position = (75,20)
/ dropsource = true
</text>


<shape pos1>
/ hposition = 25
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos2>
/ hposition = 35
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos3>
/ hposition = 45
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos4>
/ hposition = 55
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos5>
/ hposition = 65
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos6>
/ hposition = 75
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

By Beth - 4/25/2018

Thanks very much for all your help!
By Beth - 4/26/2018

Hi Dave - thanks very much for your help yesterday. I've adapted the code to fit my full stimulus set and it seems to be mostly working, except that sometimes it will end the trial before all the droptargets have been filled and sometimes it won't (e.g. if you move the same shape to a different droptarget 4 times, it will randomly end without all the boxes being filled). Is there any way to have an option to just have participants press a key or button when they are happy with the order in the droptargets?

Thanks in advance. code below.

<block myblock>
/ trials = [1=start]
</block>

<data>
/ columns = (date,time,group,subject,build,blocknum,trialnum,blockcode,trialcode,pretrialpause,posttrialpause,trialduration,trialtimeout,response,correct,latency,stimulusnumber1,stimulusitem1,stimulusonset1,stimulusnumber2,stimulusitem2,stimulusonset2,stimulusnumber3,stimulusitem3,stimulusonset3,stimulusnumber4,stimulusitem4,stimulusonset4,stimulusnumber5,stimulusitem5,stimulusonset5,stimulusnumber6,stimulusitem6,stimulusonset6,stimulusnumber7,stimulusitem7,stimulusonset7,stimulusnumber8,stimulusitem8,stimulusonset8,stimulusnumber9,stimulusitem9,stimulusonset9
,picture.a.hposition, picture.a.vposition, picture.b.hposition, picture.b.vposition)
</data>

<trial mytrial>

/ ontrialbegin = [

shape.pos1.droptarget = expressions.available_p1_slots;
shape.pos2.droptarget = expressions.available_p2_slots;
shape.pos3.droptarget = expressions.available_p3_slots;
shape.pos4.droptarget = expressions.available_p4_slots;
shape.pos5.droptarget = expressions.available_p5_slots;
shape.pos6.droptarget = expressions.available_p6_slots;
]
/ stimulustimes = [0 = pos1,pos2,pos3,pos4,pos5,pos6,A,B,C,D,E,F,G,H,I,J,K,L,posrep1,posrep2,posrep3,posrep4,posrep5,posrep6,posrep2_1,posrep2_2,posrep2_3,posrep2_4,posrep2_5,posrep2_6,
RVSL]
/ validresponse = (pos1,pos2,pos3,pos4,pos5,pos6)
/ isvalidresponse = [
if (trial.mytrial.response == "pos1")
{
  values.p1_count += 1;
  shape.pos1.droptarget;
}
else if (trial.mytrial.response == "pos2")
{
  values.p2_count += 1;
  shape.pos2.droptarget;
}
else if (trial.mytrial.response == "pos3")
{
  values.p3_count += 1;
  shape.pos3.droptarget;
}
else if (trial.mytrial.response == "pos4")
{
  values.p4_count += 1;
  shape.pos4.droptarget;
}
else if (trial.mytrial.response == "pos5")
{
  values.p5_count += 1;
  shape.pos5.droptarget;
}
else if (trial.mytrial.response == "pos6")
{
  values.p6_count += 1;
  shape.pos6.droptarget;
}
else
  true;
]
/ inputdevice = dragdrop
/ branch = [
  if (values.p1_count + values.p2_count + values.p3_count + values.p4_count + values.p5_count + values.p6_count >= 6) trial.end else trial.mytrial
]
</trial>



<expressions>
/ available_p1_slots = (1-values.p1_count)
/ available_p2_slots = (1-values.p2_count)
/ available_p3_slots = (1-values.p3_count)
/ available_p4_slots = (1-values.p4_count)
/ available_p5_slots = (1-values.p5_count)
/ available_p6_slots = (1-values.p6_count)
</expressions>

<values>
/ p1_count = 0
/ p2_count = 0
/ p3_count = 0
/ p4_count = 0
/ p5_count = 0
/ p6_count = 0
</values>

<trial start>
/ ontrialbegin = [
values.p1_count=0;
values.p2_count=0;
values.p3_count=0;
values.p4_count=0;
values.p5_count=0;
values.p6_count=0;
picture.A.hposition = 25%;
picture.A.vposition = 40%;
picture.B.hposition = 35%;
picture.B.vposition = 40%;
picture.C.hposition = 45%;
picture.C.vposition = 40%;
picture.D.hposition = 55%;
picture.D.vposition = 40%;
picture.E.hposition = 65%;
picture.E.vposition = 40%;
picture.F.hposition = 75%;
picture.F.vposition = 40%;
picture.G.hposition = 25%;
picture.G.vposition = 60%;
picture.H.hposition = 35%;
picture.H.vposition = 60%;
picture.I.hposition = 45%;
picture.I.vposition = 60%;
picture.J.hposition = 55%;
picture.J.vposition = 60%;
picture.K.hposition = 65%;
picture.K.vposition = 60%;
picture.L.hposition = 75%;
picture.L.vposition = 60%;
]
/ branch = [
  trial.mytrial
]
/ trialduration = 0
</trial>

<trial end>
/ stimulusframes = [1=endtext]
/ validresponse = (57)
</trial>


<text endtext>
/ items = ("All boxes filled.")
</text>



<text RVSL>
/ items = RVSL
/ position = (50,32)
/fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
/txcolor = black
/txbgcolor = (transparent)
/resetinterval = 3
/size = (80%,50%)
/ txbgcolor = transparent
</text>

<item RVSL>
/1 = "Please rank the shapes you saw by the order that you think they appeared. For example, put the shape that you think was shown LEAST often in the first box and the shape you think was presented second LEAST often in the second box and so on, until the last box where you will put the shape you think you saw the MOST often.

If you don’t think a shape was presented to you at all, please do not click on that shape."
</item>



<picture A>
/ items = ("A.jpg")
/ position = (25,40)
/ dropsource = true
</picture>

<picture B>
/ items = ("B.jpg")
/ position = (35,40)
/ dropsource = true
</picture>

<picture C>
/ items = ("C.jpg")
/ position = (45,40)
/ dropsource = true
</picture>

<picture D>
/ items = ("D.jpg")
/ position = (55,40)
/ dropsource = true
</picture>

<picture E>
/ items = ("E.jpg")
/ position = (65,40)
/ dropsource = true
</picture>

<picture F>
/ items = ("F.jpg")
/ position = (75,40)
/ dropsource = true
</picture>


<picture G>
/ items = ("G.jpg")
/ position = (25,60)
/ dropsource = true
</picture>

<picture H>
/ items = ("H.jpg")
/ position = (35,60)
/ dropsource = true
</picture>

<picture I>
/ items = ("I.jpg")
/ position = (45,60)
/ dropsource = true
</picture>

<picture J>
/ items = ("J.jpg")
/ position = (55,60)
/ dropsource = true
</picture>

<picture K>
/ items = ("E.jpg")
/ position = (65,60)
/ dropsource = true
</picture>

<picture L>
/ items = ("L.jpg")
/ position = (75,60)
/ dropsource = true
</picture>



<shape pos1>
/ hposition = 25
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos2>
/ hposition = 35
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos3>
/ hposition = 45
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos4>
/ hposition = 55
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos5>
/ hposition = 65
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos6>
/ hposition = 75
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>



<shape posrep1>
/ hposition = 25
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2>
/ hposition = 35
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep3>
/ hposition = 45
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep4>
/ hposition = 55
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep5>
/ hposition = 65
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep6>
/ hposition = 75
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>


<shape posrep2_1>
/ hposition = 25
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_2>
/ hposition = 35
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_3>
/ hposition = 45
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_4>
/ hposition = 55
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_5>
/ hposition = 65
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_6>
/ hposition = 75
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

By Dave - 4/26/2018

Beth - Thursday, April 26, 2018
Hi Dave - thanks very much for your help yesterday. I've adapted the code to fit my full stimulus set and it seems to be mostly working, except that sometimes it will end the trial before all the droptargets have been filled and sometimes it won't (e.g. if you move the same shape to a different droptarget 4 times, it will randomly end without all the boxes being filled). Is there any way to have an option to just have participants press a key or button when they are happy with the order in the droptargets?

Thanks in advance. code below.

<block myblock>
/ trials = [1=start]
</block>

<data>
/ columns = (date,time,group,subject,build,blocknum,trialnum,blockcode,trialcode,pretrialpause,posttrialpause,trialduration,trialtimeout,response,correct,latency,stimulusnumber1,stimulusitem1,stimulusonset1,stimulusnumber2,stimulusitem2,stimulusonset2,stimulusnumber3,stimulusitem3,stimulusonset3,stimulusnumber4,stimulusitem4,stimulusonset4,stimulusnumber5,stimulusitem5,stimulusonset5,stimulusnumber6,stimulusitem6,stimulusonset6,stimulusnumber7,stimulusitem7,stimulusonset7,stimulusnumber8,stimulusitem8,stimulusonset8,stimulusnumber9,stimulusitem9,stimulusonset9
,picture.a.hposition, picture.a.vposition, picture.b.hposition, picture.b.vposition)
</data>

<trial mytrial>

/ ontrialbegin = [

shape.pos1.droptarget = expressions.available_p1_slots;
shape.pos2.droptarget = expressions.available_p2_slots;
shape.pos3.droptarget = expressions.available_p3_slots;
shape.pos4.droptarget = expressions.available_p4_slots;
shape.pos5.droptarget = expressions.available_p5_slots;
shape.pos6.droptarget = expressions.available_p6_slots;
]
/ stimulustimes = [0 = pos1,pos2,pos3,pos4,pos5,pos6,A,B,C,D,E,F,G,H,I,J,K,L,posrep1,posrep2,posrep3,posrep4,posrep5,posrep6,posrep2_1,posrep2_2,posrep2_3,posrep2_4,posrep2_5,posrep2_6,
RVSL]
/ validresponse = (pos1,pos2,pos3,pos4,pos5,pos6)
/ isvalidresponse = [
if (trial.mytrial.response == "pos1")
{
  values.p1_count += 1;
  shape.pos1.droptarget;
}
else if (trial.mytrial.response == "pos2")
{
  values.p2_count += 1;
  shape.pos2.droptarget;
}
else if (trial.mytrial.response == "pos3")
{
  values.p3_count += 1;
  shape.pos3.droptarget;
}
else if (trial.mytrial.response == "pos4")
{
  values.p4_count += 1;
  shape.pos4.droptarget;
}
else if (trial.mytrial.response == "pos5")
{
  values.p5_count += 1;
  shape.pos5.droptarget;
}
else if (trial.mytrial.response == "pos6")
{
  values.p6_count += 1;
  shape.pos6.droptarget;
}
else
  true;
]
/ inputdevice = dragdrop
/ branch = [
  if (values.p1_count + values.p2_count + values.p3_count + values.p4_count + values.p5_count + values.p6_count >= 6) trial.end else trial.mytrial
]
</trial>



<expressions>
/ available_p1_slots = (1-values.p1_count)
/ available_p2_slots = (1-values.p2_count)
/ available_p3_slots = (1-values.p3_count)
/ available_p4_slots = (1-values.p4_count)
/ available_p5_slots = (1-values.p5_count)
/ available_p6_slots = (1-values.p6_count)
</expressions>

<values>
/ p1_count = 0
/ p2_count = 0
/ p3_count = 0
/ p4_count = 0
/ p5_count = 0
/ p6_count = 0
</values>

<trial start>
/ ontrialbegin = [
values.p1_count=0;
values.p2_count=0;
values.p3_count=0;
values.p4_count=0;
values.p5_count=0;
values.p6_count=0;
picture.A.hposition = 25%;
picture.A.vposition = 40%;
picture.B.hposition = 35%;
picture.B.vposition = 40%;
picture.C.hposition = 45%;
picture.C.vposition = 40%;
picture.D.hposition = 55%;
picture.D.vposition = 40%;
picture.E.hposition = 65%;
picture.E.vposition = 40%;
picture.F.hposition = 75%;
picture.F.vposition = 40%;
picture.G.hposition = 25%;
picture.G.vposition = 60%;
picture.H.hposition = 35%;
picture.H.vposition = 60%;
picture.I.hposition = 45%;
picture.I.vposition = 60%;
picture.J.hposition = 55%;
picture.J.vposition = 60%;
picture.K.hposition = 65%;
picture.K.vposition = 60%;
picture.L.hposition = 75%;
picture.L.vposition = 60%;
]
/ branch = [
  trial.mytrial
]
/ trialduration = 0
</trial>

<trial end>
/ stimulusframes = [1=endtext]
/ validresponse = (57)
</trial>


<text endtext>
/ items = ("All boxes filled.")
</text>



<text RVSL>
/ items = RVSL
/ position = (50,32)
/fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
/txcolor = black
/txbgcolor = (transparent)
/resetinterval = 3
/size = (80%,50%)
/ txbgcolor = transparent
</text>

<item RVSL>
/1 = "Please rank the shapes you saw by the order that you think they appeared. For example, put the shape that you think was shown LEAST often in the first box and the shape you think was presented second LEAST often in the second box and so on, until the last box where you will put the shape you think you saw the MOST often.

If you don’t think a shape was presented to you at all, please do not click on that shape."
</item>



<picture A>
/ items = ("A.jpg")
/ position = (25,40)
/ dropsource = true
</picture>

<picture B>
/ items = ("B.jpg")
/ position = (35,40)
/ dropsource = true
</picture>

<picture C>
/ items = ("C.jpg")
/ position = (45,40)
/ dropsource = true
</picture>

<picture D>
/ items = ("D.jpg")
/ position = (55,40)
/ dropsource = true
</picture>

<picture E>
/ items = ("E.jpg")
/ position = (65,40)
/ dropsource = true
</picture>

<picture F>
/ items = ("F.jpg")
/ position = (75,40)
/ dropsource = true
</picture>


<picture G>
/ items = ("G.jpg")
/ position = (25,60)
/ dropsource = true
</picture>

<picture H>
/ items = ("H.jpg")
/ position = (35,60)
/ dropsource = true
</picture>

<picture I>
/ items = ("I.jpg")
/ position = (45,60)
/ dropsource = true
</picture>

<picture J>
/ items = ("J.jpg")
/ position = (55,60)
/ dropsource = true
</picture>

<picture K>
/ items = ("E.jpg")
/ position = (65,60)
/ dropsource = true
</picture>

<picture L>
/ items = ("L.jpg")
/ position = (75,60)
/ dropsource = true
</picture>



<shape pos1>
/ hposition = 25
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos2>
/ hposition = 35
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos3>
/ hposition = 45
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos4>
/ hposition = 55
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos5>
/ hposition = 65
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos6>
/ hposition = 75
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>



<shape posrep1>
/ hposition = 25
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2>
/ hposition = 35
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep3>
/ hposition = 45
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep4>
/ hposition = 55
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep5>
/ hposition = 65
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep6>
/ hposition = 75
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>


<shape posrep2_1>
/ hposition = 25
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_2>
/ hposition = 35
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_3>
/ hposition = 45
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_4>
/ hposition = 55
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_5>
/ hposition = 65
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_6>
/ hposition = 75
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>


> sometimes it will end the trial before all the droptargets have been filled and sometimes it won't
> (e.g. if you move the same shape to a different droptarget 4 times, it will randomly end without all the boxes being filled).

Contrary to yesterday's code / example, you're now allowing objects to be moved out of boxes again. Your current code doesn't account for that and keeps increasing values.p1_count etc. accordingly whenever that happens. To fix that, you'll need to change the expressions that determine whether a box is available as a droptarget (true) or not (false) a bit. Something like this should work, I think:

P.S.: In the future, if you need to share lengthy scripts, please don't paste them into a post's body. Instead please attach the script by clicking +Insert -> Add File, and please include any and all files the script needs to run (such as any image files). Thanks.

<block myblock>
/ trials = [1=start]
</block>

<data>
/ columns = (date,time,group,subject,build,blocknum,trialnum,blockcode,trialcode,pretrialpause,posttrialpause,trialduration,trialtimeout,response,correct,latency,stimulusnumber1,stimulusitem1,stimulusonset1,stimulusnumber2,stimulusitem2,stimulusonset2,stimulusnumber3,stimulusitem3,stimulusonset3,stimulusnumber4,stimulusitem4,stimulusonset4,stimulusnumber5,stimulusitem5,stimulusonset5,stimulusnumber6,stimulusitem6,stimulusonset6,stimulusnumber7,stimulusitem7,stimulusonset7,stimulusnumber8,stimulusitem8,stimulusonset8,stimulusnumber9,stimulusitem9,stimulusonset9
,text.a.hposition, text.a.vposition, text.b.hposition, text.b.vposition)
</data>

<trial mytrial>

/ ontrialbegin = [

shape.pos1.droptarget = expressions.available_p1_slots;
shape.pos2.droptarget = expressions.available_p2_slots;
shape.pos3.droptarget = expressions.available_p3_slots;
shape.pos4.droptarget = expressions.available_p4_slots;
shape.pos5.droptarget = expressions.available_p5_slots;
shape.pos6.droptarget = expressions.available_p6_slots;
]

/ ontrialend = [

shape.pos1.droptarget = expressions.available_p1_slots;
shape.pos2.droptarget = expressions.available_p2_slots;
shape.pos3.droptarget = expressions.available_p3_slots;
shape.pos4.droptarget = expressions.available_p4_slots;
shape.pos5.droptarget = expressions.available_p5_slots;
shape.pos6.droptarget = expressions.available_p6_slots;
]

/ stimulustimes = [0 = pos1,pos2,pos3,pos4,pos5,pos6,A,B,C,D,E,F,G,H,I,J,K,L,posrep1,posrep2,posrep3,posrep4,posrep5,posrep6,posrep2_1,posrep2_2,posrep2_3,posrep2_4,posrep2_5,posrep2_6,
RVSL]
/ validresponse = (pos1,pos2,pos3,pos4,pos5,pos6)
/ isvalidresponse = [
if (trial.mytrial.response == "pos1")
{
  values.p1_count += 1;
  shape.pos1.droptarget;
}
else if (trial.mytrial.response == "pos2")
{
  values.p2_count += 1;
  shape.pos2.droptarget;
}
else if (trial.mytrial.response == "pos3")
{
  values.p3_count += 1;
  shape.pos3.droptarget;
}
else if (trial.mytrial.response == "pos4")
{
  values.p4_count += 1;
  shape.pos4.droptarget;
}
else if (trial.mytrial.response == "pos5")
{
  values.p5_count += 1;
  shape.pos5.droptarget;
}
else if (trial.mytrial.response == "pos6")
{
  values.p6_count += 1;
  shape.pos6.droptarget;
}
else
  true;
]
/ inputdevice = dragdrop
/ branch = [
  if ((expressions.available_p1_slots + expressions.available_p2_slots + expressions.available_p3_slots + expressions.available_p4_slots + expressions.available_p5_slots + expressions.available_p6_slots) <= 0) trial.end else trial.mytrial
]
</trial>



<expressions>
/ available_p1_slots = if(mod(values.p1_count,2)==0) true else false
/ available_p2_slots = if(mod(values.p2_count,2)==0) true else false
/ available_p3_slots = if(mod(values.p3_count,2)==0) true else false
/ available_p4_slots = if(mod(values.p4_count,2)==0) true else false
/ available_p5_slots = if(mod(values.p5_count,2)==0) true else false
/ available_p6_slots = if(mod(values.p6_count,2)==0) true else false
</expressions>


<values>
/ p1_count = 0
/ p2_count = 0
/ p3_count = 0
/ p4_count = 0
/ p5_count = 0
/ p6_count = 0
</values>

<trial start>
/ ontrialbegin = [
values.p1_count=0;
values.p2_count=0;
values.p3_count=0;
values.p4_count=0;
values.p5_count=0;
values.p6_count=0;
text.A.hposition = 25%;
text.A.vposition = 40%;
text.B.hposition = 35%;
text.B.vposition = 40%;
text.C.hposition = 45%;
text.C.vposition = 40%;
text.D.hposition = 55%;
text.D.vposition = 40%;
text.E.hposition = 65%;
text.E.vposition = 40%;
text.F.hposition = 75%;
text.F.vposition = 40%;
text.G.hposition = 25%;
text.G.vposition = 60%;
text.H.hposition = 35%;
text.H.vposition = 60%;
text.I.hposition = 45%;
text.I.vposition = 60%;
text.J.hposition = 55%;
text.J.vposition = 60%;
text.K.hposition = 65%;
text.K.vposition = 60%;
text.L.hposition = 75%;
text.L.vposition = 60%;
]
/ branch = [
  trial.mytrial
]
/ trialduration = 0
</trial>

<trial end>
/ stimulusframes = [1=endtext]
/ validresponse = (57)
</trial>


<text endtext>
/ items = ("All boxes filled.")
</text>

<text RVSL>
/ items = RVSL
/ position = (50,32)
/fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
/txcolor = black
/txbgcolor = (transparent)
/resetinterval = 3
/size = (80%,50%)
/ txbgcolor = transparent
</text>

<item RVSL>
/1 = "Please rank the shapes you saw by the order that you think they appeared. For example, put the shape that you think was shown LEAST often in the first box and the shape you think was presented second LEAST often in the second box and so on, until the last box where you will put the shape you think you saw the MOST often.

If you don’t think a shape was presented to you at all, please do not click on that shape."
</item>



<text A>
/ items = ("A.jpg")
/ position = (25,40)
/ dropsource = true
</text>

<text B>
/ items = ("B.jpg")
/ position = (35,40)
/ dropsource = true
</text>

<text C>
/ items = ("C.jpg")
/ position = (45,40)
/ dropsource = true
</text>

<text D>
/ items = ("D.jpg")
/ position = (55,40)
/ dropsource = true
</text>

<text E>
/ items = ("E.jpg")
/ position = (65,40)
/ dropsource = true
</text>

<text F>
/ items = ("F.jpg")
/ position = (75,40)
/ dropsource = true
</text>


<text G>
/ items = ("G.jpg")
/ position = (25,60)
/ dropsource = true
</text>

<text H>
/ items = ("H.jpg")
/ position = (35,60)
/ dropsource = true
</text>

<text I>
/ items = ("I.jpg")
/ position = (45,60)
/ dropsource = true
</text>

<text J>
/ items = ("J.jpg")
/ position = (55,60)
/ dropsource = true
</text>

<text K>
/ items = ("E.jpg")
/ position = (65,60)
/ dropsource = true
</text>

<text L>
/ items = ("L.jpg")
/ position = (75,60)
/ dropsource = true
</text>



<shape pos1>
/ hposition = 25
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos2>
/ hposition = 35
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos3>
/ hposition = 45
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos4>
/ hposition = 55
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos5>
/ hposition = 65
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>

<shape pos6>
/ hposition = 75
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = grey
</shape>



<shape posrep1>
/ hposition = 25
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2>
/ hposition = 35
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep3>
/ hposition = 45
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep4>
/ hposition = 55
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep5>
/ hposition = 65
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep6>
/ hposition = 75
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>


<shape posrep2_1>
/ hposition = 25
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_2>
/ hposition = 35
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_3>
/ hposition = 45
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_4>
/ hposition = 55
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_5>
/ hposition = 65
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_6>
/ hposition = 75
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>


By Beth - 4/26/2018

Thanks - apologies, will do so in the future. If I wanted to record which particular dropsources (e.g. the shapes) were in which particular droptargets (e.g. pos1-6) regardless of any level of "correctness", I assume I would do so in the <trial end> element - is there any easy way to do this with a function?

<trial end>
/ stimulusframes = [1=endtext]
/ validresponse = (57)
</trial>
By Dave - 4/26/2018

Beth - Thursday, April 26, 2018
Thanks - apologies, will do so in the future. If I wanted to record which particular dropsources (e.g. the shapes) were in which particular droptargets (e.g. pos1-6) regardless of any level of "correctness", I assume I would do so in the <trial end> element - is there any easy way to do this with a function?

<trial end>
/ stimulusframes = [1=endtext]
/ validresponse = (57)
</trial>

> is there any easy way to do this with a function?

I don't understand what you mean by that, I'm afraid. Ultimately, the object's positions (hposition and vposition) tell you where each object is at that point, i.e. in which box / droptarget.
By Beth - 4/26/2018

It is looking difficult to extract that data from all the columns/rows in the data file given all the possible - I was wondering if there was any way to concisely code the possibility for a column of data for each "pos1-6" droptarget (or at least the intersection between each corresponding hpos and vpos) and then which picture element had been dropped in that location/droptarget. 

Is there any way to simply do this?
By Dave - 4/26/2018

Beth - Thursday, April 26, 2018
It is looking difficult to extract that data from all the columns/rows in the data file given all the possible - I was wondering if there was any way to concisely code the possibility for a column of data for each "pos1-6" droptarget (or at least the intersection between each corresponding hpos and vpos) and then which picture element had been dropped in that location/droptarget. 

Is there any way to simply do this?

You can check each object's position /ontrialbegin and based on that you can store what object is in box 1, in box 2, box 3, etc. and log the values to the data file. I'm not sure what you mean by "concisely code."  I.e.

- create a bunch of values, each representing one box

<values>
/ box1 = ""
/ box2 = ""
...
</values>

and then check each object's hposition and vposition property and set the values accordingly.

Finally, record the values to the data file.

Does that make sense?


By Dave - 4/26/2018

Dave - Thursday, April 26, 2018
Beth - Thursday, April 26, 2018
It is looking difficult to extract that data from all the columns/rows in the data file given all the possible - I was wondering if there was any way to concisely code the possibility for a column of data for each "pos1-6" droptarget (or at least the intersection between each corresponding hpos and vpos) and then which picture element had been dropped in that location/droptarget. 

Is there any way to simply do this?

You can check each object's position /ontrialbegin and based on that you can store what object is in box 1, in box 2, box 3, etc. and log the values to the data file. I'm not sure what you mean by "concisely code."  I.e.

- create a bunch of values, each representing one box

<values>
/ box1 = ""
/ box2 = ""
...
</values>

and then check each object's hposition and vposition property and set the values accordingly.

Finally, record the values to the data file.

Does that make sense?



To illustrate the above:

<block myblock>
/ trials = [1=start]
</block>

<data>
/ columns = (date,time,group,subject,build,blocknum,trialnum,blockcode,trialcode,pretrialpause,posttrialpause,trialduration,trialtimeout,response,correct,latency,stimulusnumber,stimulusitem,stimulusonset,stimulusnumber,stimulusitem,stimulusonset,stimulusnumber,stimulusitem,stimulusonset,stimulusnumber,stimulusitem,stimulusonset,stimulusnumber,stimulusitem,stimulusonset,stimulusnumber,stimulusitem,stimulusonset,stimulusnumber,stimulusitem,stimulusonset,stimulusnumber,stimulusitem,stimulusonset,stimulusnumber,stimulusitem,stimulusonset
    values.box1, values.box2, values.box3, values.box4, values.box5, values.box6)
</data>

<trial mytrial>

/ ontrialbegin = [

shape.pos1.droptarget = expressions.available_p1_slots;
shape.pos2.droptarget = expressions.available_p2_slots;
shape.pos3.droptarget = expressions.available_p3_slots;
shape.pos4.droptarget = expressions.available_p4_slots;
shape.pos5.droptarget = expressions.available_p5_slots;
shape.pos6.droptarget = expressions.available_p6_slots;
]

/ ontrialend = [

shape.pos1.droptarget = expressions.available_p1_slots;
shape.pos2.droptarget = expressions.available_p2_slots;
shape.pos3.droptarget = expressions.available_p3_slots;
shape.pos4.droptarget = expressions.available_p4_slots;
shape.pos5.droptarget = expressions.available_p5_slots;
shape.pos6.droptarget = expressions.available_p6_slots;
]

/ stimulustimes = [0 = pos1,pos2,pos3,pos4,pos5,pos6,A,B,C,D,E,F,G,H,I,J,K,L,posrep1,posrep2,posrep3,posrep4,posrep5,posrep6,posrep2_1,posrep2_2,posrep2_3,posrep2_4,posrep2_5,posrep2_6,
RVSL]
/ validresponse = (pos1,pos2,pos3,pos4,pos5,pos6)
/ isvalidresponse = [
if (trial.mytrial.response == "pos1")
{
  values.p1_count += 1;
  shape.pos1.droptarget;
}
else if (trial.mytrial.response == "pos2")
{
  values.p2_count += 1;
  shape.pos2.droptarget;
}
else if (trial.mytrial.response == "pos3")
{
  values.p3_count += 1;
  shape.pos3.droptarget;
}
else if (trial.mytrial.response == "pos4")
{
  values.p4_count += 1;
  shape.pos4.droptarget;
}
else if (trial.mytrial.response == "pos5")
{
  values.p5_count += 1;
  shape.pos5.droptarget;
 }
else if (trial.mytrial.response == "pos6")
{
  values.p6_count += 1;
  shape.pos6.droptarget;
}
else
  true;
]
/ inputdevice = dragdrop
/ branch = [
  if ((expressions.available_p1_slots + expressions.available_p2_slots + expressions.available_p3_slots + expressions.available_p4_slots + expressions.available_p5_slots + expressions.available_p6_slots) <= 0) trial.end else trial.mytrial
]
</trial>



<expressions>
/ available_p1_slots = if(mod(values.p1_count,2)==0) true else false
/ available_p2_slots = if(mod(values.p2_count,2)==0) true else false
/ available_p3_slots = if(mod(values.p3_count,2)==0) true else false
/ available_p4_slots = if(mod(values.p4_count,2)==0) true else false
/ available_p5_slots = if(mod(values.p5_count,2)==0) true else false
/ available_p6_slots = if(mod(values.p6_count,2)==0) true else false
</expressions>

<values>
/ p1_count = 0
/ p2_count = 0
/ p3_count = 0
/ p4_count = 0
/ p5_count = 0
/ p6_count = 0
</values>

<trial start>
/ ontrialbegin = [
values.p1_count=0;
values.p2_count=0;
values.p3_count=0;
values.p4_count=0;
values.p5_count=0;
values.p6_count=0;
text.A.hposition = 25%;
text.A.vposition = 40%;
text.B.hposition = 35%;
text.B.vposition = 40%;
text.C.hposition = 45%;
text.C.vposition = 40%;
text.D.hposition = 55%;
text.D.vposition = 40%;
text.E.hposition = 65%;
text.E.vposition = 40%;
text.F.hposition = 75%;
text.F.vposition = 40%;
text.G.hposition = 25%;
text.G.vposition = 60%;
text.H.hposition = 35%;
text.H.vposition = 60%;
text.I.hposition = 45%;
text.I.vposition = 60%;
text.J.hposition = 55%;
text.J.vposition = 60%;
text.K.hposition = 65%;
text.K.vposition = 60%;
text.L.hposition = 75%;
text.L.vposition = 60%;
]
/ branch = [
  trial.mytrial
]
/ trialduration = 0
</trial>

<values>
/ box1 = ""
/ box2 = ""
/ box3 = ""
/ box4 = ""
/ box5 = ""
/ box6 = ""
</values>


<trial end>
/ ontrialbegin = [
    if (text.A.hposition == 25 && text.A.vposition == 80) {
        values.box1 = "A";
    }
    else if (text.A.hposition == 35 && text.A.vposition == 80) {
        values.box2 = "A";
    }
    else if (text.A.hposition == 45 && text.A.vposition == 80) {
        values.box3 = "A";
    }
    else if (text.A.hposition == 55 && text.A.vposition == 80) {
        values.box4 = "A";
    }
    else if (text.A.hposition == 65 && text.A.vposition == 80) {
        values.box5 = "A";
    }
    else if (text.A.hposition == 75 && text.A.vposition == 80) {
        values.box6 = "A";
    }
]

/ ontrialbegin = [
    if (text.B.hposition == 25 && text.B.vposition == 80) {
        values.box1 = "B";
    }
    else if (text.B.hposition == 35 && text.B.vposition == 80) {
        values.box2 = "B";
    }
    else if (text.B.hposition == 45 && text.B.vposition == 80) {
        values.box3 = "B";
    }
    else if (text.B.hposition == 55 && text.B.vposition == 80) {
        values.box4 = "B";
    }
    else if (text.B.hposition == 65 && text.B.vposition == 80) {
        values.box5 = "B";
    }
    else if (text.B.hposition == 75 && text.B.vposition == 80) {
        values.box6 = "B";
    }
]


/ stimulusframes = [1=endtext]
/ validresponse = (57)
</trial>


<text endtext>
/ items = ("All boxes filled.")
</text>



<text RVSL>
/ items = RVSL
/ position = (50,32)
/fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
/txcolor = black
/txbgcolor = (transparent)
/resetinterval = 3
/size = (80%,50%)
/ txbgcolor = transparent
</text>

<item RVSL>
/1 = "Please rank the shapes you saw by the order that you think they appeared. For example, put the shape that you think was shown LEAST often in the first box and the shape you think was presented second LEAST often in the second box and so on, until the last box where you will put the shape you think you saw the MOST often.

If you don’t think a shape was presented to you at all, please do not click on that shape."
</item>

<text A>
/ items = ("A.jpg")
/ position = (25,40)
/ dropsource = true
</text>

<text B>
/ items = ("B.jpg")
/ position = (35,40)
/ dropsource = true
</text>

<text C>
/ items = ("C.jpg")
/ position = (45,40)
/ dropsource = true
</text>

<text D>
/ items = ("D.jpg")
/ position = (55,40)
/ dropsource = true
</text>

<text E>
/ items = ("E.jpg")
/ position = (65,40)
/ dropsource = true
</text>

<text F>
/ items = ("F.jpg")
/ position = (75,40)
/ dropsource = true
</text>

<text G>
/ items = ("G.jpg")
/ position = (25,60)
/ dropsource = true
</text>

<text H>
/ items = ("H.jpg")
/ position = (35,60)
/ dropsource = true
</text>

<text I>
/ items = ("I.jpg")
/ position = (45,60)
/ dropsource = true
</text>

<text J>
/ items = ("J.jpg")
/ position = (55,60)
/ dropsource = true
</text>

<text K>
/ items = ("K.jpg")
/ position = (65,60)
/ dropsource = true
</text>

<text L>
/ items = ("L.jpg")
/ position = (75,60)
/ dropsource = true
</text>

<shape pos1>
/ hposition = 25
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ dropposition = (25,80)
/ size = (170,170)
/ color = grey
</shape>

<shape pos2>
/ hposition = 35
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ dropposition = (35,80)
/ size = (170,170)
/ color = grey
</shape>

<shape pos3>
/ hposition = 45
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ dropposition = (45,80)
/ size = (170,170)
/ color = grey
</shape>

<shape pos4>
/ hposition = 55
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ dropposition = (55,80)
/ size = (170,170)
/ color = grey
</shape>

<shape pos5>
/ hposition = 65
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ dropposition = (65,80)
/ size = (170,170)
/ color = grey
</shape>

<shape pos6>
/ hposition = 75
/ vposition = 80
/ shape = rectangle
/ droptarget = true
/ dropposition = (75,80)
/ size = (170,170)
/ color = grey
</shape>



<shape posrep1>
/ hposition = 25
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2>
/ hposition = 35
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep3>
/ hposition = 45
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep4>
/ hposition = 55
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep5>
/ hposition = 65
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep6>
/ hposition = 75
/ vposition = 40
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>


<shape posrep2_1>
/ hposition = 25
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_2>
/ hposition = 35
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_3>
/ hposition = 45
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_4>
/ hposition = 55
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_5>
/ hposition = 65
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>

<shape posrep2_6>
/ hposition = 75
/ vposition = 60
/ shape = rectangle
/ droptarget = true
/ size = (170,170)
/ color = lightgrey
</shape>


The two /ontrialbegin statements in <trial end> currently only perform the checks for objects A and B. You would add the checks for the remaining objects C to L in exactly the same way.
By Beth - 4/26/2018

Hi, I have it working nearly perfectly now, thanks so much! Still getting one error though - I added in some code so they could get a chance to re-do the trial if they weren't happy with the order they'd put it in, but if you click around enough it seems to fault with only 5 of the 6 boxes filled (see screenshot below). Any help with the error would be much appreciated. I've attached the code/files.


By Dave - 4/27/2018

Beth - Thursday, April 26, 2018
Hi, I have it working nearly perfectly now, thanks so much! Still getting one error though - I added in some code so they could get a chance to re-do the trial if they weren't happy with the order they'd put it in, but if you click around enough it seems to fault with only 5 of the 6 boxes filled (see screenshot below). Any help with the error would be much appreciated. I've attached the code/files.




Not sure if I caught all potential pitfalls and edge cases, but let me know if the attached version works better.
By Beth - 4/27/2018

Perfect - that works now, couldn't make it fault at all. Thank you so much for all of your help throughout this!