Millisecond Forums

Help with /stop block after correctstreak of only certain <trials>

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

By kosbornecrowley - 9/15/2013

Hi,


I am running an experiment in which there are two types of trials per block in which the subject has to respond. My error/correct feedback, though, have to be set up as their own <trials>. In this situation, how do I set up a situation in which the block stops after a correctstreak of 8 correct only in the relevant 2 types of trials (not including the feedback trials)?



Code is below (the 'emotion' trials are the feedback trials and the 'target' trials are the actual trials in which a response is required). The <block> element I currently have is at the end - this code doesn't work because it includes the feedback trials in the correctstreak as well.



Thanks [:D]



<trial happy1left>


/stimulustimes = [0=happy1left; 0=target2right; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial angry1left>


/stimulustimes = [0=angry1left; 0=target2right; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial happy1right>


/stimulustimes = [0=happy1right; 0=target2left; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial angry1right>


/stimulustimes = [0=angry1right; 0=target2left; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial target1corrleft> 


/ validresponse = (lbuttondown, rbuttondown)


/correctresponse = (lbuttondown)


/inputdevice = mousekey


/pretrialpause =1000


/stimulustimes = [0=target1left; 0=target2right; 0=stimulussignal]


/ responsetrial = ("lbuttondown", happy1left)


/ responsetrial = ("rbuttondown", angry2right)


</trial>



<trial target1corrright> 


/ validresponse = (lbuttondown, rbuttondown)


/inputdevice = mousekey


/pretrialpause =1000


/ correctresponse = (rbuttondown)


/stimulustimes = [0=target1right; 0=target2left; 0=stimulussignal]


/ responsetrial = ("lbuttondown", angry2left)


/ responsetrial = ("rbuttondown", happy1right)


</trial>



<trial happy2left>


/stimulustimes = [0=happy2left; 0=target1right; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial angry2left>


/stimulustimes = [0=angry2left; 0=target1right; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial happy2right>


/stimulustimes = [0=happy2right; 0=target1left; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial angry2right>


/stimulustimes = [0=angry2right; 0=target1left; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial target2corrleft> 


/ validresponse = (lbuttondown, rbuttondown)


/correctresponse = (lbuttondown)


/inputdevice = mousekey


/pretrialpause =1000


/stimulustimes = [0=target2left; 0=target1right; 0=stimulussignal]


/ responsetrial = ("lbuttondown", happy2left)


/ responsetrial = ("rbuttondown", angry1right)


</trial>



<trial target2corrright> 


/ validresponse = (lbuttondown, rbuttondown)


/correctresponse = (rbuttondown)


/inputdevice = mousekey


/pretrialpause =1000


/stimulustimes = [0=target2right; 0=target1left; 0=stimulussignal]


/ responsetrial = ("lbuttondown", angry1left)


/ responsetrial = ("rbuttondown", happy2right)


</trial>



<block 1>


/ trials = [1-30 = noreplace (target1corrleft, target1corrright)]


/stop = [block.1.correctstreak == 16]


</block>

By Dave - 9/15/2013

how do I set up a situation in which the block stops after a correctstreak of 8 correct only in the relevant 2 types of trials (not including the feedback trials)?


See e.g. https://millisecond.com/forums/Topic9084.aspx#9084. Or you could always manually count up your streak using values / expressions / ontrialend and use that instead.

By kosbornecrowley - 9/16/2013

Hi Dave,


Thanks for your quick response! I am still very uncertain of how to do this. 


Could you please give me an example of how to manually count up the streak for the code below: ?


I need a correct streak of 8, only including the target1corrleft and target1corrright trials (not including the other trials which are feedback trials - although the appropriate feedback trial must occur after a response in the target trial even when the streak is up)



<trial happy1left>


/stimulustimes = [0=happy1left; 0=target2right; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial angry1left>


/stimulustimes = [0=angry1left; 0=target2right; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial happy1right>


/stimulustimes = [0=happy1right; 0=target2left; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial angry1right>


/stimulustimes = [0=angry1right; 0=target2left; 0=correctsignal]


/timeout = 1500


/correctresponse = (noresponse)


</trial>



<trial target1corrleft> 


/ validresponse = (lbuttondown, rbuttondown)


/correctresponse = (lbuttondown)


/inputdevice = mousekey


/pretrialpause =1000


/stimulustimes = [0=target1left; 0=target2right; 0=stimulussignal]


/ responsetrial = ("lbuttondown", happy1left)


/ responsetrial = ("rbuttondown", angry2right)


</trial>



<trial target1corrright> 


/ validresponse = (lbuttondown, rbuttondown)


/inputdevice = mousekey


/pretrialpause =1000


/ correctresponse = (rbuttondown)


/stimulustimes = [0=target1right; 0=target2left; 0=stimulussignal]


/ responsetrial = ("lbuttondown", angry2left)


/ responsetrial = ("rbuttondown", happy1right)


</trial>



<block 1>


/ trials = [1-30 = noreplace (target1corrleft, target1corrright)]


/stop = [block.1.correctstreak == 16]


</block>

By Dave - 9/16/2013

<values>
/ ncorrectinarow = 0
</values>

<trial happy1left>
/ ontrialend = [if (block.1.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]
/ stimulusframes = [1=debug]
/ timeout = 1500
/ validresponse = (noresponse)
/ iscorrectresponse = [block.1.correct]
</trial>

<trial angry1left>
/ ontrialend = [if (block.1.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]
/ stimulusframes = [1=debug]
/ timeout = 1500
/ validresponse = (noresponse)
/ iscorrectresponse = [block.1.correct]
</trial>

<trial happy1right>
/ ontrialend = [if (block.1.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]
/ stimulusframes = [1=debug]
/ timeout = 1500
/ validresponse = (noresponse)
/ iscorrectresponse = [block.1.correct]
</trial>

<trial angry1right>
/ ontrialend = [if (block.1.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]
/ stimulusframes = [1=debug]
/ timeout = 1500
/ validresponse = (noresponse)
/ iscorrectresponse = [block.1.correct]
</trial>
 
<trial target1corrleft>
/ validresponse = (lbuttondown, rbuttondown)
/ correctresponse = (lbuttondown)
/ inputdevice = mousekey
/ pretrialpause =1000
/ stimulusframes = [1=debug]
/ responsetrial = ("lbuttondown", happy1left)
/ responsetrial = ("rbuttondown", angry1right)
</trial>

<trial target1corrright>
/ validresponse = (lbuttondown, rbuttondown)
/ inputdevice = mousekey
/ pretrialpause =1000
/ correctresponse = (rbuttondown)
/ stimulusframes = [1=debug]
/ responsetrial = ("lbuttondown", angry1left)
/ responsetrial = ("rbuttondown", happy1right)
</trial>

<block 1>
/ trials = [1-30 = noreplace (target1corrleft, target1corrright)]
/ stop = [values.ncorrectinarow == 8]
</block>

<text debug>
/ items = ("<%script.currenttrial%>|Streak=<%values.ncorrectinarow%>")
</text>

By kosbornecrowley - 9/17/2013

Thanks Dave!


I have now added my second block onto this script...but it doesn't run properly.


Could you suggest what I might have done wrong? (script below)


Thanks!



<values>


/ ncorrectinarow = 0


</values>



<trial happy1left>


/stimulustimes = [0=happy1left; 0=target2right; 0=correctsignal]


/timeout = 1000


/ validresponse = (noresponse)


/ ontrialend = [if (block.1.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]


/ iscorrectresponse = [block.1.correct]


</trial>



<trial happy1right>


/stimulustimes = [0=happy1right; 0=target2left; 0=correctsignal]


/ ontrialend = [if (block.1.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]


/timeout = 1000


/ validresponse = (noresponse)


/ iscorrectresponse = [block.1.correct]


</trial>




<trial angry2left>


/stimulustimes = [0=angry2left; 0=target1right; 0=correctsignal]


/timeout = 1000


/ validresponse = (noresponse)


/ ontrialend = [if (block.1.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]


/ iscorrectresponse = [block.1.correct]


</trial>



<trial angry2right>


/stimulustimes = [0=angry2right; 0=target1left; 0=correctsignal]


/timeout = 1000


/ validresponse = (noresponse)


/ ontrialend = [if (block.1.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]


/ iscorrectresponse = [block.1.correct]


</trial>




<trial target1corrleft> 


/ validresponse = (lbuttondown, rbuttondown)


/correctresponse = (lbuttondown)


/inputdevice = mousekey


/pretrialpause =1000


/stimulustimes = [0=target1left; 0=target2right; 0=stimulussignal]


/ responsetrial = ("lbuttondown", happy1left)


/ responsetrial = ("rbuttondown", angry2right)


</trial>



<trial target1corrright> 


/ validresponse = (lbuttondown, rbuttondown)


/inputdevice = mousekey


/pretrialpause =1000


/ correctresponse = (rbuttondown)


/stimulustimes = [0=target1right; 0=target2left; 0=stimulussignal]


/ responsetrial = ("lbuttondown", angry2left)


/ responsetrial = ("rbuttondown", happy1right)


</trial>



<trial happy2left>


/stimulustimes = [0=happy2left; 0=target1right; 0=correctsignal]


/timeout = 1000


/ validresponse = (noresponse)


/ ontrialend = [if (block.2.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]


/ iscorrectresponse = [block.2.correct]


</trial>



<trial happy2right>


/stimulustimes = [0=happy2right; 0=target1left; 0=correctsignal]


/timeout = 1000


/ validresponse = (noresponse)


/ ontrialend = [if (block.2.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]


/ iscorrectresponse = [block.2.correct]


</trial>



<trial angry1right>


/stimulustimes = [0=angry1right; 0=target2left; 0=correctsignal]


/ ontrialend = [if (block.2.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]


/timeout = 1000


/ validresponse = (noresponse)


/ iscorrectresponse = [block.2.correct]


</trial>



<trial angry1left>


/stimulustimes = [0=angry1left; 0=target2right; 0=correctsignal]


/ ontrialend = [if (block.2.correct) values.ncorrectinarow +=1 else values.ncorrectinarow=0]


/timeout = 1000


/ validresponse = (noresponse)


/ iscorrectresponse = [block.2.correct]


</trial>



<trial target2corrleft> 


/ validresponse = (lbuttondown, rbuttondown)


/correctresponse = (lbuttondown)


/inputdevice = mousekey


/pretrialpause =1000


/stimulustimes = [0=target2left; 0=target1right; 0=stimulussignal]


/ responsetrial = ("lbuttondown", happy2left)


/ responsetrial = ("rbuttondown", angry1right)


</trial>



<trial target2corrright> 


/ validresponse = (lbuttondown, rbuttondown)


/correctresponse = (rbuttondown)


/inputdevice = mousekey


/pretrialpause =1000


/stimulustimes = [0=target2right; 0=target1left; 0=stimulussignal]


/ responsetrial = ("lbuttondown", angry1left)


/ responsetrial = ("rbuttondown", happy2right)


</trial>



<block 1>


/ trials = [1-30 = noreplace (target1corrleft, target1corrright)]


/ stop = [values.ncorrectinarow == 3]


</block>



<block 2>


/ trials = [1-30 = noreplace (target2corrleft, target2corrright)]


/ stop = [values.ncorrectinarow == 3]


</block>

By Dave - 9/17/2013

but it doesn't run properly.


Which means?


#1: You need an <expt> element to run several blocks.


#2: You need to reset the value back to zero /onblockbegin.