Iscorrectresponse and drogtargets elements


Author
Message
Beth
Beth
Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)
Group: Forum Members
Posts: 17, Visits: 41
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>


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
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>



Beth
Beth
Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)
Group: Forum Members
Posts: 17, Visits: 41
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>

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
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.

Beth
Beth
Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)
Group: Forum Members
Posts: 17, Visits: 41
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?
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
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?



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
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.

Beth
Beth
Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)
Group: Forum Members
Posts: 17, Visits: 41
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.



Attachments
RVSL Measure.rar (231 views, 21.00 KB)
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
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.
Attachments
_RVSL6.iqx (612 views, 21.00 KB)
Beth
Beth
Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)
Group: Forum Members
Posts: 17, Visits: 41
Perfect - that works now, couldn't make it fault at all. Thank you so much for all of your help throughout this!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search