+xHi,
I have an experiment where participants have to choose which of three images they have seen before. Each image has a number underneath (1,2 and 3 - always in the same locations) they enter the number on the keyboard that corresponds to the number underneath the correct image - but the location of the images is random.
I've done this by setting the image positions with a counter - see below
<picture D>
/ items = ("D.png")
/ hposition = counter.poscounter.selectedvalue
/ vposition = 50
</picture>
<picture D2>
/ items = ("D2.png")
/ hposition = counter.poscounter.selectedvalue
/ vposition = 50
</picture>
<picture Dcorrect>
/ items = ("Dcorrect.png")
/ hposition = counter.poscounter.selectedvalue
/ vposition = 50
</picture>
<counter poscounter>
/ items = (25, 50, 75)
/ select = noreplace
/ selectionrate = always
</counter>
So this means the correct response will vary on every trial depending on which location picture.Dcorrect is allocated to. I have tried to record the correct response based on location in an expression update in the trial. But I can't get this to work, the data records expressions.correctpos as 1 every time and always thinks the correct response is pressed even when it's not. The trial is below...
<trial doughnut>
/ ontrialbegin = [
values.category= "food"
]
/ ontrialbegin = [if (picture.Dcorrect.hposition= 25) expressions.correctpos = "1"
else if(picture.Dcorrect.hposition= 50) expressions.correctpos = "2"
else if(picture.Dcorrect.hposition= 75) expressions.correctpos = "3"]
/ stimulusframes = [1=D, D2, Dcorrect, no1, no2, no3]
/ validresponse = ("1", "2", "3")
/ iscorrectresponse = [expressions.correctpos]
/ ontrialend = [
if (trial.doughnut.correct) {
values.foodcorrect +=1
}
]
</trial>
- In addition two of the images seem to overlap sometimes - but not consistently?
Any help would be appreciated. I have attached a shortened version of the script too.
Thank you
There are syntax mistakes in your expression, your /iscorrectresponse attribute as well as in the way you use the position counter (because it is set to /selectionrate always, it will return a new position every time you query the picture element's hposition attribute; you should only perform a selection once /ontrialbegin and store the positions in <values>). Finally, the response property returns a key's numerical scancode, not the symbol (letter, digit) printed on the respective key. In sum, adjusting your code like so
<values>
/category = 0
/foodcorrect = 0
/ d1_h = 0%
/ d2_h = 0%
/ correct_h = 0%
/correctpos = ""</values>
**************************************************************
RESPONSES
**************************************************************
<text no1>
/ items = ("1")
/ position = (25, 62)
/ color = black
</text>
<text no2>
/ items = ("2")
/ position = (50, 62)
/ color = black
</text>
<text no3>
/ items = ("3")
/ position = (75, 62)
/ color = black
</text>
<picture D>
/ items = ("D.png")
/ hposition = values.d1_h/ vposition = 50
</picture>
<picture D2>
/ items = ("D2.png")
/ hposition = values.d2_h/ vposition = 50
</picture>
<picture Dcorrect>
/ items = ("Dcorrect.png")
/ hposition = values.correct_h/ vposition = 50
</picture>
<counter poscounter>
/ items = (25%, 50%, 75%)
/ select = noreplace
/ selectionrate = always
</counter>
//numerical scancodes for the digit keys "1", "2", and "3"
// are 2, 3, and 4 respectively:<trial doughnut>
/ ontrialbegin = [
values.category= "food";
values.d1_h = counter.poscounter.selectedvalue;
values.d2_h = counter.poscounter.selectedvalue;
values.correct_h = counter.poscounter.selectedvalue; ]
/ ontrialbegin = [if (picture.Dcorrect.hposition==25%) values.correctpos = 2
else if(picture.Dcorrect.hposition==50%) values.correctpos = 3
else if(picture.Dcorrect.hposition==75%) values.correctpos = 4;
]/ stimulusframes = [1=D, D2, Dcorrect, no1, no2, no3]
/ validresponse = (2, 3, 4)/ iscorrectresponse = [trial.doughnut.response == values.correctpos]/ ontrialend = [
if (trial.doughnut.correct) {
values.foodcorrect +=1
}
]
</trial>
*******
****************************************************
EXAMPLE TRIAL
****************************************************
<shape examplecorrect>
/ shape = circle
/ color = green
/ position = (25, 50)
/ size = (50, 50)
</shape>
<text examplenum1>
/ items = ("1")
/ position = (25, 62)
/ color = black
</text>
<shape example2>
/ shape = circle
/ color = yellow
/ position = (50, 50)
/ size = (50, 50)
</shape>
<text examplenum2>
/ items = ("2")
/ position = (50, 62)
/ color = black
</text>
<shape example>
/ shape = circle
/ color = red
/ position = (75, 50)
/ size = (50, 50)
</shape>
<text examplenum3>
/ items = ("3")
/ position = (75, 62)
/ color = black
</text>
<text exampleinstruct>
/items= ("This is an example, none of these shapes appeared during the experiment
If you recognised the green circle from the experiment,
you would press 1 on your keyboard
Press 1 on your keyboard to move on to the actual trials
you will now be shown images you have seen previously")
/ position = (50%, 20%)
</text>
<trial examplemem>
/ stimulusframes = [1=example, example2, examplecorrect, examplenum1, examplenum2, examplenum3, exampleinstruct]
/ validresponse = ("1", "2", "3")
/ correctresponse = ("1")
</trial>
<page instructions>
^^ You will now be asked to recognise the distractor images presented in the task.
^^ You will be shown three similar images, one of which was presented during the task.
^^Press the key corresponding to the image you think you saw during the task.
^^Press space to see an example trial.
</page>
<page end>
^^You have finished the computer task.
^^Thank you!
</page>
<instruct>
/ nextkey = (" ")
/ prevkey = ("6")
/ screencolor = darkgrey
/ txcolor = black
</instruct>
<defaults >
/ screencolor = darkgrey
/ txbgcolor = darkgrey
/canvasaspectratio = (4,3)
/ canvassize = (98%, 98%)
</defaults>
<list trials>
/ items = (trial.doughnut)
/ selectionmode = random
</list>
<block memory>
/ trials = [1 = examplemem; 2 = list.trials]
/ preinstructions = (instructions)
/ postinstructions = (end)
</block>
<data>
/ columns = (date, time, group, subject, trialcode, blockcode, correct, stimulus, values.category, values.foodcorrect, values.correctpos, response)
/ separatefiles = true
</data>
should do the trick.