clicks count


clicks count

Author
Message
wsly
wsly
Partner Member
Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)

Group: Forum Members
Posts: 10, Visits: 61
Hi!

I need to create in my data file a column to register how many clicks a participant does in each block, I have tried several different solutions but no one seems to work.
Any suggestions please????
Tags
Dave
Dave
Supreme Being
Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)

Group: Administrators
Posts: 9.2K, Visits: 39K
This entirely depends on how you programmed your script. Usually you'll want to create and increase <values> entries to count the clicks and log those to the data file. Suppose you have a <trial> that displays two "boxes" a and b. Then you could do something along the lines of:

<values>
/ a_clickcount = 0
/ b_clickcount = 0
</values>

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

<block myblock>
/ onblockbegin = [values.a_clickcount = 0; values.b_clickcount = 0; ]
/ trials = [1-10 = mytrial]
</block>

<trial mytrial>
/ ontrialend = [if (trial.mytrial.response == "a") values.a_clickcount += 1; ]
/ ontrialend = [if (trial.mytrial.response == "b") values.b_clickcount += 1; ]
/ stimulusframes = [1=a,b]
/ inputdevice = mouse
/ validresponse = (a, b)
</trial>

<text a>
/ items = ("A")
/ size = (20%, 20%)
/ position = (35%, 50%)
/ txbgcolor = grey
</text>

<text b>
/ items = ("B")
/ size = (20%, 20%)
/ position = (65%, 50%)
/ txbgcolor = grey
</text>

<data>
/ columns = [date time subject group blocknum blockcode trialnum trialcode response latency correct values.a_clickcount values.b_clickcount]
/ separatefiles = true
</data>


Edited
2 Years Ago by Dave
wsly
wsly
Partner Member
Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)

Group: Forum Members
Posts: 10, Visits: 61
Thank you for the suggestion!!

Additionally, I have a slight issue I cannot figure out how to solve. Here's the point: I've got a simple shape embedded in a more complex figure and participants have to find the single shape within the complex one by clicking on its corners. Problem is that there is more than one solution (the same simple shape can be traced four times in the complex figure. Some corners are in common between two or more solutions, but it seems that it does not recognize as correct all the three solutions the overlapping corner belongs to.
Here's the code - in the highlighted lines, for example, if I click on the corner it does only recognize solution 4 as correct, not 1 or 2.

<trial complexII_4>
/ inputdevice = mouse
/ stimulusframes = [1 = selectedCorner]
/ validresponse = (solutionII_4_1_1, solutionII_4_1_2, solutionII_4_1_3, solutionII_4_1_4, solutionII_4_1_5, solutionII_4_1_6, solutionII_4_1_7,
solutionII_4_2_1, solutionII_4_2_2, solutionII_4_2_3, solutionII_4_2_4, solutionII_4_2_5, solutionII_4_2_6, solutionII_4_2_7,
solutionII_4_3_1, solutionII_4_3_2, solutionII_4_3_3, solutionII_4_3_4, solutionII_4_3_5, solutionII_4_3_6, solutionII_4_3_7,
solutionII_4_4_1, solutionII_4_4_2, solutionII_4_4_3, solutionII_4_4_4, solutionII_4_4_5, solutionII_4_4_6, solutionII_4_4_7,
back, done, background)

/ ontrialend = [
if (trial.complexII_4.response == "solutionII_4_1_1" && values.solutionII_4_1_1set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 1)){
values.solutionII_4_1_1set = 1;
values.solutionII_4_1_feedback_x1 = values.solutionII_4_1_x1;
values.solutionII_4_1_feedback_y1 = values.solutionII_4_1_y1;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_1_x1;
shape.selectedCorner.vposition = values.solutionII_4_1_y1;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 1;
} else {};

}
else if ((trial.complexII_4.response == "solutionII_4_1_2" || trial.complexII_4.response == "solutionII_4_3_1") && values.solutionII_4_1_2set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 1 || values.currentsolutionII_4 == 3 )){
values.solutionII_4_1_2set = 1;
   values.solutionII_4_3_1set = 1;
values.solutionII_4_1_feedback_x2 = values.solutionII_4_1_x2;
values.solutionII_4_1_feedback_y2 = values.solutionII_4_1_y2;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_1_x2;
shape.selectedCorner.vposition = values.solutionII_4_1_y2;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 1; values.currentsolutionII_4 = 3;
} else {};
}
else if ((trial.complexII_4.response == "solutionII_4_1_3" || trial.complexII_4.response == "solutionII_4_2_7" || trial.complexII_4.response == "solutionII_4_4_6") && values.solutionII_4_1_3set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 1 || values.currentsolutionII_4 == 2 || values.currentsolutionII_4 == 4 )){
values.solutionII_4_1_3set = 1;
   values.solutionII_4_2_7set = 1;
   values.solutionII_4_4_6set = 1;
values.solutionII_4_1_feedback_x3 = values.solutionII_4_1_x3;
values.solutionII_4_1_feedback_y3 = values.solutionII_4_1_y3;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_1_x3;
shape.selectedCorner.vposition = values.solutionII_4_1_y3;

if (values.currentsolutionII_4 == 0 ){
values.currentsolutionII_4 = 1; values.currentsolutionII_4 = 2; values.currentsolutionII_4 = 4;
  }else {};
}

else if ((trial.complexII_4.response == "solutionII_4_1_4" || trial.complexII_4.response == "solutionII_4_3_5") && values.solutionII_4_1_4set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 1 || values.currentsolutionII_4 == 3 )){
values.solutionII_4_1_4set = 1;
   values.solutionII_4_3_5set = 1;
values.solutionII_4_1_feedback_x4 = values.solutionII_4_1_x4;
values.solutionII_4_1_feedback_y4 = values.solutionII_4_1_y4;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_1_x4;
shape.selectedCorner.vposition = values.solutionII_4_1_y4;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 1; values.currentsolutionII_4 = 3;
} else {};

}
else if (trial.complexII_4.response == "solutionII_4_1_5" && values.solutionII_4_1_5set == 0 && (values.currentsolutionII_4 == 1 || values.currentsolutionII_4 == 0)){
values.solutionII_4_1_5set = 1;
values.solutionII_4_1_feedback_x5 = values.solutionII_4_1_x5;
values.solutionII_4_1_feedback_y5 = values.solutionII_4_1_y5;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_1_x5;
shape.selectedCorner.vposition = values.solutionII_4_1_y5;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 1;
} else {};
}
else if (trial.complexII_4.response == "solutionII_4_1_6" && values.solutionII_4_1_6set == 0 && (values.currentsolutionII_4 == 1 || values.currentsolutionII_4 == 0)){
values.solutionII_4_1_6set = 1;
values.solutionII_4_1_feedback_x6 = values.solutionII_4_1_x6;
values.solutionII_4_1_feedback_y6 = values.solutionII_4_1_y6;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_1_x6;
shape.selectedCorner.vposition = values.solutionII_4_1_y6;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 1;
} else {};

}
else if ((trial.complexII_4.response == "solutionII_4_1_7" || trial.complexII_4.response == "solutionII_4_3_6") && values.solutionII_4_1_7set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 1 || values.currentsolutionII_4 == 3 )){
values.solutionII_4_1_7set = 1;
values.solutionII_4_3_6set = 1;
values.solutionII_4_1_feedback_x7 = values.solutionII_4_1_x7;
values.solutionII_4_1_feedback_y7 = values.solutionII_4_1_y7;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_1_x7;
shape.selectedCorner.vposition = values.solutionII_4_1_y7;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 1; values.currentsolutionII_4 = 3;
} else {};
}
else if (trial.complexII_4.response == "solutionII_4_2_1" && values.solutionII_4_2_1set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 2)){
values.solutionII_4_2_1set = 1;
values.solutionII_4_2_feedback_x1 = values.solutionII_4_2_x1;
values.solutionII_4_2_feedback_y1 = values.solutionII_4_2_y1;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_2_x1;
shape.selectedCorner.vposition = values.solutionII_4_2_y1;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 2;
} else {};
}
else if ((trial.complexII_4.response == "solutionII_4_2_2" || trial.complexII_4.response == "solutionII_4_4_1") && values.solutionII_4_2_2set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 2 || values.currentsolutionII_4 == 4 )){
values.solutionII_4_2_2set = 1;
   values.solutionII_4_4_1set = 1;
values.solutionII_4_2_feedback_x2 = values.solutionII_4_2_x2;
values.solutionII_4_2_feedback_y2 = values.solutionII_4_2_y2;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_2_x2;
shape.selectedCorner.vposition = values.solutionII_4_2_y2;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 2; values.currentsolutionII_4 = 4;
} else {};
}
else if ((trial.complexII_4.response == "solutionII_4_2_3" || trial.complexII_4.response == "solutionII_4_3_7") && values.solutionII_4_2_3set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 2 || values.currentsolutionII_4 == 3 )){
values.solutionII_4_2_3set = 1;
   values.solutionII_4_3_7set = 1;
values.solutionII_4_2_feedback_x3 = values.solutionII_4_2_x3;
values.solutionII_4_2_feedback_y3 = values.solutionII_4_2_y3;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_2_x3;
shape.selectedCorner.vposition = values.solutionII_4_2_y3;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 2; values.currentsolutionII_4 = 3;
} else {};
}
else if ((trial.complexII_4.response == "solutionII_4_2_4" || trial.complexII_4.response == "solutionII_4_4_5") && values.solutionII_4_2_4set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 2 || values.currentsolutionII_4 == 4 )){
values.solutionII_4_2_4set = 1;
   values.solutionII_4_4_5set = 1;
values.solutionII_4_2_feedback_x4 = values.solutionII_4_2_x4;
values.solutionII_4_2_feedback_y4 = values.solutionII_4_2_y4;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_2_x4;
shape.selectedCorner.vposition = values.solutionII_4_2_y4;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 2; values.currentsolutionII_4 = 4;
} else {};
}
else if (trial.complexII_4.response == "solutionII_4_2_5" && values.solutionII_4_2_5set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 2)){
values.solutionII_4_2_5set = 1;
values.solutionII_4_2_feedback_x5 = values.solutionII_4_2_x5;
values.solutionII_4_2_feedback_y5 = values.solutionII_4_2_y5;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_2_x5;
shape.selectedCorner.vposition = values.solutionII_4_2_y5;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 2;
} else {};
}
else if (trial.complexII_4.response == "solutionII_4_2_6" && values.solutionII_4_2_6set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 2)){
values.solutionII_4_2_6set = 1;
values.solutionII_4_2_feedback_x6 = values.solutionII_4_2_x6;
values.solutionII_4_2_feedback_y6 = values.solutionII_4_2_y6;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_2_x6;
shape.selectedCorner.vposition = values.solutionII_4_2_y6;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 2;
} else {};
  }
else if (trial.complexII_4.response == "solutionII_4_3_2" && values.solutionII_4_3_2set == 0 && (values.currentsolutionII_4 == 3 || values.currentsolutionII_4 == 0)){
values.solutionII_4_3_2set = 1;
values.solutionII_4_3_feedback_x2 = values.solutionII_4_3_x2;
values.solutionII_4_3_feedback_y2 = values.solutionII_4_3_y2;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_3_x2;
shape.selectedCorner.vposition = values.solutionII_4_3_y2;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 3;
} else {};
  }
else if ((trial.complexII_4.response == "solutionII_4_3_3" || trial.complexII_4.response == "solutionII_4_4_7") && values.solutionII_4_3_3set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 3 || values.currentsolutionII_4 == 4 )){
values.solutionII_4_3_3set = 1;
   values.solutionII_4_4_7set = 1;
values.solutionII_4_3_feedback_x3 = values.solutionII_4_3_x3;
values.solutionII_4_3_feedback_y3 = values.solutionII_4_3_y3;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_3_x3;
shape.selectedCorner.vposition = values.solutionII_4_3_y3;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 3; values.currentsolutionII_4 = 4;
} else {};
  }
else if (trial.complexII_4.response == "solutionII_4_3_4" && values.solutionII_4_3_4set == 0 && (values.currentsolutionII_4 == 3 || values.currentsolutionII_4 == 0)){
values.solutionII_4_3_4set = 1;
values.solutionII_4_3_feedback_x4 = values.solutionII_4_3_x4;
values.solutionII_4_3_feedback_y4 = values.solutionII_4_3_y4;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_3_x4;
shape.selectedCorner.vposition = values.solutionII_4_3_y4;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 3;
} else {};
}
else if (trial.complexII_4.response == "solutionII_4_4_2" && values.solutionII_4_4_2set == 0 && (values.currentsolutionII_4 == 0 || values.currentsolutionII_4 == 4)){
values.solutionII_4_4_2set = 1;
values.solutionII_4_4_feedback_x2 = values.solutionII_4_4_x2;
values.solutionII_4_4_feedback_y2 = values.solutionII_4_4_y2;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_4_x2;
shape.selectedCorner.vposition = values.solutionII_4_4_y2;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 4;
} else {};
}
else if (trial.complexII_4.response == "solutionII_4_4_3" && values.solutionII_4_4_3set == 0 && (values.currentsolutionII_4 == 4 || values.currentsolutionII_4 == 0)){
values.solutionII_4_4_3set = 1;
values.solutionII_4_4_feedback_x3 = values.solutionII_4_4_x3;
values.solutionII_4_4_feedback_y3 = values.solutionII_4_4_y3;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_4_x3;
shape.selectedCorner.vposition = values.solutionII_4_4_y3;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 4;
} else {};
  }
else if (trial.complexII_4.response == "solutionII_4_4_4" && values.solutionII_4_4_4set == 0 && (values.currentsolutionII_4 == 4 || values.currentsolutionII_4 == 0)){
values.solutionII_4_4_4set = 1;
values.solutionII_4_4_feedback_x4 = values.solutionII_4_4_x4;
values.solutionII_4_4_feedback_y4 = values.solutionII_4_4_y4;
values.selectedcornersii_4 += 1;
   values.ii_4_clickcount += 1;

shape.selectedCorner.hposition = values.solutionII_4_4_x4;
shape.selectedCorner.vposition = values.solutionII_4_4_y4;

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 4;
} else {};
}
else if (trial.complexII_4.response == "done") {
values.stopcondition = 1;

}
else if (trial.complexII_4.response == "back") {
values.selectedcornersii_4 = 0;
values.correctii_4 = 0;

values.solutionII_4_1_set = 0;
values.solutionII_4_1_1set = 0;
values.solutionII_4_1_2set = 0;
values.solutionII_4_1_3set = 0;
values.solutionII_4_1_4set = 0;
values.solutionII_4_1_5set = 0;
values.solutionII_4_1_6set = 0;
values.solutionII_4_1_7set = 0;

values.solutionII_4_2_set = 0;
values.solutionII_4_2_1set = 0;
values.solutionII_4_2_2set = 0;
values.solutionII_4_2_3set = 0;
values.solutionII_4_2_4set = 0;
values.solutionII_4_2_5set = 0;
values.solutionII_4_2_6set = 0;
values.solutionII_4_2_7set = 0;

  values.solutionII_4_3_set = 0;
values.solutionII_4_3_1set = 0;
values.solutionII_4_3_2set = 0;
values.solutionII_4_3_3set = 0;
values.solutionII_4_3_4set = 0;
values.solutionII_4_3_5set = 0;
values.solutionII_4_3_6set = 0;
values.solutionII_4_3_7set = 0;

  values.solutionII_4_4_set = 0;
values.solutionII_4_4_1set = 0;
values.solutionII_4_4_2set = 0;
values.solutionII_4_4_3set = 0;
values.solutionII_4_4_4set = 0;
values.solutionII_4_4_5set = 0;
values.solutionII_4_4_6set = 0;
values.solutionII_4_4_7set = 0;


values.solutionII_4_1_feedback_x1 = -100;
  values.solutionII_4_1_feedback_y1 = -100;
  values.solutionII_4_1_feedback_x2 = -100;
  values.solutionII_4_1_feedback_y2 = -100;
  values.solutionII_4_1_feedback_x3 = -100;
  values.solutionII_4_1_feedback_y3 = -100;
  values.solutionII_4_1_feedback_x4 = -100;
  values.solutionII_4_1_feedback_y4 = -100;
  values.solutionII_4_1_feedback_x5 = -100;
  values.solutionII_4_1_feedback_y5 = -100;
  values.solutionII_4_1_feedback_x6 = -100;
  values.solutionII_4_1_feedback_y6 = -100;
  values.solutionII_4_1_feedback_x7 = -100;
  values.solutionII_4_1_feedback_y7 = -100;


  values.solutionII_4_2_feedback_x1 = -100;
  values.solutionII_4_2_feedback_y1 = -100;
  values.solutionII_4_2_feedback_x2 = -100;
  values.solutionII_4_2_feedback_y2 = -100;
  values.solutionII_4_2_feedback_x3 = -100;
  values.solutionII_4_2_feedback_y3 = -100;
  values.solutionII_4_2_feedback_x4 = -100;
  values.solutionII_4_2_feedback_y4 = -100;
  values.solutionII_4_2_feedback_x5 = -100;
  values.solutionII_4_2_feedback_y5 = -100;
  values.solutionII_4_2_feedback_x6 = -100;
  values.solutionII_4_2_feedback_y6 = -100;
  values.solutionII_4_2_feedback_x7 = -100;
  values.solutionII_4_2_feedback_y7 = -100;
 
  values.solutionII_4_3_feedback_x1 = -100;
  values.solutionII_4_3_feedback_y1 = -100;
  values.solutionII_4_3_feedback_x2 = -100;
  values.solutionII_4_3_feedback_y2 = -100;
  values.solutionII_4_3_feedback_x3 = -100;
  values.solutionII_4_3_feedback_y3 = -100;
  values.solutionII_4_3_feedback_x4 = -100;
  values.solutionII_4_3_feedback_y4 = -100;
  values.solutionII_4_3_feedback_x5 = -100;
  values.solutionII_4_3_feedback_y5 = -100;
  values.solutionII_4_3_feedback_x6 = -100;
  values.solutionII_4_3_feedback_y6 = -100;
  values.solutionII_4_3_feedback_x7 = -100;
  values.solutionII_4_3_feedback_y7 = -100;
 
  values.solutionII_4_4_feedback_x1 = -100;
  values.solutionII_4_4_feedback_y1 = -100;
  values.solutionII_4_4_feedback_x2 = -100;
  values.solutionII_4_4_feedback_y2 = -100;
  values.solutionII_4_4_feedback_x3 = -100;
  values.solutionII_4_4_feedback_y3 = -100;
  values.solutionII_4_4_feedback_x4 = -100;
  values.solutionII_4_4_feedback_y4 = -100;
  values.solutionII_4_4_feedback_x5 = -100;
  values.solutionII_4_4_feedback_y5 = -100;
  values.solutionII_4_4_feedback_x6 = -100;
  values.solutionII_4_4_feedback_y6 = -100;
  values.solutionII_4_4_feedback_x7 = -100;
  values.solutionII_4_4_feedback_y7 = -100;
 

values.response_x = -100;
values.response_y = -100;

}
else {
values.wrongselection = 1;
};

if (trial.complexII_4.response == "background" || values.wrongselection == 1)

{
values.response_x = trial.complexII_4.responsex;
values.response_y = trial.complexII_4.responsey;
};
if (values.solutionII_4_1_1set == 1 && values.solutionII_4_1_2set == 1 && values.solutionII_4_1_3set == 1 && values.solutionII_4_1_4set == 1 && values.solutionII_4_1_5set == 1 && values.solutionII_4_1_6set == 1 && values.solutionII_4_1_7set == 1 &&
values.selectedcornersii_4 == values.numberofcornersII_4) {
values.correctii_4 = 1;
}
else if (values.solutionII_4_2_1set == 1 && values.solutionII_4_2_2set == 1 && values.solutionII_4_2_3set == 1 && values.solutionII_4_2_4set == 1 && values.solutionII_4_2_5set == 1 && values.solutionII_4_2_6set == 1 && values.solutionII_4_2_7set == 1 &&
values.selectedcornersii_4 == values.numberofcornersII_4) {
values.correctii_4 = 1;
  }
else if (values.solutionII_4_3_1set == 1 && values.solutionII_4_3_2set == 1 && values.solutionII_4_3_3set == 1 && values.solutionII_4_3_4set == 1 && values.solutionII_4_3_5set == 1 && values.solutionII_4_3_6set == 1 && values.solutionII_4_3_7set == 1 &&
values.selectedcornersii_4 == values.numberofcornersII_4) {
values.correctii_4 = 1;
}
else if (values.solutionII_4_4_1set == 1 && values.solutionII_4_4_2set == 1 && values.solutionII_4_4_3set == 1 && values.solutionII_4_4_4set == 1 && values.solutionII_4_4_5set == 1 && values.solutionII_4_4_6set == 1 && values.solutionII_4_4_7set == 1 &&
values.selectedcornersii_4 == values.numberofcornersII_4) {
values.correctii_4 = 1;
}
else {values.correctii_4 = 0}
]



Dave
Dave
Supreme Being
Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)

Group: Administrators
Posts: 9.2K, Visits: 39K
Sorry, but the code does not make much sense in isolation. I can tell you this, though: The response options you list in /validresponse are evaluated *in the order given*. I.e., suppose you have two stimuli that overlap on-screen, <shape red> in the background and <shape green> in the foreground as per the /stimulusframes attribute:
----
<shape red>
/ shape = rectangle
/ color = red
/ size = (25%, 25%)
/ position = (50%, 40%)
</shape>

<shape green>
/ shape = rectangle
/ color = green
/ size = (25%, 25%)
/ position = (55%, 45%)
</shape>

<trial mytrial>
/ stimulusframes = [1=red, green]
/ inputdevice = mouse
/ validresponse = (red, green)
</trial>

<block myblock>
/ trials = [1=mytrial]
</block>
----

With

/ validresponse = (red, green)

defined in the <trial>, clicking anywhere on the green shape *within the area it overlaps with the red shape* will record the response as "red".

Conversely, defining

/ validresponse = (green, red)

will record a response in the overlapping area as "green".

wsly
wsly
Partner Member
Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)

Group: Forum Members
Posts: 10, Visits: 61
And is there any way to randomize the order? I have added the script so you can check for yourself what i am doing wrong. 
I thought it was a matter of adding a sort of logical to my conditionals. 

if (values.currentsolutionII_4 == 0){
values.currentsolutionII_4 = 1; values.currentsolutionII_4 = 3;
} else {};

What I need is to code: "if the values of current solution is set to 0 (no corners belonging to that solution already clicked), then the current solution can be 4 AND 3. Is there such a thing? 

Attachments
GEFT 2016.iqx (225 views, 559.00 KB)
III_3.png (228 views, 199.00 KB)
simpleE.png (245 views, 40.00 KB)
Dave
Dave
Supreme Being
Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)

Group: Administrators
Posts: 9.2K, Visits: 39K
Since I cannot run that script and actually see what it's supposed to do (I don't have all the image files it requires, obviously), it is of limited use to me, I'm afraid. Can you strip that thing down to a single example and post just that along with the few stimuli needed to actually execute it?

> And is there any way to randomize the order?

No.

> What I need is to code: "if the values of current solution is set to 0 (no corners belonging to that solution already clicked), then the
> current solution can be 4 AND 3. Is there such a thing?

Not like that:

        if (values.currentsolutionII_4 == 0){
            values.currentsolutionII_4 = 1; values.currentsolutionII_4 = 3;
        } else {};

A variable (<values> entry) can take on a single value at any given time. It cannot be equal to both 1 AND 3 at the same time. You'd need two separate variables instead. In the above code, values.currentsolutionII_4 would always end up being set to 3.

wsly
wsly
Partner Member
Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)

Group: Forum Members
Posts: 10, Visits: 61
here it is, just the code for problem II_4 with the stimuli.

Different solutions have different corners' colors.

I'm in despair,
please helpppppppppppp!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Sad Sad Sad
Attachments
ii_4.iqx (228 views, 59.00 KB)
simpleE.png (244 views, 40.00 KB)
Mask.png (247 views, 6.00 KB)
II_4.png (240 views, 220.00 KB)
Dave
Dave
Supreme Being
Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)

Group: Administrators
Posts: 9.2K, Visits: 39K
Thanks for the stripped-down script. FYI: I am working on / through this, but this isn't exactly trivial.

Dave
Dave
Supreme Being
Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)Supreme Being (516K reputation)

Group: Administrators
Posts: 9.2K, Visits: 39K
Thanks for the stripped-down example. That makes it somewhat easier to assess. The bottom line, in my opinion, is this: In order to make this work, the whole thing needs to be re-framed to a substantial degree. What you'll want to avoid at any cost is overlapping response objects. Instead, have one -- and only one -- object per corner. In case of the example problem, that means you'd have a total of 19 clickable circles on-screen. A given circle can "belong to" several possible solutions, in some cases as many 3 in the example. In each instance of the <trial>, you'll want to (a) store a the set of solutions the clicked object is part of and then (b) check whether there is overlap in the solutions associated with the selected object and those associated with the *previously* selected objects. As long as that holds true, the response is valid / correct.

To illustrate what I mean, consider a simple example. Suppose you have a rectangle comprised of eight circles on-screen -- named c1 to c8, left to right, top to bottom -- and your objective is to select four of them to highlight a square. There are three solutions: (1) Select c1, c2, c3 and c4 -- the four circles on the top, or (2) select c3, c4, c5 and c6 -- the four middle circles, or (3) the four bottom circles -- c5 to c8. Obviously, the c3 and c4 are part of  solutions #1 and# 2, c5 and c6 are part of solutions #2 and 3. In other words: While selecting c1 automatically commits you to a particular solution (#1), selecting e.g. c3 first does not commit you to a single solution yet -- you could still go for #1 or #2. Selecting c4 as the 2nd response also doesn't commit you -- both #1 and #2 are still in the cards at this point, etc.

What is needed is a way to encode which possible solutions each circle applies to. E.g.

<values>
...
/ c3_applies_to_solution_1 = true
/ c3_applies_to_solution_2 = true
/ c3_applies_to_solution_3 = false
...
</values>

means that response c3 applies to solution #1 (true), solution #2 (true), but not solution #3 (false). You can then evaluate those properties against the still applicable solutions as you proceed through the trial.

Here's how you would code that:

<values>
/ c1_applies_to_solution_1 = true
/ c1_applies_to_solution_2 = false
/ c1_applies_to_solution_3 = false

/ c2_applies_to_solution_1 = true
/ c2_applies_to_solution_2 = false
/ c2_applies_to_solution_3 = false

/ c3_applies_to_solution_1 = true
/ c3_applies_to_solution_2 = true
/ c3_applies_to_solution_3 = false

/ c4_applies_to_solution_1 = true
/ c4_applies_to_solution_2 = true
/ c4_applies_to_solution_3 = false

/ c5_applies_to_solution_1 = false
/ c5_applies_to_solution_2 = true
/ c5_applies_to_solution_3 = true

/ c6_applies_to_solution_1 = false
/ c6_applies_to_solution_2 = true
/ c6_applies_to_solution_3 = true

/ c7_applies_to_solution_1 = false
/ c7_applies_to_solution_2 = false
/ c7_applies_to_solution_3 = true

/ c8_applies_to_solution_1 = false
/ c8_applies_to_solution_2 = false
/ c8_applies_to_solution_3 = true

/ c1_x = 40%
/ c1_y = 20%
/ c2_x = 60%
/ c2_y = 20%
/ c3_x = 40%
/ c3_y = 40%
/ c4_x = 60%
/ c4_y = 40%
/ c5_x = 40%
/ c5_y = 60%
/ c6_x = 60%
/ c6_y = 60%
/ c7_x = 40%
/ c7_y = 80%
/ c8_x = 60%
/ c8_y = 80%

/ solution_1_applicable = true
/ solution_2_applicable = true
/ solution_3_applicable = true

/ response_applies_to_solution_1 = true
/ response_applies_to_solution_2 = true
/ response_applies_to_solution_3 = true

/ correctcorner_size = 3%

/ possible_solutions = ""
/ responsestorage = ""
/ current_response_solutions = ""
/ response_correct = 0
/ committed = "No"
/ committedsolutionnumber = ""
</values>

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

<trial starttrial>
/ ontrialbegin = [values.solution_1_applicable = true; values.solution_2_applicable = true; values.solution_3_applicable = true;
    values.response_applies_to_solution_1 = true; values.response_applies_to_solution_2 = true; values.response_applies_to_solution_3 = true;
    shape.selectedcorner.hposition = -10%; shape.selectedcorner.vposition = -10%; ]
/ stimulusframes = [1=c1,c2,c3,c4,c5,c6,c7,c8,done,debug]
/ trialduration = 1000
/ branch = [trial.clicktrial]
</trial>

<text debug>
/ items = ("Solution #1 applicable: <%values.solution_1_applicable%> | Solution #2 applicable: <%values.solution_2_applicable%> | Solution #3 applicable: <%values.solution_3_applicable%>
Response <%trial.clicktrial.response%> applies to #1: <%values.response_applies_to_solution_1%> #2: <%values.response_applies_to_solution_2%> #3: <%values.response_applies_to_solution_3%>
Responses: <%values.responsestorage%>")
/ position = (50%, 10%)
/ size = (90%, 10%)
/ erase = false
</text>

<text done>
/ items = ("DONE")
/ position = (50%, 90%)
/ erase = false
</text>


<trial clicktrial>
/ stimulusframes = [1=selectedcorner, debug]
/ validresponse = (c1,c2,c3,c4,c5,c6,c7,c8,done)
/ isvalidresponse = [!contains(values.responsestorage, trial.clicktrial.response)]
/ inputdevice = mouse
/ ontrialend = [values.responsestorage = concat(values.responsestorage, trial.clicktrial.response)]
/ ontrialend = [
    if (trial.clicktrial.response == "c1") {
    values.response_applies_to_solution_1 = values.c1_applies_to_solution_1;
    values.response_applies_to_solution_2 = values.c1_applies_to_solution_2;
    values.response_applies_to_solution_3 = values.c1_applies_to_solution_3;
    shape.selectedcorner.hposition = values.c1_x;
    shape.selectedcorner.vposition = values.c1_y; }
    else if (trial.clicktrial.response == "c2") {
    values.response_applies_to_solution_1 = values.c2_applies_to_solution_1;
    values.response_applies_to_solution_2 = values.c2_applies_to_solution_2;
    values.response_applies_to_solution_3 = values.c2_applies_to_solution_3;
    shape.selectedcorner.hposition = values.c2_x;
    shape.selectedcorner.vposition = values.c2_y; }

    else if (trial.clicktrial.response == "c3") {
    values.response_applies_to_solution_1 = values.c3_applies_to_solution_1;
    values.response_applies_to_solution_2 = values.c3_applies_to_solution_2;
    values.response_applies_to_solution_3 = values.c3_applies_to_solution_3;
    shape.selectedcorner.hposition = values.c3_x;
    shape.selectedcorner.vposition = values.c3_y; }

    else if (trial.clicktrial.response == "c4") {
    values.response_applies_to_solution_1 = values.c4_applies_to_solution_1;
    values.response_applies_to_solution_2 = values.c4_applies_to_solution_2;
    values.response_applies_to_solution_3 = values.c4_applies_to_solution_3;
    shape.selectedcorner.hposition = values.c4_x;
    shape.selectedcorner.vposition = values.c4_y; }

    else if (trial.clicktrial.response == "c5") {
    values.response_applies_to_solution_1 = values.c5_applies_to_solution_1;
    values.response_applies_to_solution_2 = values.c5_applies_to_solution_2;
    values.response_applies_to_solution_3 = values.c5_applies_to_solution_3;
    shape.selectedcorner.hposition = values.c5_x;
    shape.selectedcorner.vposition = values.c5_y; }

    else if (trial.clicktrial.response == "c6") {
    values.response_applies_to_solution_1 = values.c6_applies_to_solution_1;
    values.response_applies_to_solution_2 = values.c6_applies_to_solution_2;
    values.response_applies_to_solution_3 = values.c6_applies_to_solution_3;
    shape.selectedcorner.hposition = values.c6_x;
    shape.selectedcorner.vposition = values.c6_y; }

    else if (trial.clicktrial.response == "c7") {
    values.response_applies_to_solution_1 = values.c7_applies_to_solution_1;
    values.response_applies_to_solution_2 = values.c7_applies_to_solution_2;
    values.response_applies_to_solution_3 = values.c7_applies_to_solution_3;
    shape.selectedcorner.hposition = values.c7_x;
    shape.selectedcorner.vposition = values.c7_y; }

    else if (trial.clicktrial.response == "c8") {
    values.response_applies_to_solution_1 = values.c8_applies_to_solution_1;
    values.response_applies_to_solution_2 = values.c8_applies_to_solution_2;
    values.response_applies_to_solution_3 = values.c8_applies_to_solution_3;
    shape.selectedcorner.hposition = values.c8_x;
    shape.selectedcorner.vposition = values.c8_y; };
    ]

/ ontrialend = [values.solution_1_applicable = values.solution_1_applicable * values.response_applies_to_solution_1;
    values.solution_2_applicable = values.solution_2_applicable * values.response_applies_to_solution_2;
    values.solution_3_applicable = values.solution_3_applicable * values.response_applies_to_solution_3; ]

/ ontrialend = [if (values.solution_1_applicable || values.solution_2_applicable || values.solution_3_applicable)
    values.response_correct = 1 else values.response_correct = 0; ]

/ branch = [if (values.response_correct == 1) trial.clicktrial else trial.errortrial]
</trial>

<trial errortrial>
/ ontrialbegin = [text.redx.hposition = shape.selectedcorner.hposition; text.redx.vposition = shape.selectedcorner.vposition; ]
/ stimulusframes = [1=redx]
/ trialduration = 500
/ branch = [trial.starttrial]
</trial>

<text redx>
/ items = ("X")
/ fontstyle = ("Arial", 5%, true)
/ txcolor = red
/ txbgcolor = transparent
/ erase = true(white)
</text>

<shape c1>
/ shape = circle
/ color = blue
/ hposition = values.c1_x
/ vposition = values.c1_y
/ size = (values.correctcorner_size * 0.75, values.correctcorner_size)
/ erase = false
</shape>

<shape c2>
/ shape = circle
/ color = blue
/ hposition = values.c2_x
/ vposition = values.c2_y
/ size = (values.correctcorner_size * 0.75, values.correctcorner_size)
/ erase = false
</shape>

<shape c3>
/ shape = circle
/ color = blue
/ hposition = values.c3_x
/ vposition = values.c3_y
/ size = (values.correctcorner_size * 0.75, values.correctcorner_size)
/ erase = false
</shape>

<shape c4>
/ shape = circle
/ color = blue
/ hposition = values.c4_x
/ vposition = values.c4_y
/ size = (values.correctcorner_size * 0.75, values.correctcorner_size)
/ erase = false
</shape>

<shape c5>
/ shape = circle
/ color = blue
/ hposition = values.c5_x
/ vposition = values.c5_y
/ size = (values.correctcorner_size * 0.75, values.correctcorner_size)
/ erase = false
</shape>

<shape c6>
/ shape = circle
/ color = blue
/ hposition = values.c6_x
/ vposition = values.c6_y
/ size = (values.correctcorner_size * 0.75, values.correctcorner_size)
/ erase = false
</shape>

<shape c7>
/ shape = circle
/ color = blue
/ hposition = values.c7_x
/ vposition = values.c7_y
/ size = (values.correctcorner_size * 0.75, values.correctcorner_size)
/ erase = false
</shape>

<shape c8>
/ shape = circle
/ color = blue
/ hposition = values.c8_x
/ vposition = values.c8_y
/ size = (values.correctcorner_size * 0.75, values.correctcorner_size)
/ erase = false
</shape>

<shape selectedCorner>
/ shape = circle
/ color = yellow
/ size = (values.correctcorner_size * 0.75, values.correctcorner_size)
/ erase = false
/ hposition = -10%
/ vposition = -10%
</shape>

Hope this helps.

Edited
2 Years Ago by Dave
wsly
wsly
Partner Member
Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)Partner Member (766 reputation)

Group: Forum Members
Posts: 10, Visits: 61
Thank you for your reply and your efforts. In fact, the code had been commissioned to Katja B. who wrote it for my research team. I am not sure I can fully understand how to customize the code according to your example, so I might need to pass it on her to be sure that everything run properly and correctly as it is a huge research and everything should be incontestable once we will have our data collected. 
Thank you very much indeed!!!!!!!

GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search