+x+xHi there,
I need to create a break within a block. I've created a trial to display break message, and it is supposed to end the break and continue the trials when participants press space bar. Currently the program exists (blockend) after the break, could anyone tell me what is going wrong with my code?
<trial Instru_break>
/ stimulustimes = [0= Instru_break]
/ validresponse = (57)
/ responseinterrupt = frames
/ recorddata = false
/ branch = [
trial.trialselector
]
<trial trialselector>
/ trialduration = 0
/ branch = [
if (values.nCounter==55)
trial.Instru_blockend;
else if (values.nCounter +values.fCounter==150)
trial.Instru_blockend;
else if (values.nCounter==3)
trial.Instru_break
else if (rand(-1,1)>0)
trial.1_Select;
else
trial.2_Select;
;
]
/ recorddata = false
Thanks for your help!
> could anyone tell me what is going wrong with my code?
No, not really, because the vast majority of relevant information is missing.
What this means, generally, is that one of the branch conditions for invoking trial.instru_blockend
/ branch = [
if (values.nCounter==55)
trial.Instru_blockend;
else if (values.nCounter +values.fCounter==150)
trial.Instru_blockend;
evaluates to true.
And there are further issues wit the branch syntax, such as missing statement separators (;).
else if (values.nCounter==3)
trial.Instru_break <--- missing ;
Could you please post an more complete, ideally self-contained and runnable example?
Hi Dave, thanks for your reply. I've added the missing ; now the script does not jump to the end but stay at the break image when pressing space bar.
<trial Instru_blockend>
/ stimulustimes = [0= Instru_blockend]
/ validresponse = (57)
/ trialduration = 5000
/ responseinterrupt = frames
<trial Instru_break>
/ stimulustimes = [0= Instru_break]
/ validresponse = (57)
/ responseinterrupt = frames
/ recorddata = false
/ branch = [if(trial.Instru_break.response == 57)
trial.trialselector
]
<trial r1_Select>
/ stimulustimes = [0=fixation; 1000=r1]
/ validresponse = ("1","2","3","4")
/ trialduration = 2500
/ beginresponsetime = 1000
/ responseinterrupt = frames
/ branch = [
if (trial.r1_Select.response == 2)
trial.r1_d1_selected
]
/ branch = [
if (trial.r1_Select.response == 3)
trial.r1_d2_selected
]
/ branch = [
if (trial.r1_Select.response == 4)
trial.r1_d3_selected
]
/ branch = [
if (trial.r1_Select.response == 5)
trial.r1_d4_selected
]
/ responsetrial = (noresponse, trial.tooslow)
/ ontrialend = [
trial.r1_Select.resetstimulusframes()
values.trialNum=values.famCounter+values.novCounter-1
if (trial.r1_Select.response == 2)
values.picknDoor=1
else if (trial.Room1_Select.response == 3)
values.picknDoor=1
else if (trial.Room1_Select.response == 4)
values.picknDoor=0
else if (trial.Room1_Select.response == 5)
values.picknDoor=0
]
</trial>
<trial r2_Select>
/ stimulustimes = [0=fixation; 1000=r2]
/ validresponse = ("1","2","3","4")
/ trialduration = 2500
/ beginresponsetime = 1000
/ responseinterrupt = frames
/ branch = [
if (trial.r2_Select.response == 2)
trial.r2_d1_selected
]
/ branch = [
if (trial.r2_Select.response == 3)
trial.r2_d2_selected
]
/ branch = [
if (trial.r2_Select.response == 4)
trial.r2_d3_selected
]
/ branch = [
if (trial.r2_Select.response == 5)
trial.r2_d4_selected
]
/ responsetrial = (noresponse, trial.tooslow)
/ ontrialend = [
trial.r2_Select.resetstimulusframes()
values.trialNum=values.famCounter+values.novCounter-1
if (trial.r1_Select.response == 2)
values.picknDoor=0
else if (trial.r1_Select.response == 3)
values.picknDoor=1
else if (trial.r1_Select.response == 4)
values.picknDoor=0
else if (trial.r1_Select.response == 5)
values.picknDoor=1
]
</trial>
<trial trialselector>
/ trialduration = 0
/ branch = [
if (values.novCounter==55)
trial.Instru_blockend;
else if (values.novCounter+values.famCounter==150)
trial.Instru_blockend;
else if (values.novCounter==3)
trial.Instru_break;
else if (rand(-1,1)>0)
trial.r1_Select;
else
trial.r2_Select;
]
/ recorddata = false
</trial>
Thanks!