Drag and Drop Functions


Author
Message
raynae
raynae
New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)
Group: Forum Members
Posts: 5, Visits: 34
Hello, looking for help with the following code. I want to use the drag and drop function but with pictures. This code worked previously with text but not with photos. I saw in another post that I have to insert each photo as a separate item for this to work however, I'm not sure how I will randomise the trials then. Would I have to insert each trial manually for each target?

<instruct>
/ fontstyle = ("Arial", 2.8%, false, false, false, false, 5, 1) / txcolor = (black) / screencolor = white / wait = 1000 </instruct>

<page intro>
introuduction instructions ...
</page>

<expt>
/ preinstructions = (intro)
/ blocks = [1=intervention]
/ postinstructions = (end)
</expt>

<item glasstarget>
/1 = "glass1.jpg"
/2 = "glass2.jpg"
/3 = "glass3.jpg"
/4 = "glass4.jpg"
/5 = "glass5.jpg"
/6 = "glass6.jpg"
</item>

<item papertarget>
/1 = "paper1.jpg"
/2 = "paper2.jpg"
/3 = "paper3.jpg"
/4 = "paper4.jpg"
/5 = "paper5.jpg"
/6 = "paper6.jpg"
/7 = "paper7.jpg"
/8 = "paper8.jpg"
</item>

<item plastictarget>
/1 = "plastic1.jpg"
/2 = "plastic2.jpg"
/3 = "plastic3.jpg"
/4 = "plastic4.jpg"
/5 = "plastic5.jpg"
/6 = "plastic6.jpg"
/7 = "plastic7.jpg"
/8 = "plastic8.jpg"
/9 = "plastic9.jpg"
</item>

<item trashtarget>
/1 = "trash1.jpg"
</item>

<item organictarget>
/1 = "organic1.jpg"
/2 = "organic2.jpg"
/3 = "organic3.png"
/4 = "organic4.jpg"
/5 = "organic5.jpg"
/6 = "organic6.jpg"
/7 = "organic7.jpg"
/8 = "organic8.jpg"
/9 = "organic9.jpg"
</item>

<item distractor>
/1 = "distractor1.jpg"
/2 = "distractor2.jpg"
/3 = "distractor3.jpg"
/4 = "distractor4.jpg"
/5 = "distractor5.jpg"
</item>

<item glass>
/1 = "GLASS.jpg"
</item>

<item organic>
/1 = "ORGANIC.jpg"
</item>

<item paper>
/1 = "PAPER.jpg"
</item>

<item plastic>
/1 = "PLASTIC.jpg"
</item>

<item trash>
/1 = "TRASH.jpg"
</item>

<picture trashtarget>
/ items = trashtarget
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture glasstarget>
/ items = glasstarget
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture plastictarget>
/ items = plastictarget
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture papertarget>
/ items = papertarget
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture organictarget>
/ items = organictarget
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture distractor>
/ items = distractor
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture glass>
/ items = glass
/ position = (10%, 80%)
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture paper>
/ items = paper
/ position = (30%, 80%)
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture plastic>
/ items = plastic
/ position = (50%, 80%)
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture organic>
/ items = organic
/ position = (70%, 80%)
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture trash>
/ items = trash
/ position = (90%, 80%)
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<trial paper>
/ ontrialbegin = [
  picture.papertarget.hposition = 50%;
  picture.papertarget.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = (paper) </trial>

<trial plastic>
/ ontrialbegin = [
  picture.plastictarget.hposition = 50%;
  picture.plastictarget.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = (plastic) </trial>

<trial glass>
/ ontrialbegin = [
  picture.glasstarget.hposition = 50%;
  picture.glasstarget.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = (glass) </trial>

<trial organic>
/ ontrialbegin = [
  picture.organictarget.hposition = 50%;
  picture.organictarget.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = (organic) </trial>

<trial trash>
/ ontrialbegin = [
  picture.trashtarget.hposition = 50%;
  picture.trashtarget.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = (trash) </trial>

<trial distractor>
/ ontrialbegin = [
  picture.distractor.hposition = 50%;
  picture.distractor.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = () </trial>



<block intervention>
/trials = [1-10 = replacenorepeat(glass, paper, plastic, organic, trash, distractor)]
</block>

<page end>
..... end instructions
</page>

Dave
Dave
Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)
Group: Administrators
Posts: 11K, Visits: 68K
raynae - 3/18/2021
Hello, looking for help with the following code. I want to use the drag and drop function but with pictures. This code worked previously with text but not with photos. I saw in another post that I have to insert each photo as a separate item for this to work however, I'm not sure how I will randomise the trials then. Would I have to insert each trial manually for each target?

<instruct>
/ fontstyle = ("Arial", 2.8%, false, false, false, false, 5, 1) / txcolor = (black) / screencolor = white / wait = 1000 </instruct>

<page intro>
introuduction instructions ...
</page>

<expt>
/ preinstructions = (intro)
/ blocks = [1=intervention]
/ postinstructions = (end)
</expt>

<item glasstarget>
/1 = "glass1.jpg"
/2 = "glass2.jpg"
/3 = "glass3.jpg"
/4 = "glass4.jpg"
/5 = "glass5.jpg"
/6 = "glass6.jpg"
</item>

<item papertarget>
/1 = "paper1.jpg"
/2 = "paper2.jpg"
/3 = "paper3.jpg"
/4 = "paper4.jpg"
/5 = "paper5.jpg"
/6 = "paper6.jpg"
/7 = "paper7.jpg"
/8 = "paper8.jpg"
</item>

<item plastictarget>
/1 = "plastic1.jpg"
/2 = "plastic2.jpg"
/3 = "plastic3.jpg"
/4 = "plastic4.jpg"
/5 = "plastic5.jpg"
/6 = "plastic6.jpg"
/7 = "plastic7.jpg"
/8 = "plastic8.jpg"
/9 = "plastic9.jpg"
</item>

<item trashtarget>
/1 = "trash1.jpg"
</item>

<item organictarget>
/1 = "organic1.jpg"
/2 = "organic2.jpg"
/3 = "organic3.png"
/4 = "organic4.jpg"
/5 = "organic5.jpg"
/6 = "organic6.jpg"
/7 = "organic7.jpg"
/8 = "organic8.jpg"
/9 = "organic9.jpg"
</item>

<item distractor>
/1 = "distractor1.jpg"
/2 = "distractor2.jpg"
/3 = "distractor3.jpg"
/4 = "distractor4.jpg"
/5 = "distractor5.jpg"
</item>

<item glass>
/1 = "GLASS.jpg"
</item>

<item organic>
/1 = "ORGANIC.jpg"
</item>

<item paper>
/1 = "PAPER.jpg"
</item>

<item plastic>
/1 = "PLASTIC.jpg"
</item>

<item trash>
/1 = "TRASH.jpg"
</item>

<picture trashtarget>
/ items = trashtarget
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture glasstarget>
/ items = glasstarget
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture plastictarget>
/ items = plastictarget
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture papertarget>
/ items = papertarget
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture organictarget>
/ items = organictarget
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture distractor>
/ items = distractor
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture glass>
/ items = glass
/ position = (10%, 80%)
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture paper>
/ items = paper
/ position = (30%, 80%)
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture plastic>
/ items = plastic
/ position = (50%, 80%)
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture organic>
/ items = organic
/ position = (70%, 80%)
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<picture trash>
/ items = trash
/ position = (90%, 80%)
/ size = (15%, 15%)
/ erase = false
/ droptarget = true
</picture>

<trial paper>
/ ontrialbegin = [
  picture.papertarget.hposition = 50%;
  picture.papertarget.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = (paper) </trial>

<trial plastic>
/ ontrialbegin = [
  picture.plastictarget.hposition = 50%;
  picture.plastictarget.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = (plastic) </trial>

<trial glass>
/ ontrialbegin = [
  picture.glasstarget.hposition = 50%;
  picture.glasstarget.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = (glass) </trial>

<trial organic>
/ ontrialbegin = [
  picture.organictarget.hposition = 50%;
  picture.organictarget.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = (organic) </trial>

<trial trash>
/ ontrialbegin = [
  picture.trashtarget.hposition = 50%;
  picture.trashtarget.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = (trash) </trial>

<trial distractor>
/ ontrialbegin = [
  picture.distractor.hposition = 50%;
  picture.distractor.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, distractor] / inputdevice = dragdrop / showmousecursor = true / validresponse = (glass, paper, plastic, organic, trash, distractor) / correctresponse = () </trial>



<block intervention>
/trials = [1-10 = replacenorepeat(glass, paper, plastic, organic, trash, distractor)]
</block>

<page end>
..... end instructions
</page>

(1) You need to explain what you want the code to actually do. Please comment your code.
(2) If any code you need to share requires external files to work (here: images), you must provide those files.

I'll note that:
(1) There are NO dropsources defined in your code. Only droptargets. There thuse are no stimuli (dropsources) that could be dragged anywhere on a droptarget.
(2) The picture element's whose position you set /ontrialbegin are not used anywhere in the code. Your trial elements do not display these picture elements, they display entirely different ones.

Edited Last Month by Dave
raynae
raynae
New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)
Group: Forum Members
Posts: 5, Visits: 34
Hello, thank you for your response I was able to sort out the problem. I do have another concern. I want to include some "distractors" with the target each trial. However, I'm not sure how to specify the correct response. I'm pretty sure how I've currently coded it any object (including the distractor) if dragged to the correct location is coded as a correct response. Is it possible to only allow in this case, only the picture.papertarget to be coded as correct if dragged to the "paper" location. 
<trial paper>

/ ontrialbegin = [
    picture.papertarget.hposition = 50%;
  picture.papertarget.vposition = 50%;
    picture.distractor1.hposition = 70%;
    picture.distractor1.vposition = 50%;
    picture.distractor2.hposition = 30%;
    picture.distractor2.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash; 2 = papertarget; 3 = distractor1; 4=distractor2]
/ inputdevice = dragdrop
/ showmousecursor = true
/ validresponse = (glass, paper, plastic, organic, trash)
/ correctresponse = (paper)
/dropsources = (glasstarget, papertarget, plastictarget, organictarget, trashtarget, distractor1, distractor2)
</trial>
Dave
Dave
Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)
Group: Administrators
Posts: 11K, Visits: 68K
raynae - 3/18/2021
Hello, thank you for your response I was able to sort out the problem. I do have another concern. I want to include some "distractors" with the target each trial. However, I'm not sure how to specify the correct response. I'm pretty sure how I've currently coded it any object (including the distractor) if dragged to the correct location is coded as a correct response. Is it possible to only allow in this case, only the picture.papertarget to be coded as correct if dragged to the "paper" location. 
<trial paper>

/ ontrialbegin = [
    picture.papertarget.hposition = 50%;
  picture.papertarget.vposition = 50%;
    picture.distractor1.hposition = 70%;
    picture.distractor1.vposition = 50%;
    picture.distractor2.hposition = 30%;
    picture.distractor2.vposition = 50%;
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash; 2 = papertarget; 3 = distractor1; 4=distractor2]
/ inputdevice = dragdrop
/ showmousecursor = true
/ validresponse = (glass, paper, plastic, organic, trash)
/ correctresponse = (paper)
/dropsources = (glasstarget, papertarget, plastictarget, organictarget, trashtarget, distractor1, distractor2)
</trial>

You can do so via /iscorrectresponse.

Something like

/ iscorrectresponse = [
    trial.paper.lastdropsource == "papertarget" && trial.paper.response == "paper"
]
raynae
raynae
New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)
Group: Forum Members
Posts: 5, Visits: 34
Hello, hoping you are able to help me again, I want to change the code to use feedback "learning trials". I want that when the target is placed on the wrong location, there is an error message and the item returns to the original location. However, in my current code the item remains in the "wrong" location. Is there a way to reset the item to the original starting position?
<block practice>
/trials = [1-7= paper2]
/ response = correct
/ errormessage = true(error, 200)

</block>

<text error>
/ position = (50%, 75%)
/ items = ("X")
/ color = red
/ fontstyle = ("Arial", 10%, true)
</text>

<trial paper2>

/ ontrialbegin = [
    picture.papertarget.hposition = 50%;
  picture.papertarget.vposition = 40%;
    picture.distractor1.hposition = 70%;
    picture.distractor1.vposition = 40%;
    picture.distractor2.hposition = 30%;
    picture.distractor2.vposition = 40%;
    
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash; 2 = papertarget; 3 = distractor1; 4=distractor2]
/ inputdevice = dragdrop
/ showmousecursor = true
/ validresponse = (glass, paper, plastic, organic, trash)
/ iscorrectresponse = [
  trial.paper2.lastdropsource == "papertarget" && trial.paper2.response == "paper"
]
/dropsources = (glasstarget, papertarget, plastictarget, organictarget, trashtarget, distractor1, distractor2)
</trial>

<item glass>
/1 = "GLASS.jpg"
</item>

<item organic>
/1 = "ORGANIC.jpg"
</item>

<item paper>
/1 = "PAPER.jpg"
</item>

<item plastic>
/1 = "PLASTIC.jpg"
</item>

<item trash>
/1 = "TRASH.jpg"
</item>

<picture glass>
/ items = glass
/ position = (10%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture paper>
/ items = paper
/ position = (30%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture plastic>
/ items = plastic
/ position = (50%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture organic>
/ items = organic
/ position = (70%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture trash>
/ items = trash
/ position = (90%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

//Target items //
<picture trashtarget>
/ items = ("trash1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture glasstarget>
/ items = ("glass1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture plastictarget>
/ items = ("plastic1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture papertarget>
/ items = ("paper1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture organictarget>
/ items = ("organic1.jpg")
/ size = (15%, 15%)
/ erase = false
/dropsource = true
</picture>

<picture distractor1>
/ items = ("distractor1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture distractor2>
/ items = ("distractor1a.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture distractor3>
/ items = ("distractor1b.jpeg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>
Attachments
distractor1.jpg (12 views, 50.00 KB)
distractor1a.jpg (12 views, 6.00 KB)
distractor1b.jpeg (11 views, 6.00 KB)
trash1.jpg (11 views, 17.00 KB)
TRASH.jpg (12 views, 26.00 KB)
GLASS.jpg (11 views, 26.00 KB)
PLASTIC.jpg (11 views, 29.00 KB)
ORGANIC.jpg (12 views, 26.00 KB)
PAPER.jpg (11 views, 26.00 KB)
plastic1.jpg (9 views, 8.00 KB)
glass1.jpg (10 views, 7.00 KB)
organic1.jpg (12 views, 30.00 KB)
paper1.jpg (12 views, 12.00 KB)
Dave
Dave
Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)
Group: Administrators
Posts: 11K, Visits: 68K
raynae - 3/22/2021
Hello, hoping you are able to help me again, I want to change the code to use feedback "learning trials". I want that when the target is placed on the wrong location, there is an error message and the item returns to the original location. However, in my current code the item remains in the "wrong" location. Is there a way to reset the item to the original starting position?
<block practice>
/trials = [1-7= paper2]
/ response = correct
/ errormessage = true(error, 200)

</block>

<text error>
/ position = (50%, 75%)
/ items = ("X")
/ color = red
/ fontstyle = ("Arial", 10%, true)
</text>

<trial paper2>

/ ontrialbegin = [
    picture.papertarget.hposition = 50%;
  picture.papertarget.vposition = 40%;
    picture.distractor1.hposition = 70%;
    picture.distractor1.vposition = 40%;
    picture.distractor2.hposition = 30%;
    picture.distractor2.vposition = 40%;
    
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash; 2 = papertarget; 3 = distractor1; 4=distractor2]
/ inputdevice = dragdrop
/ showmousecursor = true
/ validresponse = (glass, paper, plastic, organic, trash)
/ iscorrectresponse = [
  trial.paper2.lastdropsource == "papertarget" && trial.paper2.response == "paper"
]
/dropsources = (glasstarget, papertarget, plastictarget, organictarget, trashtarget, distractor1, distractor2)
</trial>

<item glass>
/1 = "GLASS.jpg"
</item>

<item organic>
/1 = "ORGANIC.jpg"
</item>

<item paper>
/1 = "PAPER.jpg"
</item>

<item plastic>
/1 = "PLASTIC.jpg"
</item>

<item trash>
/1 = "TRASH.jpg"
</item>

<picture glass>
/ items = glass
/ position = (10%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture paper>
/ items = paper
/ position = (30%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture plastic>
/ items = plastic
/ position = (50%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture organic>
/ items = organic
/ position = (70%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture trash>
/ items = trash
/ position = (90%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

//Target items //
<picture trashtarget>
/ items = ("trash1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture glasstarget>
/ items = ("glass1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture plastictarget>
/ items = ("plastic1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture papertarget>
/ items = ("paper1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture organictarget>
/ items = ("organic1.jpg")
/ size = (15%, 15%)
/ erase = false
/dropsource = true
</picture>

<picture distractor1>
/ items = ("distractor1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture distractor2>
/ items = ("distractor1a.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture distractor3>
/ items = ("distractor1b.jpeg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

> Is there a way to reset the item to the original starting position?

No. Not within a single trial.

Dave
Dave
Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)Supreme Being (923K reputation)
Group: Administrators
Posts: 11K, Visits: 68K
Dave - 3/22/2021
raynae - 3/22/2021
Hello, hoping you are able to help me again, I want to change the code to use feedback "learning trials". I want that when the target is placed on the wrong location, there is an error message and the item returns to the original location. However, in my current code the item remains in the "wrong" location. Is there a way to reset the item to the original starting position?
<block practice>
/trials = [1-7= paper2]
/ response = correct
/ errormessage = true(error, 200)

</block>

<text error>
/ position = (50%, 75%)
/ items = ("X")
/ color = red
/ fontstyle = ("Arial", 10%, true)
</text>

<trial paper2>

/ ontrialbegin = [
    picture.papertarget.hposition = 50%;
  picture.papertarget.vposition = 40%;
    picture.distractor1.hposition = 70%;
    picture.distractor1.vposition = 40%;
    picture.distractor2.hposition = 30%;
    picture.distractor2.vposition = 40%;
    
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash; 2 = papertarget; 3 = distractor1; 4=distractor2]
/ inputdevice = dragdrop
/ showmousecursor = true
/ validresponse = (glass, paper, plastic, organic, trash)
/ iscorrectresponse = [
  trial.paper2.lastdropsource == "papertarget" && trial.paper2.response == "paper"
]
/dropsources = (glasstarget, papertarget, plastictarget, organictarget, trashtarget, distractor1, distractor2)
</trial>

<item glass>
/1 = "GLASS.jpg"
</item>

<item organic>
/1 = "ORGANIC.jpg"
</item>

<item paper>
/1 = "PAPER.jpg"
</item>

<item plastic>
/1 = "PLASTIC.jpg"
</item>

<item trash>
/1 = "TRASH.jpg"
</item>

<picture glass>
/ items = glass
/ position = (10%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture paper>
/ items = paper
/ position = (30%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture plastic>
/ items = plastic
/ position = (50%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture organic>
/ items = organic
/ position = (70%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture trash>
/ items = trash
/ position = (90%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

//Target items //
<picture trashtarget>
/ items = ("trash1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture glasstarget>
/ items = ("glass1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture plastictarget>
/ items = ("plastic1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture papertarget>
/ items = ("paper1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture organictarget>
/ items = ("organic1.jpg")
/ size = (15%, 15%)
/ erase = false
/dropsource = true
</picture>

<picture distractor1>
/ items = ("distractor1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture distractor2>
/ items = ("distractor1a.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture distractor3>
/ items = ("distractor1b.jpeg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

> Is there a way to reset the item to the original starting position?

No. Not within a single trial.

What you can do is something like this:

<block practice>
/trials = [1-7= paper2]
/ errormessage = true(error, 200)
</block>

<text error>
/ position = (50%, 65%)
/ items = ("X")
/ color = red
/ fontstyle = ("Arial", 10%, true)
</text>

<trial paper2>
/ ontrialbegin = [
  picture.papertarget.hposition = 50%;
  picture.papertarget.vposition = 40%;
  picture.distractor1.hposition = 70%;
  picture.distractor1.vposition = 40%;
  picture.distractor2.hposition = 30%;
  picture.distractor2.vposition = 40%;
 
]
/ stimulusframes = [1 = glass, paper, plastic, organic, trash, papertarget, distractor1, distractor2]
/ inputdevice = dragdrop
/ showmousecursor = true
/ validresponse = (glass, paper, plastic, organic, trash)
/ iscorrectresponse = [
trial.paper2.lastdropsource == "papertarget" && trial.paper2.response == "paper"
]
/dropsources = (glasstarget, papertarget, plastictarget, organictarget, trashtarget, distractor1, distractor2)
/ branch = [
    if (script.currentblock == "practice" && trial.paper2.error) {
        trial.paper2;
    }
]
</trial>

<item glass>
/1 = "GLASS.jpg"
</item>

<item organic>
/1 = "ORGANIC.jpg"
</item>

<item paper>
/1 = "PAPER.jpg"
</item>

<item plastic>
/1 = "PLASTIC.jpg"
</item>

<item trash>
/1 = "TRASH.jpg"
</item>

<picture glass>
/ items = glass
/ position = (10%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture paper>
/ items = paper
/ position = (30%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture plastic>
/ items = plastic
/ position = (50%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture organic>
/ items = organic
/ position = (70%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

<picture trash>
/ items = trash
/ position = (90%, 80%)
/ size = (20%, 20%)
/ erase = false
/ droptarget = true
</picture>

//Target items //
<picture trashtarget>
/ items = ("trash1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture glasstarget>
/ items = ("glass1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture plastictarget>
/ items = ("plastic1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture papertarget>
/ items = ("paper1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture organictarget>
/ items = ("organic1.jpg")
/ size = (15%, 15%)
/ erase = false
/dropsource = true
</picture>

<picture distractor1>
/ items = ("distractor1.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture distractor2>
/ items = ("distractor1a.jpg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>

<picture distractor3>
/ items = ("distractor1b.jpeg")
/ size = (15%, 15%)
/ erase = false
/ dropsource = true
</picture>
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search