Millisecond Forums

repeat trial after error

https://www.millisecond.com/forums/Topic20404.aspx

By laurenemberson - 12/29/2016

Hi-- This seems like a simple one but I can't find an existing forum thread on this issue.  I want to repeat a trial after an error.   Here is the relevant part of my code. Any help is much appreciated!  ~Lauren

<item familiarizationPics>
/1 = "images/ATflwr1.jpg"
/2 = "images/ATfish1.jpg"
/3 = "images/ATbird4.jpg"
/4 = "images/ATdogg2.jpg"
/5 = "images/ATflwr1.jpg"
...
</item>
<picture familiarization>
/ items = familiarizationPics
/ select = sequence
/ size = (400, 400)
/ erase = false
</picture>

<trial famTrial>
/ stimulustimes = [0=familiarization; 300=blank]
/ validresponse = (noresponse,"1","2")
/ iscorrectresponse = [trial.famTrial.response == list.famAnswers.nextvalue]
/ beginresponsetime = 0
/ trialduration = 1000
/ responseinterrupt = trial
/ errormessage = (wrong,500)
</trial>

<block famBlock>
/ preinstructions = (intro,famInstruct)
/ trials = [1 = famInstructionsWithPic; 2-449 = famTrial]
/ errormessage = false
/ blockfeedback = (correct)
/ ontrialend = [if (block.famBlock.errorstreak == 11 ) script.abort();]
</block>

By Dave - 12/29/2016

laurenemberson - Thursday, December 29, 2016
Hi-- This seems like a simple one but I can't find an existing forum thread on this issue.  I want to repeat a trial after an error.   Here is the relevant part of my code. Any help is much appreciated!  ~Lauren

<item familiarizationPics>
/1 = "images/ATflwr1.jpg"
/2 = "images/ATfish1.jpg"
/3 = "images/ATbird4.jpg"
/4 = "images/ATdogg2.jpg"
/5 = "images/ATflwr1.jpg"
...
</item>
<picture familiarization>
/ items = familiarizationPics
/ select = sequence
/ size = (400, 400)
/ erase = false
</picture>

<trial famTrial>
/ stimulustimes = [0=familiarization; 300=blank]
/ validresponse = (noresponse,"1","2")
/ iscorrectresponse = [trial.famTrial.response == list.famAnswers.nextvalue]
/ beginresponsetime = 0
/ trialduration = 1000
/ responseinterrupt = trial
/ errormessage = (wrong,500)
</trial>

<block famBlock>
/ preinstructions = (intro,famInstruct)
/ trials = [1 = famInstructionsWithPic; 2-449 = famTrial]
/ errormessage = false
/ blockfeedback = (correct)
/ ontrialend = [if (block.famBlock.errorstreak == 11 ) script.abort();]
</block>


Strictly speaking, there is no way to repeat a *trial*. Instead you need to frame the problem in terms of item selection, i.e. in any given trial, only select a new item if  the previous trial was answered correctly. Example:

<values>
/ itemnumber = 1
</values>

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

<trial mytrial>
/ ontrialbegin = [if (trial.mytrial.correct) values.itemnumber += 1]
/ stimulusframes = [1=mytext]
/ validresponse = ("1","2")
/ correctresponse = ("1")
/ branch = [if (trial.mytrial.error) trial.mytrial]
</trial>

<text mytext>
/ items = myitems
/ select = values.itemnumber
</text>

<item myitems>
/ 1 = "A"
/ 2 = "B"
/ 1 = "C"
/ 2 = "D"
/ 1 = "E"
</item>

Hope this helps.