Unexpected exit in branching


Author
Message
YL
YL
Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)
Group: Forum Members
Posts: 6, Visits: 49
Hi 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!


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
YL - Friday, March 24, 2017
Hi 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?

Edited 8 Years Ago by Dave
YL
YL
Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)Respected Member (494 reputation)
Group: Forum Members
Posts: 6, Visits: 49
Dave - Friday, March 24, 2017
YL - Friday, March 24, 2017
Hi 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!
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
YL - Friday, March 24, 2017
Dave - Friday, March 24, 2017
YL - Friday, March 24, 2017
Hi 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!

> now the script does not jump to the end but stay at the break image when pressing space bar.

Whyever that is, it is not due to the /branch logic, which works fine.

<values>
/ novcounter = 4
/ famcounter = 100
</values>

<block myblock>
/ trials = [1=Instru_break]
</block>

<trial Instru_break>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
/ responseinterrupt = frames
/ recorddata = false
/ branch = [if(trial.Instru_break.response == 57)
trial.trialselector
]
</trial>

<trial Instru_blockend>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
/ trialduration = 5000
/ responseinterrupt = frames
</trial>

<trial r1_Select>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<trial r2_Select>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</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>

<text mytext>
/ items = ("<%script.currenttrial%>")
</text>

Notice that if values.novcounter is equal to 3, you'll be continuously sent to the break trial by your /branch in <trial trialselector>:

<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>

See for yourself:

<values>
/ novcounter = 3
/ famcounter = 100
</values>


<block myblock>
/ trials = [1=Instru_break]
</block>

<trial Instru_break>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
/ responseinterrupt = frames
/ recorddata = false
/ branch = [if(trial.Instru_break.response == 57)
trial.trialselector
]
</trial>

<trial Instru_blockend>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
/ trialduration = 5000
/ responseinterrupt = frames
</trial>

<trial r1_Select>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<trial r2_Select>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</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>

<text mytext>
/ items = ("<%script.currenttrial%>")
</text>


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search