|
AKrishna
|
|
|
Group: Forum Members
Posts: 127,
Visits: 435
|
Sorry if this is a doubled post, I can't see my original topic and I fear the forum may have swallowed it. I'm working on a scrambled sentences task implemented using the drag and drop function. Normally, I create large datasets with the monkey prior to actual data collection in order to make sure I'm collecting all the data points I need and to test randomization etc. However, the monkey is freezing on the drag and drop trials. Here's a code example: ## word stimuli, ordered so that word1 is the first word in the sentence, word2 the second and so on, with word5 being the distracter word
<item word1> /1 = "he" </item>
<item word2> /1 = "buys" </item>
<item word3> /1 = "mature" </item>
<item word4> /1 = "whiskey" </item>
<item word5> /1 = "taken" </item>
## list to randomize presentation order of words
<list wordorder> /items = (20pct,30pct,40pct,50pct,60pct) /replace = false / selectionrate = always </list>
## word stimuli to drag
<text word1> / items = word1 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (20%,30%) / dropsource = true </text>
<text word2> / items = word2 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (30%,30%) / dropsource = true </text>
<text word3> / items = word3 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (40%,30%) / dropsource = true </text>
<text word4> / items = word4 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (50%,30%) / dropsource = true </text>
<text word5> / items = word5 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (60%,30%) / dropsource = true </text>
## boxes to drop words in
<shape slot1> /shape = rectangle /size = (220,60) /color = gray /position = (20%,80%) / droptarget = true </shape>
<shape slot2> /shape = rectangle /size = (220,60) /color = gray /position = (40%,80%) / droptarget = true </shape>
<shape slot3> /shape = rectangle /size = (220,60) /color = gray / droptarget = true /position = (60%,80%) </shape>
<shape slot4> /shape = rectangle /size = (220,60) /color = gray / droptarget = true /position = (80%,80%) </shape>
## main trial, randomizes positions and only moves forward when the answer is correct
<trial dragtrial> / ontrialbegin = [ list.wordorder.resetselection() ]
/ontrialbegin = [ text.word1.hposition = list.wordorder.nextvalue; text.word2.hposition= list.wordorder.nextvalue; text.word3.hposition= list.wordorder.nextvalue; text.word4.hposition= list.wordorder.nextvalue; text.word5.hposition= list.wordorder.nextvalue; text.word1.vposition = 30pct; text.word2.vposition = 30pct; text.word3.vposition = 30pct; text.word4.vposition = 30pct; text.word5.vposition = 30pct; ] /stimulustimes = [0 = word1, word2, word3, word4, word5, slot1, slot2, slot3, slot4] / inputdevice = dragdrop / isvalidresponse = [ expressions.IsValidDragTrial ] / iscorrectresponse = [ text.word1.hposition == display.getpixelsx(shape.slot1.hposition) && text.word2.hposition == display.getpixelsx(shape.slot2.hposition) && text.word3.hposition == display.getpixelsx(shape.slot3.hposition) && text.word4.hposition == display.getpixelsx(shape.slot4.hposition) ] / branch = [ if (trial.dragtrial.error) trial.dragtrial ] / dropsources = (word1, word2, word3, word4) / droptargets = (slot1, slot2, slot3, slot4)
</trial>
## looped expression that checks whether every word has been dropped on a slot and returns true only ## if this is the case, thus preventing the trial from moving forward until the participant has ## made a complete response
<expressions> / IsValidDragTrial = { var ValidCount = 0; var WordCurrentXPos; var WordCurrentYPos; var SlotCurrentXPos; var SlotCurrentYPos; while (list.WordStimuli.unselectedcount > 0) { list.WordStimuli.nextvalue; WordCurrentXPos = evaluate(concat(list.WordStimuli.currentvalue, ".hposition")); WordCurrentYPos = evaluate(concat(list.WordStimuli.currentvalue, ".vposition")); while (list.Slots.unselectedcount > 0) { list.Slots.nextvalue; SlotCurrentXPos = evaluate(concat(list.Slots.currentvalue, ".hposition")); SlotCurrentYPos = evaluate(concat(list.Slots.currentvalue, ".vposition")); SlotCurrentXPos = display.getpixelsx(SlotCurrentXPos); SlotCurrentYPos = display.getpixelsy(SlotCurrentYPos); if (WordCurrentXPos == SlotCurrentXPos && WordCurrentYPos == SlotCurrentYPos) { ValidCount += 1; }; }; list.Slots.resetselection(); }; list.WordStimuli.resetselection(); if (ValidCount >= 4) return true else return false } </expressions>
<list WordStimuli> /items = ("text.word1", "text.word2", "text.word3", "text.word4", "text.word5") / selectionrate = always / selectionmode = sequence
</list>
<list Slots> /items = ("shape.slot1", "shape.slot2", "shape.slot3", "shape.slot4") / selectionrate = always / selectionmode = sequence </list>
<page scrambledsentences> On the next page you will see five words at a time.^^ Four of these words form a grammatically correct sentence together while one word is left over each time.^^ Your task is to find the correct sentence. ^^ To complete the task use the mouse to place the words in the correct order into the fields below. ^^ To do this, hold down the left mouse button and drag the words into the correct target position.^^ </page>
<block scrambledsentences> /preinstructions = (page.scrambledsentences) /trials = [1 = dragtrial] </block> I've already tried removing the /isvalidresponse property in case that was causing trouble, but the monkey still freezes. Would appreciate any help!
|
|
|
|
|
Dave
|
|
|
Group: Administrators
Posts: 13K,
Visits: 109K
|
+xSorry if this is a doubled post, I can't see my original topic and I fear the forum may have swallowed it. I'm working on a scrambled sentences task implemented using the drag and drop function. Normally, I create large datasets with the monkey prior to actual data collection in order to make sure I'm collecting all the data points I need and to test randomization etc. However, the monkey is freezing on the drag and drop trials. Here's a code example: ## word stimuli, ordered so that word1 is the first word in the sentence, word2 the second and so on, with word5 being the distracter word
<item word1> /1 = "he" </item>
<item word2> /1 = "buys" </item>
<item word3> /1 = "mature" </item>
<item word4> /1 = "whiskey" </item>
<item word5> /1 = "taken" </item>
## list to randomize presentation order of words
<list wordorder> /items = (20pct,30pct,40pct,50pct,60pct) /replace = false / selectionrate = always </list>
## word stimuli to drag
<text word1> / items = word1 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (20%,30%) / dropsource = true </text>
<text word2> / items = word2 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (30%,30%) / dropsource = true </text>
<text word3> / items = word3 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (40%,30%) / dropsource = true </text>
<text word4> / items = word4 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (50%,30%) / dropsource = true </text>
<text word5> / items = word5 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (60%,30%) / dropsource = true </text>
## boxes to drop words in
<shape slot1> /shape = rectangle /size = (220,60) /color = gray /position = (20%,80%) / droptarget = true </shape>
<shape slot2> /shape = rectangle /size = (220,60) /color = gray /position = (40%,80%) / droptarget = true </shape>
<shape slot3> /shape = rectangle /size = (220,60) /color = gray / droptarget = true /position = (60%,80%) </shape>
<shape slot4> /shape = rectangle /size = (220,60) /color = gray / droptarget = true /position = (80%,80%) </shape>
## main trial, randomizes positions and only moves forward when the answer is correct
<trial dragtrial> / ontrialbegin = [ list.wordorder.resetselection() ]
/ontrialbegin = [ text.word1.hposition = list.wordorder.nextvalue; text.word2.hposition= list.wordorder.nextvalue; text.word3.hposition= list.wordorder.nextvalue; text.word4.hposition= list.wordorder.nextvalue; text.word5.hposition= list.wordorder.nextvalue; text.word1.vposition = 30pct; text.word2.vposition = 30pct; text.word3.vposition = 30pct; text.word4.vposition = 30pct; text.word5.vposition = 30pct; ] /stimulustimes = [0 = word1, word2, word3, word4, word5, slot1, slot2, slot3, slot4] / inputdevice = dragdrop / isvalidresponse = [ expressions.IsValidDragTrial ] / iscorrectresponse = [ text.word1.hposition == display.getpixelsx(shape.slot1.hposition) && text.word2.hposition == display.getpixelsx(shape.slot2.hposition) && text.word3.hposition == display.getpixelsx(shape.slot3.hposition) && text.word4.hposition == display.getpixelsx(shape.slot4.hposition) ] / branch = [ if (trial.dragtrial.error) trial.dragtrial ] / dropsources = (word1, word2, word3, word4) / droptargets = (slot1, slot2, slot3, slot4)
</trial>
## looped expression that checks whether every word has been dropped on a slot and returns true only ## if this is the case, thus preventing the trial from moving forward until the participant has ## made a complete response
<expressions> / IsValidDragTrial = { var ValidCount = 0; var WordCurrentXPos; var WordCurrentYPos; var SlotCurrentXPos; var SlotCurrentYPos; while (list.WordStimuli.unselectedcount > 0) { list.WordStimuli.nextvalue; WordCurrentXPos = evaluate(concat(list.WordStimuli.currentvalue, ".hposition")); WordCurrentYPos = evaluate(concat(list.WordStimuli.currentvalue, ".vposition")); while (list.Slots.unselectedcount > 0) { list.Slots.nextvalue; SlotCurrentXPos = evaluate(concat(list.Slots.currentvalue, ".hposition")); SlotCurrentYPos = evaluate(concat(list.Slots.currentvalue, ".vposition")); SlotCurrentXPos = display.getpixelsx(SlotCurrentXPos); SlotCurrentYPos = display.getpixelsy(SlotCurrentYPos); if (WordCurrentXPos == SlotCurrentXPos && WordCurrentYPos == SlotCurrentYPos) { ValidCount += 1; }; }; list.Slots.resetselection(); }; list.WordStimuli.resetselection(); if (ValidCount >= 4) return true else return false } </expressions>
<list WordStimuli> /items = ("text.word1", "text.word2", "text.word3", "text.word4", "text.word5") / selectionrate = always / selectionmode = sequence
</list>
<list Slots> /items = ("shape.slot1", "shape.slot2", "shape.slot3", "shape.slot4") / selectionrate = always / selectionmode = sequence </list>
<page scrambledsentences> On the next page you will see five words at a time.^^ Four of these words form a grammatically correct sentence together while one word is left over each time.^^ Your task is to find the correct sentence. ^^ To complete the task use the mouse to place the words in the correct order into the fields below. ^^ To do this, hold down the left mouse button and drag the words into the correct target position.^^ </page>
<block scrambledsentences> /preinstructions = (page.scrambledsentences) /trials = [1 = dragtrial] </block> I've already tried removing the /isvalidresponse property in case that was causing trouble, but the monkey still freezes. Would appreciate any help! In short, you need to make use of the /monkeyResponse attribute. https://www.millisecond.com/support/docs/v6/html/language/attributes/monkeyresponse.htm<trial dragtrial> / ontrialbegin = [ list.wordorder.resetselection() ]
/ontrialbegin = [ text.word1.hposition = list.wordorder.nextvalue; text.word2.hposition= list.wordorder.nextvalue; text.word3.hposition= list.wordorder.nextvalue; text.word4.hposition= list.wordorder.nextvalue; text.word5.hposition= list.wordorder.nextvalue; text.word1.vposition = 30pct; text.word2.vposition = 30pct; text.word3.vposition = 30pct; text.word4.vposition = 30pct; text.word5.vposition = 30pct; ] /stimulustimes = [0 = word1, word2, word3, word4, word5, slot1, slot2, slot3, slot4] / inputdevice = dragdrop / isvalidresponse = [ expressions.IsValidDragTrial ] / iscorrectresponse = [ text.word1.hposition == display.getpixelsx(shape.slot1.hposition) && text.word2.hposition == display.getpixelsx(shape.slot2.hposition) && text.word3.hposition == display.getpixelsx(shape.slot3.hposition) && text.word4.hposition == display.getpixelsx(shape.slot4.hposition) ] / branch = [ if (trial.dragtrial.error) trial.dragtrial ] / dropsources = (word1, word2, word3, word4) / droptargets = (slot1, slot2, slot3, slot4) / monkeyresponse = (list.monkeyTargets.nextvalue) </trial>
<list monkeyTargets> / items = (shape.slot1, shape.slot2, shape.slot3, shape.slot4) / selectionmode = sequence / selectionrate = always </list> You'll probably also want to make some addition to the isValidDragTrial expression, to allow the trial to be a pass once the monkey has populated all four slots (no matter the word order), i.e. make it behave differently based on the value of the monkey.monkeymode property.
|
|
|
|
|
AKrishna
|
|
|
Group: Forum Members
Posts: 127,
Visits: 435
|
+x+xSorry if this is a doubled post, I can't see my original topic and I fear the forum may have swallowed it. I'm working on a scrambled sentences task implemented using the drag and drop function. Normally, I create large datasets with the monkey prior to actual data collection in order to make sure I'm collecting all the data points I need and to test randomization etc. However, the monkey is freezing on the drag and drop trials. Here's a code example: ## word stimuli, ordered so that word1 is the first word in the sentence, word2 the second and so on, with word5 being the distracter word
<item word1> /1 = "he" </item>
<item word2> /1 = "buys" </item>
<item word3> /1 = "mature" </item>
<item word4> /1 = "whiskey" </item>
<item word5> /1 = "taken" </item>
## list to randomize presentation order of words
<list wordorder> /items = (20pct,30pct,40pct,50pct,60pct) /replace = false / selectionrate = always </list>
## word stimuli to drag
<text word1> / items = word1 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (20%,30%) / dropsource = true </text>
<text word2> / items = word2 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (30%,30%) / dropsource = true </text>
<text word3> / items = word3 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (40%,30%) / dropsource = true </text>
<text word4> / items = word4 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (50%,30%) / dropsource = true </text>
<text word5> / items = word5 /size = (220,60) /color = white /fontstyle = ("Arial",26pt) /txcolor = black /position = (60%,30%) / dropsource = true </text>
## boxes to drop words in
<shape slot1> /shape = rectangle /size = (220,60) /color = gray /position = (20%,80%) / droptarget = true </shape>
<shape slot2> /shape = rectangle /size = (220,60) /color = gray /position = (40%,80%) / droptarget = true </shape>
<shape slot3> /shape = rectangle /size = (220,60) /color = gray / droptarget = true /position = (60%,80%) </shape>
<shape slot4> /shape = rectangle /size = (220,60) /color = gray / droptarget = true /position = (80%,80%) </shape>
## main trial, randomizes positions and only moves forward when the answer is correct
<trial dragtrial> / ontrialbegin = [ list.wordorder.resetselection() ]
/ontrialbegin = [ text.word1.hposition = list.wordorder.nextvalue; text.word2.hposition= list.wordorder.nextvalue; text.word3.hposition= list.wordorder.nextvalue; text.word4.hposition= list.wordorder.nextvalue; text.word5.hposition= list.wordorder.nextvalue; text.word1.vposition = 30pct; text.word2.vposition = 30pct; text.word3.vposition = 30pct; text.word4.vposition = 30pct; text.word5.vposition = 30pct; ] /stimulustimes = [0 = word1, word2, word3, word4, word5, slot1, slot2, slot3, slot4] / inputdevice = dragdrop / isvalidresponse = [ expressions.IsValidDragTrial ] / iscorrectresponse = [ text.word1.hposition == display.getpixelsx(shape.slot1.hposition) && text.word2.hposition == display.getpixelsx(shape.slot2.hposition) && text.word3.hposition == display.getpixelsx(shape.slot3.hposition) && text.word4.hposition == display.getpixelsx(shape.slot4.hposition) ] / branch = [ if (trial.dragtrial.error) trial.dragtrial ] / dropsources = (word1, word2, word3, word4) / droptargets = (slot1, slot2, slot3, slot4)
</trial>
## looped expression that checks whether every word has been dropped on a slot and returns true only ## if this is the case, thus preventing the trial from moving forward until the participant has ## made a complete response
<expressions> / IsValidDragTrial = { var ValidCount = 0; var WordCurrentXPos; var WordCurrentYPos; var SlotCurrentXPos; var SlotCurrentYPos; while (list.WordStimuli.unselectedcount > 0) { list.WordStimuli.nextvalue; WordCurrentXPos = evaluate(concat(list.WordStimuli.currentvalue, ".hposition")); WordCurrentYPos = evaluate(concat(list.WordStimuli.currentvalue, ".vposition")); while (list.Slots.unselectedcount > 0) { list.Slots.nextvalue; SlotCurrentXPos = evaluate(concat(list.Slots.currentvalue, ".hposition")); SlotCurrentYPos = evaluate(concat(list.Slots.currentvalue, ".vposition")); SlotCurrentXPos = display.getpixelsx(SlotCurrentXPos); SlotCurrentYPos = display.getpixelsy(SlotCurrentYPos); if (WordCurrentXPos == SlotCurrentXPos && WordCurrentYPos == SlotCurrentYPos) { ValidCount += 1; }; }; list.Slots.resetselection(); }; list.WordStimuli.resetselection(); if (ValidCount >= 4) return true else return false } </expressions>
<list WordStimuli> /items = ("text.word1", "text.word2", "text.word3", "text.word4", "text.word5") / selectionrate = always / selectionmode = sequence
</list>
<list Slots> /items = ("shape.slot1", "shape.slot2", "shape.slot3", "shape.slot4") / selectionrate = always / selectionmode = sequence </list>
<page scrambledsentences> On the next page you will see five words at a time.^^ Four of these words form a grammatically correct sentence together while one word is left over each time.^^ Your task is to find the correct sentence. ^^ To complete the task use the mouse to place the words in the correct order into the fields below. ^^ To do this, hold down the left mouse button and drag the words into the correct target position.^^ </page>
<block scrambledsentences> /preinstructions = (page.scrambledsentences) /trials = [1 = dragtrial] </block> I've already tried removing the /isvalidresponse property in case that was causing trouble, but the monkey still freezes. Would appreciate any help! In short, you need to make use of the /monkeyResponse attribute. https://www.millisecond.com/support/docs/v6/html/language/attributes/monkeyresponse.htm<trial dragtrial> / ontrialbegin = [ list.wordorder.resetselection() ]
/ontrialbegin = [ text.word1.hposition = list.wordorder.nextvalue; text.word2.hposition= list.wordorder.nextvalue; text.word3.hposition= list.wordorder.nextvalue; text.word4.hposition= list.wordorder.nextvalue; text.word5.hposition= list.wordorder.nextvalue; text.word1.vposition = 30pct; text.word2.vposition = 30pct; text.word3.vposition = 30pct; text.word4.vposition = 30pct; text.word5.vposition = 30pct; ] /stimulustimes = [0 = word1, word2, word3, word4, word5, slot1, slot2, slot3, slot4] / inputdevice = dragdrop / isvalidresponse = [ expressions.IsValidDragTrial ] / iscorrectresponse = [ text.word1.hposition == display.getpixelsx(shape.slot1.hposition) && text.word2.hposition == display.getpixelsx(shape.slot2.hposition) && text.word3.hposition == display.getpixelsx(shape.slot3.hposition) && text.word4.hposition == display.getpixelsx(shape.slot4.hposition) ] / branch = [ if (trial.dragtrial.error) trial.dragtrial ] / dropsources = (word1, word2, word3, word4) / droptargets = (slot1, slot2, slot3, slot4) / monkeyresponse = (list.monkeyTargets.nextvalue) </trial>
<list monkeyTargets> / items = (shape.slot1, shape.slot2, shape.slot3, shape.slot4) / selectionmode = sequence / selectionrate = always </list> You'll probably also want to make some addition to the isValidDragTrial expression, to allow the trial to be a pass once the monkey has populated all four slots (no matter the word order), i.e. make it behave differently based on the value of the monkey.monkeymode property. Cheers, that was the problem. As a side note, because your post gives me the impression you might expect something different: implementing this actually made the monkey drag all the words to the same target in each trial (slot 1 in trial 1, slot 2 in trial 2 and so on), rather than populating each slot. It seems the selectionrate = always attribute doesn't affect the monkey's response behavior; it acts as though selectionrate = trial. I guess this makes sense; Inquisit isn't designed for multiple "responses" per trial, so it wouldn't normally be necessary to draw multiple response locations in one trial. Interesting fringe case
|
|
|
|