Millisecond Forums

dragging pictures for a matching task

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

By Lucie1043 - 9/24/2016

Hi,

I am currently working on a new matching task. 
First, an instruction appears on the screen "Ex : Red same as ?". Then three samples appear on the bottom of the screen. The participant has to drag one of the three samples into the black square with the question mark.
When the sample is dropped, we ask the participant to confirm is response : the instruction appears on the screen with the sample he previously selected. The participant can choose to try again (pressing the "start again" button reset all the stimuli to where they were before the sample was dropped) or to validate his answer (which launches a feedback trial).

At the moment, I only implemented the "drag and drop" feature for the "match_sample" element. But I am already facing different issues : 
- during the trial "correctselection" all the stimuli become blurry
- if I press "start again" in the second phase of the experiment, the dropped sample doesn't go back to its previous position.

Could you please help me?

Thanks a lot,
Lucie

Here is my script :

*****************************************************************************************************************
*****************************************************************************************************************
Values
*****************************************************************************************************************
*****************************************************************************************************************

<values>
/match_hposition = 0
/nonmatch1_hposition = 0
/nonmatch2_hposition = 0

/ match_vposition = 0
/ nonmatch1_vposition = 0
/ nonmatch2_vposition = 0

/match_selection = 0
/nonmatch1_selection = 0
/nonmatch2_selection = 0
</values>

*****************************************************************************************************************
*****************************************************************************************************************
Expressions
*****************************************************************************************************************
*****************************************************************************************************************

<expressions>
/ match_hpct = 100pct*(trial.correctselection.responsex/display.width)
/ match_vpct = 100pct*(trial.correctselection.responsey/display.height)
</expressions>


***********************************************************************************************************************************
L'instruction à compléter
***********************************************************************************************************************************


<item cibleA>
/1 = "cibleA.jpg"
</item>

<picture targetA>
/ items = cibleA
/ position = (25, 25)
</picture>

<text frametarget>
/ items = ("...")
/ position = (50, 25)
</text>

<picture drop_sample>
/ items = ("comparaison blank.jpg")
/ position = (75, 25)
</picture>

<picture line>
/ items = ("line.jpg")
/ position = (50, 50)
</picture>

Les items comparaison

<item sample>
/1 = "comparaison B.jpg"
/2 = "distracteur 1.jpg"
/3 = "distracteur 2.jpg"
</item>

<picture sample_match>
/items = sample
/select = values.match_selection
/vposition = values.match_vposition
/hposition = values.match_hposition
</picture>

<picture sample_nonmatch1>
/items = sample
/select = values.nonmatch1_selection
/vposition = values.nonmatch1_vposition
/hposition = values.nonmatch1_hposition
</picture>

<picture sample_nonmatch2>
/items = sample
/select = values.nonmatch2_selection
/vposition = values.nonmatch2_vposition
/hposition = values.nonmatch2_hposition
</picture>

**********************************************************************************************************************************
Les éléments pour la phase d'évaluation
**********************************************************************************************************************************

<picture sample_matchE>
/items = sample
/select = picture.targeta.currentindex
/vposition = 25%
/hposition = 75%
</picture>

<picture sample_nonmatch1E>
/items = sample
/select = values.nonmatch1_selection
/vposition = 25%
/hposition = 75%
</picture>

<picture sample_nonmatch2E>
/items = sample
/select = values.nonmatch2_selection
/vposition = 25%
/hposition = 75%
</picture>

**********************************************************************************************************************************
LES LISTES POUR UN ESSAI RCP
**********************************************************************************************************************************

<list randomhposition>
/ items = (25%, 50%, 75%)
/ selectionrate = always
</list>

<list nonmatch1>
/ items = (1, 2, 3)
/ selectionrate = always
/ not = (picture.sample_match.nextindex)
</list>

<list nonmatch2>
/ items = (1, 2, 3)
/ selectionrate = always
/ not = (list.nonmatch1.currentindex; picture.sample_match.currentindex)
</list>



*****************************************************************************************************************
*****************************************************************************************************************
Trial Elements
*****************************************************************************************************************
*****************************************************************************************************************

<trial newround>
/ ontrialbegin = [values.match_hposition= list.randomhposition.nextvalue; values.nonmatch1_hposition = list.randomhposition.nextvalue;
values.nonmatch2_hposition = list.randomhposition.nextvalue; values.match_selection = picture.targeta.currentindex;
values.nonmatch1_selection = list.nonmatch1.nextindex; values.nonmatch2_selection = list.nonmatch2.nextindex;
values.match_vposition = 70%; values.nonmatch1_vposition = 70% ; values.nonmatch2_vposition = 70%]
/ stimulusframes = [1= startmsg]
/ validresponse = (anyresponse)
/ recorddata = false
/ branch = [trial.RCP_choice]
</trial>

<trial RCP_choice>
/ stimulusframes = [1 = targetA; 10 = frametarget; 20 = drop_sample ; 30 = line ; 50 = sample_match, sample_nonmatch1, sample_nonmatch2]
/ inputdevice = mouse
/ validresponse = (sample_match, sample_nonmatch1, sample_nonmatch2)
/ correctresponse = (sample_match)
/ branch = [if(trial.RCP_choice.response=="sample_match") trial.correctselection]
/ branch = [if(trial.RCP_choice.response=="sample_nonmatch1") trial.incorrectmove1]
/ branch = [if(trial.RCP_choice.response=="sample_nonmatch2") trial.incorrectmove2]
</trial>

<trial correctselection>
/inputdevice = mouse
/stimulusframes = [1= drop_sample, sample_match, line, targetA, sample_nonmatch1, sample_nonmatch2]
/validresponse = (mousemove, lbuttondown)
/numframes = 1
/ontrialend = [values.match_hposition = expressions.match_hpct; values.match_vposition = expressions.match_vpct]
/ branch = [if (trial.correctselection.response!="lbuttondown") trial.correctselection else trial.correctmove]
</trial>

<trial correctmove>
/ stimulusframes = [1 = targetA, frametarget, sample_matchE, resetround, clickresetround, nextround, clicknextround]
/ validresponse = (resetround, clickresetround, nextround, clicknextround)
/ inputdevice = mouse
/ branch = [if (trial.correctmove.response=="nextround") trial.congratulations else trial.rcp_choice]
</trial>

<trial incorrectmove1>
/ stimulusframes = [1 = targetA, frametarget, sample_nonmatch1E, resetround, clickresetround, nextround, clicknextround]
/ validresponse = (resetround, clickresetround, nextround, clicknextround)
/ inputdevice = mouse
/ branch = [if (trial.incorrectmove1.response=="nextround") trial.error else trial.rcp_choice]
</trial>

<trial incorrectmove2>
/ stimulusframes = [1 = targetA, frametarget, sample_nonmatch2E, resetround, clickresetround, nextround, clicknextround]
/ validresponse = (resetround, clickresetround, nextround, clicknextround)
/ inputdevice = mouse
/ branch = [if (trial.incorrectmove2.response=="nextround") trial.error else trial.rcp_choice]
</trial>


<trial congratulations>
/ stimulusframes = [1= congratulations, next]
/ inputdevice = mouse
/ validresponse = ("next")
</trial>

<trial error>
/ stimulusframes = [1= error, next]
/ inputdevice = mouse
/ validresponse = ("next")
</trial>



****************************************************************************************************************
LES PAGES ERREUR ET FELICITATIONS
****************************************************************************************************************



<text error>
/ items = ("You lose")
/ position = (50%, 40%)
/ txcolor = (255, 0, 0)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text congratulations>
/ items = ("congratulations")
/ position = (50%, 40%)
/ txcolor = (255, 0, 0)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text next>
/ items = ("next")
/ position = (50%, 70%)
</text>

<shape clearscreen>
/ color = (white)
/ shape = rectangle
/ size = (100%, 100%)
</shape>

*****************************************************************************************************************
*****************************************************************************************************************
Elements
*****************************************************************************************************************
*****************************************************************************************************************

<text resetround>
/ items = ("Start again")
/ fontstyle = ("Arial", 2.50%, true)
/ vjustify = center
/ txcolor = (black)
/ txbgcolor = (white)
/ size = (20%,4%)
/ position = (35%,98%)
/ valign = bottom
</text>

<text clickresetround>
/ items = ("Start again")
/ fontstyle = ("Arial", 2.50%, true)
/ vjustify = center
/ txcolor = (white)
/ txbgcolor = (black)
/ size = (20%,4%)
/ position = (35%,98%)
/ valign = bottom
</text>

<text nextround>
/ items = ("I valid")
/ fontstyle = ("Arial", 2.50%, true)
/ vjustify = center
/ txcolor = (black)
/ txbgcolor = (white)
/ size = (20%,4%)
/ position = (65%,98%)
/ valign = bottom
</text>

<text clicknextround>
/ items = ("I valid")
/ fontstyle = ("Arial", 2.50%, true)
/ vjustify = center
/ txcolor = (white)
/ txbgcolor = (black)
/ size = (20%,4%)
/ position = (65%,98%)
/ valign = bottom
</text>

<text startmsg>
/ items = ("Get ready...")
/ fontstyle = ("Arial", 3.50%, true)
/ txbgcolor = (transparent)
/ select = 1
/ position = (50%,40%)
/ hjustify = center
/ vjustify = center
</text>

*****************************************************************************************************************
*****************************************************************************************************************

<block RCP>
/ trials = [1-3= newround]
</block>


By Dave - 9/25/2016

> - during the trial "correctselection" all the stimuli become blurry

They're not becoming blurry, they flicker as they should. You need to set the various stimuli's /erase attributes to 'false' to have them remain on-screen without flickering.

> -  if I press "start again" in the second phase of the experiment, the dropped sample doesn't go back to its previous position.

You need to explicitly re-set the respective element's position to its original position in case of a "start again" response.

(Since you did not include the actual images, I have had to change the <picture> elements to <text> elements)

*****************************************************************************************************************
*****************************************************************************************************************
Values
*****************************************************************************************************************
*****************************************************************************************************************

<values>
/match_hposition = 0
/match_hposition_org = 0

/nonmatch1_hposition = 0
/nonmatch2_hposition = 0

/ match_vposition = 0
/ match_vposition_org = 0

/ nonmatch1_vposition = 0
/ nonmatch2_vposition = 0

/match_selection = 0
/nonmatch1_selection = 0
/nonmatch2_selection = 0
</values>

*****************************************************************************************************************
*****************************************************************************************************************
Expressions
*****************************************************************************************************************
*****************************************************************************************************************

<expressions>
/ match_hpct = 100pct*(trial.correctselection.responsex/display.width)
/ match_vpct = 100pct*(trial.correctselection.responsey/display.height)
</expressions>


***********************************************************************************************************************************
L'instruction à compléter
***********************************************************************************************************************************


<item cibleA>
/1 = "cibleA.jpg"
</item>

<text targetA>
/ items = cibleA
/ position = (25, 25)
/ erase = false
</text>

<text frametarget>
/ items = ("...")
/ position = (50, 25)
/ erase = false
</text>

<text drop_sample>
/ items = ("comparaison blank.jpg")
/ position = (75, 25)
/ erase = false
</text>

<text line>
/ items = ("line.jpg")
/ position = (50, 50)
/ erase = false
</text>

Les items comparaison

<item sample>
/1 = "comparaison B.jpg"
/2 = "distracteur 1.jpg"
/3 = "distracteur 2.jpg"
</item>

<text sample_match>
/items = sample
/select = values.match_selection
/vposition = values.match_vposition
/hposition = values.match_hposition
/ erase = false
</text>

<text sample_nonmatch1>
/items = sample
/select = values.nonmatch1_selection
/vposition = values.nonmatch1_vposition
/hposition = values.nonmatch1_hposition
/ erase = false
</text>

<text sample_nonmatch2>
/items = sample
/select = values.nonmatch2_selection
/vposition = values.nonmatch2_vposition
/hposition = values.nonmatch2_hposition
/ erase = false
</text>

**********************************************************************************************************************************
Les éléments pour la phase d'évaluation
**********************************************************************************************************************************

<text sample_matchE>
/items = sample
/select = text.targeta.currentindex
/vposition = 25%
/hposition = 75%
/ erase = false
</text>

<text sample_nonmatch1E>
/items = sample
/select = values.nonmatch1_selection
/vposition = 25%
/hposition = 75%
/ erase = false
</text>

<text sample_nonmatch2E>
/items = sample
/select = values.nonmatch2_selection
/vposition = 25%
/hposition = 75%
/ erase = false
</text>

**********************************************************************************************************************************
LES LISTES POUR UN ESSAI RCP
**********************************************************************************************************************************

<list randomhposition>
/ items = (25%, 50%, 75%)
/ selectionrate = always
</list>

<list nonmatch1>
/ items = (1, 2, 3)
/ selectionrate = always
/ not = (text.sample_match.nextindex)
</list>

<list nonmatch2>
/ items = (1, 2, 3)
/ selectionrate = always
/ not = (list.nonmatch1.currentindex; text.sample_match.currentindex)
</list>



*****************************************************************************************************************
*****************************************************************************************************************
Trial Elements
*****************************************************************************************************************
*****************************************************************************************************************

<trial newround>
/ ontrialbegin = [values.match_hposition= list.randomhposition.nextvalue; values.nonmatch1_hposition = list.randomhposition.nextvalue;
values.nonmatch2_hposition = list.randomhposition.nextvalue; values.match_selection = text.targeta.currentindex;
values.nonmatch1_selection = list.nonmatch1.nextindex; values.nonmatch2_selection = list.nonmatch2.nextindex;
values.match_vposition = 70%; values.nonmatch1_vposition = 70% ; values.nonmatch2_vposition = 70%;
values.match_hposition_org = values.match_hposition; values.match_vposition_org = values.match_vposition; ]
/ stimulusframes = [1= startmsg]
/ validresponse = (anyresponse)
/ recorddata = false
/ branch = [trial.RCP_choice]
</trial>

<trial RCP_choice>
/ stimulusframes = [1 = clearscreen,targetA; 10 = frametarget; 20 = drop_sample ; 30 = line ; 50 = sample_match, sample_nonmatch1, sample_nonmatch2]
/ inputdevice = mouse
/ validresponse = (sample_match, sample_nonmatch1, sample_nonmatch2)
/ correctresponse = (sample_match)
/ branch = [if(trial.RCP_choice.response=="sample_match") trial.correctselection]
/ branch = [if(trial.RCP_choice.response=="sample_nonmatch1") trial.incorrectmove1]
/ branch = [if(trial.RCP_choice.response=="sample_nonmatch2") trial.incorrectmove2]
</trial>

<trial correctselection>
/inputdevice = mouse
/stimulusframes = [1= clearscreen, drop_sample, sample_match, line, targetA, sample_nonmatch1, sample_nonmatch2]
/validresponse = (mousemove, lbuttondown)
/numframes = 1
/ontrialend = [values.match_hposition = expressions.match_hpct; values.match_vposition = expressions.match_vpct]
/ branch = [if (trial.correctselection.response!="lbuttondown") trial.correctselection else trial.correctmove]
</trial>

<trial correctmove>
/ stimulusframes = [1 = targetA, frametarget, sample_matchE, resetround, clickresetround, nextround, clicknextround]
/ validresponse = (resetround, clickresetround, nextround, clicknextround)
/ inputdevice = mouse
/ ontrialend = [if (trial.correctmove.response=="resetround") {values.match_hposition = values.match_hposition_org;
    values.match_vposition = values.match_vposition_org; }; ]
/ branch = [if (trial.correctmove.response=="nextround") trial.congratulations else trial.rcp_choice]
</trial>

<trial incorrectmove1>
/ stimulusframes = [1 = targetA, frametarget, sample_nonmatch1E, resetround, clickresetround, nextround, clicknextround]
/ validresponse = (resetround, clickresetround, nextround, clicknextround)
/ inputdevice = mouse
/ branch = [if (trial.incorrectmove1.response=="nextround") trial.error else trial.rcp_choice]
</trial>

<trial incorrectmove2>
/ stimulusframes = [1 = targetA, frametarget, sample_nonmatch2E, resetround, clickresetround, nextround, clicknextround]
/ validresponse = (resetround, clickresetround, nextround, clicknextround)
/ inputdevice = mouse
/ branch = [if (trial.incorrectmove2.response=="nextround") trial.error else trial.rcp_choice]
</trial>


<trial congratulations>
/ stimulusframes = [1= clearscreen, congratulations, next]
/ inputdevice = mouse
/ validresponse = ("next")
</trial>

<trial error>
/ stimulusframes = [1= clearscreen, error, next]
/ inputdevice = mouse
/ validresponse = ("next")
</trial>



****************************************************************************************************************
LES PAGES ERREUR ET FELICITATIONS
****************************************************************************************************************



<text error>
/ items = ("You lose")
/ position = (50%, 40%)
/ txcolor = (255, 0, 0)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text congratulations>
/ items = ("congratulations")
/ position = (50%, 40%)
/ txcolor = (255, 0, 0)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text next>
/ items = ("next")
/ position = (50%, 70%)
</text>

<shape clearscreen>
/ color = (white)
/ shape = rectangle
/ size = (100%, 100%)
/ erase = false
</shape>

*****************************************************************************************************************
*****************************************************************************************************************
Elements
*****************************************************************************************************************
*****************************************************************************************************************

<text resetround>
/ items = ("Start again")
/ fontstyle = ("Arial", 2.50%, true)
/ vjustify = center
/ txcolor = (black)
/ txbgcolor = (white)
/ size = (20%,4%)
/ position = (35%,98%)
/ valign = bottom
</text>

<text clickresetround>
/ items = ("Start again")
/ fontstyle = ("Arial", 2.50%, true)
/ vjustify = center
/ txcolor = (white)
/ txbgcolor = (black)
/ size = (20%,4%)
/ position = (35%,98%)
/ valign = bottom
</text>

<text nextround>
/ items = ("I valid")
/ fontstyle = ("Arial", 2.50%, true)
/ vjustify = center
/ txcolor = (black)
/ txbgcolor = (white)
/ size = (20%,4%)
/ position = (65%,98%)
/ valign = bottom
</text>

<text clicknextround>
/ items = ("I valid")
/ fontstyle = ("Arial", 2.50%, true)
/ vjustify = center
/ txcolor = (white)
/ txbgcolor = (black)
/ size = (20%,4%)
/ position = (65%,98%)
/ valign = bottom
</text>

<text startmsg>
/ items = ("Get ready...")
/ fontstyle = ("Arial", 3.50%, true)
/ txbgcolor = (transparent)
/ select = 1
/ position = (50%,40%)
/ hjustify = center
/ vjustify = center
</text>

*****************************************************************************************************************
*****************************************************************************************************************

<block RCP>
/ trials = [1-3= newround]
</block>