how to record both keyboard and mouse responses within a single trial


Author
Message
eleonora_parr
eleonora_parr
New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)
Group: Forum Members
Posts: 12, Visits: 39
Hi all, 
I am programming an experiment in which I would need to record both mouse coordinates and keyboard responses within a single trial:
the structure of the experiment looks like this:

<text space>
/ fontstyle = ("Arial", 18pt, true)
/ items = ("Press the spacebar to continue")
</text>

<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/time_sound = (round(rand(60,180)))
/time_second_frame = time_sound+60+5
/time_third_frame = time_sound+60+5+5
/time_fourth_frame = time_sound+60+5+5+5
/time_fifth_frame = time_sound+60+5+5+5+5
</values>


<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulusframes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>

So that the intertrial interval is represented by the "space trial": here participants have to press the spacebar to start the next trial and keep it pressed for the whole trial. They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond).
I need to know and make sure that participants keep the spacebar pressed for the whole trial interval, as this information represents an exclusion criterion for the experiment. 
Is there a way to record both spacebar release (or the duration of spacebar pressing) and mouse coordinates wihin a single trial? 

Thank you very much.

Eleonora
Dave
Dave
Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)
Group: Administrators
Posts: 10K, Visits: 63K
eleonora_parr - 1/13/2021
Hi all, 
I am programming an experiment in which I would need to record both mouse coordinates and keyboard responses within a single trial:
the structure of the experiment looks like this:

<text space>
/ fontstyle = ("Arial", 18pt, true)
/ items = ("Press the spacebar to continue")
</text>

<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/time_sound = (round(rand(60,180)))
/time_second_frame = time_sound+60+5
/time_third_frame = time_sound+60+5+5
/time_fourth_frame = time_sound+60+5+5+5
/time_fifth_frame = time_sound+60+5+5+5+5
</values>


<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulusframes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>

So that the intertrial interval is represented by the "space trial": here participants have to press the spacebar to start the next trial and keep it pressed for the whole trial. They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond).
I need to know and make sure that participants keep the spacebar pressed for the whole trial interval, as this information represents an exclusion criterion for the experiment. 
Is there a way to record both spacebar release (or the duration of spacebar pressing) and mouse coordinates wihin a single trial? 

Thank you very much.

Eleonora

To record the potential space bar release, you need to set inputdevice to keyboard in <trial safe_3_backward_inc> and define the valid response as -57 (the prepended minus indicates a key release). To record mouse coordinates during that same trial, you can use /datastreams.

<trial example>
// press on the space bar starts the trial
/ pretrialsignal = (keyboard, 57)
/ stimulusframes = [1=mytext]
/ inputdevice = keyboard
/ showmousecursor = true
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ timeout = 5000
/ datastreams = (mousecoordinates)
</trial>

<datastream mousecoordinates> 
/ columns = (build, computer.platform,
date, time, subject, group, session,
display.canvasheight, display.canvaswidth,
blockcode, blocknum,
trialcode, trialnum,
script.elapsedtime,
mouse.x, mouse.y)
</datastream>

<text mytext>
/ items = ("Don't release.")
</text>

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



eleonora_parr
eleonora_parr
New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)
Group: Forum Members
Posts: 12, Visits: 39
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Hi all, 
I am programming an experiment in which I would need to record both mouse coordinates and keyboard responses within a single trial:
the structure of the experiment looks like this:

<text space>
/ fontstyle = ("Arial", 18pt, true)
/ items = ("Press the spacebar to continue")
</text>

<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/time_sound = (round(rand(60,180)))
/time_second_frame = time_sound+60+5
/time_third_frame = time_sound+60+5+5
/time_fourth_frame = time_sound+60+5+5+5
/time_fifth_frame = time_sound+60+5+5+5+5
</values>


<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulusframes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>

So that the intertrial interval is represented by the "space trial": here participants have to press the spacebar to start the next trial and keep it pressed for the whole trial. They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond).
I need to know and make sure that participants keep the spacebar pressed for the whole trial interval, as this information represents an exclusion criterion for the experiment. 
Is there a way to record both spacebar release (or the duration of spacebar pressing) and mouse coordinates wihin a single trial? 

Thank you very much.

Eleonora

To record the potential space bar release, you need to set inputdevice to keyboard in <trial safe_3_backward_inc> and define the valid response as -57 (the prepended minus indicates a key release). To record mouse coordinates during that same trial, you can use /datastreams.

<trial example>
// press on the space bar starts the trial
/ pretrialsignal = (keyboard, 57)
/ stimulusframes = [1=mytext]
/ inputdevice = keyboard
/ showmousecursor = true
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ timeout = 5000
/ datastreams = (mousecoordinates)
</trial>

<datastream mousecoordinates> 
/ columns = (build, computer.platform,
date, time, subject, group, session,
display.canvasheight, display.canvaswidth,
blockcode, blocknum,
trialcode, trialnum,
script.elapsedtime,
mouse.x, mouse.y)
</datastream>

<text mytext>
/ items = ("Don't release.")
</text>

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



Hi Dave,
Thank you very much for your response.
May I ask you to clarify what the subsequent attribute/function do ?
/ pretrialsignal = (keyboard, 57)
Can I also ask you why would you set this timeout to the trial?
/ timeout = 5000
Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have. 
Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element? 
Thank you so much!

Eleonora


Dave
Dave
Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)
Group: Administrators
Posts: 10K, Visits: 63K
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Hi all, 
I am programming an experiment in which I would need to record both mouse coordinates and keyboard responses within a single trial:
the structure of the experiment looks like this:

<text space>
/ fontstyle = ("Arial", 18pt, true)
/ items = ("Press the spacebar to continue")
</text>

<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/time_sound = (round(rand(60,180)))
/time_second_frame = time_sound+60+5
/time_third_frame = time_sound+60+5+5
/time_fourth_frame = time_sound+60+5+5+5
/time_fifth_frame = time_sound+60+5+5+5+5
</values>


<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulusframes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>

So that the intertrial interval is represented by the "space trial": here participants have to press the spacebar to start the next trial and keep it pressed for the whole trial. They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond).
I need to know and make sure that participants keep the spacebar pressed for the whole trial interval, as this information represents an exclusion criterion for the experiment. 
Is there a way to record both spacebar release (or the duration of spacebar pressing) and mouse coordinates wihin a single trial? 

Thank you very much.

Eleonora

To record the potential space bar release, you need to set inputdevice to keyboard in <trial safe_3_backward_inc> and define the valid response as -57 (the prepended minus indicates a key release). To record mouse coordinates during that same trial, you can use /datastreams.

<trial example>
// press on the space bar starts the trial
/ pretrialsignal = (keyboard, 57)
/ stimulusframes = [1=mytext]
/ inputdevice = keyboard
/ showmousecursor = true
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ timeout = 5000
/ datastreams = (mousecoordinates)
</trial>

<datastream mousecoordinates> 
/ columns = (build, computer.platform,
date, time, subject, group, session,
display.canvasheight, display.canvaswidth,
blockcode, blocknum,
trialcode, trialnum,
script.elapsedtime,
mouse.x, mouse.y)
</datastream>

<text mytext>
/ items = ("Don't release.")
</text>

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



Hi Dave,
Thank you very much for your response.
May I ask you to clarify what the subsequent attribute/function do ?
/ pretrialsignal = (keyboard, 57)
Can I also ask you why would you set this timeout to the trial?
/ timeout = 5000
Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have. 
Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element? 
Thank you so much!

Eleonora


/ pretrialsignal = (keyboard, 57)

https://www.millisecond.com/support/docs/v6/html/language/attributes/pretrialsignal.htm

This just makes sure that the space barr is down when the example trial actually starts. It's just there for the sake of the example code, you probably handle that in <trial space> in your code (which I don't have).

> Can I also ask you why would you set this timeout to the trial?
> / timeout = 5000

Again, this is only for the sake of illustration. I want the example trial to immediately end if the space bar is released during the trial, and this achieves just that. You're using /trialduration in the corresponding trial, which fixes the duration.

> Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have.

Yes, that's sufficient.

> Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element?

The data will end up in a separate data file, with columns as defined in the <datastream mousecoordinates> elements. This is separate from and in addition to any data file defined per <data>.



eleonora_parr
eleonora_parr
New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)
Group: Forum Members
Posts: 12, Visits: 39
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Hi all, 
I am programming an experiment in which I would need to record both mouse coordinates and keyboard responses within a single trial:
the structure of the experiment looks like this:

<text space>
/ fontstyle = ("Arial", 18pt, true)
/ items = ("Press the spacebar to continue")
</text>

<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/time_sound = (round(rand(60,180)))
/time_second_frame = time_sound+60+5
/time_third_frame = time_sound+60+5+5
/time_fourth_frame = time_sound+60+5+5+5
/time_fifth_frame = time_sound+60+5+5+5+5
</values>


<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulusframes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>

So that the intertrial interval is represented by the "space trial": here participants have to press the spacebar to start the next trial and keep it pressed for the whole trial. They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond).
I need to know and make sure that participants keep the spacebar pressed for the whole trial interval, as this information represents an exclusion criterion for the experiment. 
Is there a way to record both spacebar release (or the duration of spacebar pressing) and mouse coordinates wihin a single trial? 

Thank you very much.

Eleonora

To record the potential space bar release, you need to set inputdevice to keyboard in <trial safe_3_backward_inc> and define the valid response as -57 (the prepended minus indicates a key release). To record mouse coordinates during that same trial, you can use /datastreams.

<trial example>
// press on the space bar starts the trial
/ pretrialsignal = (keyboard, 57)
/ stimulusframes = [1=mytext]
/ inputdevice = keyboard
/ showmousecursor = true
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ timeout = 5000
/ datastreams = (mousecoordinates)
</trial>

<datastream mousecoordinates> 
/ columns = (build, computer.platform,
date, time, subject, group, session,
display.canvasheight, display.canvaswidth,
blockcode, blocknum,
trialcode, trialnum,
script.elapsedtime,
mouse.x, mouse.y)
</datastream>

<text mytext>
/ items = ("Don't release.")
</text>

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



Hi Dave,
Thank you very much for your response.
May I ask you to clarify what the subsequent attribute/function do ?
/ pretrialsignal = (keyboard, 57)
Can I also ask you why would you set this timeout to the trial?
/ timeout = 5000
Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have. 
Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element? 
Thank you so much!

Eleonora


/ pretrialsignal = (keyboard, 57)

https://www.millisecond.com/support/docs/v6/html/language/attributes/pretrialsignal.htm

This just makes sure that the space barr is down when the example trial actually starts. It's just there for the sake of the example code, you probably handle that in <trial space> in your code (which I don't have).

> Can I also ask you why would you set this timeout to the trial?
> / timeout = 5000

Again, this is only for the sake of illustration. I want the example trial to immediately end if the space bar is released during the trial, and this achieves just that. You're using /trialduration in the corresponding trial, which fixes the duration.

> Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have.

Yes, that's sufficient.

> Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element?

The data will end up in a separate data file, with columns as defined in the <datastream mousecoordinates> elements. This is separate from and in addition to any data file defined per <data>.



Oh I see, the only problem is that the trial should end when subjects make the mouse response..
Indeed before I set this in the trial safe_3_backward_inc_respond as:
/ correctresponse = (lbuttondown)
That was why I asked if 2 input devices could be used within a trial, as I need to both record mouse and keyboard responses, but the mouse click should also be what triggers the end of the trial.
I am afraid that if the inputdevice is set as keyboard this is not possible though.. ? Is there any trick that can be used? 

Thank you again,

Eleonora
Dave
Dave
Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)
Group: Administrators
Posts: 10K, Visits: 63K
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Hi all, 
I am programming an experiment in which I would need to record both mouse coordinates and keyboard responses within a single trial:
the structure of the experiment looks like this:

<text space>
/ fontstyle = ("Arial", 18pt, true)
/ items = ("Press the spacebar to continue")
</text>

<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/time_sound = (round(rand(60,180)))
/time_second_frame = time_sound+60+5
/time_third_frame = time_sound+60+5+5
/time_fourth_frame = time_sound+60+5+5+5
/time_fifth_frame = time_sound+60+5+5+5+5
</values>


<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulusframes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>

So that the intertrial interval is represented by the "space trial": here participants have to press the spacebar to start the next trial and keep it pressed for the whole trial. They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond).
I need to know and make sure that participants keep the spacebar pressed for the whole trial interval, as this information represents an exclusion criterion for the experiment. 
Is there a way to record both spacebar release (or the duration of spacebar pressing) and mouse coordinates wihin a single trial? 

Thank you very much.

Eleonora

To record the potential space bar release, you need to set inputdevice to keyboard in <trial safe_3_backward_inc> and define the valid response as -57 (the prepended minus indicates a key release). To record mouse coordinates during that same trial, you can use /datastreams.

<trial example>
// press on the space bar starts the trial
/ pretrialsignal = (keyboard, 57)
/ stimulusframes = [1=mytext]
/ inputdevice = keyboard
/ showmousecursor = true
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ timeout = 5000
/ datastreams = (mousecoordinates)
</trial>

<datastream mousecoordinates> 
/ columns = (build, computer.platform,
date, time, subject, group, session,
display.canvasheight, display.canvaswidth,
blockcode, blocknum,
trialcode, trialnum,
script.elapsedtime,
mouse.x, mouse.y)
</datastream>

<text mytext>
/ items = ("Don't release.")
</text>

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



Hi Dave,
Thank you very much for your response.
May I ask you to clarify what the subsequent attribute/function do ?
/ pretrialsignal = (keyboard, 57)
Can I also ask you why would you set this timeout to the trial?
/ timeout = 5000
Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have. 
Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element? 
Thank you so much!

Eleonora


/ pretrialsignal = (keyboard, 57)

https://www.millisecond.com/support/docs/v6/html/language/attributes/pretrialsignal.htm

This just makes sure that the space barr is down when the example trial actually starts. It's just there for the sake of the example code, you probably handle that in <trial space> in your code (which I don't have).

> Can I also ask you why would you set this timeout to the trial?
> / timeout = 5000

Again, this is only for the sake of illustration. I want the example trial to immediately end if the space bar is released during the trial, and this achieves just that. You're using /trialduration in the corresponding trial, which fixes the duration.

> Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have.

Yes, that's sufficient.

> Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element?

The data will end up in a separate data file, with columns as defined in the <datastream mousecoordinates> elements. This is separate from and in addition to any data file defined per <data>.



Oh I see, the only problem is that the trial should end when subjects make the mouse response..
Indeed before I set this in the trial safe_3_backward_inc_respond as:
/ correctresponse = (lbuttondown)
That was why I asked if 2 input devices could be used within a trial, as I need to both record mouse and keyboard responses, but the mouse click should also be what triggers the end of the trial.
I am afraid that if the inputdevice is set as keyboard this is not possible though.. ? Is there any trick that can be used? 

Thank you again,

Eleonora

No, two input devices in a single <trial> are not possible. However, I don't see where or why you need both keyboard and mouse in

<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
      trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
      trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>

That trial, as you currently have it, does not register any responses to begin with, validresponse is set to no response.

You wrote: "They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond)."

That is, <trial safe_3_backward_inc_respond> does not need two input devices, it only needs the mouse. <trial safe_3_backward_inc> can be set to keyboard and register any potential key release as well as log mouse coordinates as demonstrated.

eleonora_parr
eleonora_parr
New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)
Group: Forum Members
Posts: 12, Visits: 39
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Hi all, 
I am programming an experiment in which I would need to record both mouse coordinates and keyboard responses within a single trial:
the structure of the experiment looks like this:

<text space>
/ fontstyle = ("Arial", 18pt, true)
/ items = ("Press the spacebar to continue")
</text>

<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/time_sound = (round(rand(60,180)))
/time_second_frame = time_sound+60+5
/time_third_frame = time_sound+60+5+5
/time_fourth_frame = time_sound+60+5+5+5
/time_fifth_frame = time_sound+60+5+5+5+5
</values>


<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulusframes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>

So that the intertrial interval is represented by the "space trial": here participants have to press the spacebar to start the next trial and keep it pressed for the whole trial. They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond).
I need to know and make sure that participants keep the spacebar pressed for the whole trial interval, as this information represents an exclusion criterion for the experiment. 
Is there a way to record both spacebar release (or the duration of spacebar pressing) and mouse coordinates wihin a single trial? 

Thank you very much.

Eleonora

To record the potential space bar release, you need to set inputdevice to keyboard in <trial safe_3_backward_inc> and define the valid response as -57 (the prepended minus indicates a key release). To record mouse coordinates during that same trial, you can use /datastreams.

<trial example>
// press on the space bar starts the trial
/ pretrialsignal = (keyboard, 57)
/ stimulusframes = [1=mytext]
/ inputdevice = keyboard
/ showmousecursor = true
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ timeout = 5000
/ datastreams = (mousecoordinates)
</trial>

<datastream mousecoordinates> 
/ columns = (build, computer.platform,
date, time, subject, group, session,
display.canvasheight, display.canvaswidth,
blockcode, blocknum,
trialcode, trialnum,
script.elapsedtime,
mouse.x, mouse.y)
</datastream>

<text mytext>
/ items = ("Don't release.")
</text>

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



Hi Dave,
Thank you very much for your response.
May I ask you to clarify what the subsequent attribute/function do ?
/ pretrialsignal = (keyboard, 57)
Can I also ask you why would you set this timeout to the trial?
/ timeout = 5000
Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have. 
Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element? 
Thank you so much!

Eleonora


/ pretrialsignal = (keyboard, 57)

https://www.millisecond.com/support/docs/v6/html/language/attributes/pretrialsignal.htm

This just makes sure that the space barr is down when the example trial actually starts. It's just there for the sake of the example code, you probably handle that in <trial space> in your code (which I don't have).

> Can I also ask you why would you set this timeout to the trial?
> / timeout = 5000

Again, this is only for the sake of illustration. I want the example trial to immediately end if the space bar is released during the trial, and this achieves just that. You're using /trialduration in the corresponding trial, which fixes the duration.

> Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have.

Yes, that's sufficient.

> Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element?

The data will end up in a separate data file, with columns as defined in the <datastream mousecoordinates> elements. This is separate from and in addition to any data file defined per <data>.



Oh I see, the only problem is that the trial should end when subjects make the mouse response..
Indeed before I set this in the trial safe_3_backward_inc_respond as:
/ correctresponse = (lbuttondown)
That was why I asked if 2 input devices could be used within a trial, as I need to both record mouse and keyboard responses, but the mouse click should also be what triggers the end of the trial.
I am afraid that if the inputdevice is set as keyboard this is not possible though.. ? Is there any trick that can be used? 

Thank you again,

Eleonora

No, two input devices in a single <trial> are not possible. However, I don't see where or why you need both keyboard and mouse in

<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
      trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
      trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>

That trial, as you currently have it, does not register any responses to begin with, validresponse is set to no response.

You wrote: "They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond)."

That is, <trial safe_3_backward_inc_respond> does not need two input devices, it only needs the mouse. <trial safe_3_backward_inc> can be set to keyboard and register any potential key release as well as log mouse coordinates as demonstrated.

Oh, sorry, I probably did not express myself well. They have to keep the spacebar pressed for the whole trial safe_3_backward_inc and they can release it when the trial safe_3_backward_inc_respond begins, which is when they have to make the mouse response.
So the potential spacebar release should be recorded during both safe_3_backward_inc AND safe_3_backward_inc_respond, to make sure that they released the spacebar just before making the mouse response (that they did not release it too early) 
However, this trick allow us to check anyway if they released the spacebar before the begin of the trial safe_3_backward_inc_respond, so in some way it kinda solve the problem :-)
Greatly appreciated, thank you so much!

Eleonora
eleonora_parr
eleonora_parr
New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)
Group: Forum Members
Posts: 12, Visits: 39
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Hi all, 
I am programming an experiment in which I would need to record both mouse coordinates and keyboard responses within a single trial:
the structure of the experiment looks like this:

<text space>
/ fontstyle = ("Arial", 18pt, true)
/ items = ("Press the spacebar to continue")
</text>

<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/time_sound = (round(rand(60,180)))
/time_second_frame = time_sound+60+5
/time_third_frame = time_sound+60+5+5
/time_fourth_frame = time_sound+60+5+5+5
/time_fifth_frame = time_sound+60+5+5+5+5
</values>


<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulusframes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>

So that the intertrial interval is represented by the "space trial": here participants have to press the spacebar to start the next trial and keep it pressed for the whole trial. They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond).
I need to know and make sure that participants keep the spacebar pressed for the whole trial interval, as this information represents an exclusion criterion for the experiment. 
Is there a way to record both spacebar release (or the duration of spacebar pressing) and mouse coordinates wihin a single trial? 

Thank you very much.

Eleonora

To record the potential space bar release, you need to set inputdevice to keyboard in <trial safe_3_backward_inc> and define the valid response as -57 (the prepended minus indicates a key release). To record mouse coordinates during that same trial, you can use /datastreams.

<trial example>
// press on the space bar starts the trial
/ pretrialsignal = (keyboard, 57)
/ stimulusframes = [1=mytext]
/ inputdevice = keyboard
/ showmousecursor = true
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ timeout = 5000
/ datastreams = (mousecoordinates)
</trial>

<datastream mousecoordinates> 
/ columns = (build, computer.platform,
date, time, subject, group, session,
display.canvasheight, display.canvaswidth,
blockcode, blocknum,
trialcode, trialnum,
script.elapsedtime,
mouse.x, mouse.y)
</datastream>

<text mytext>
/ items = ("Don't release.")
</text>

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



Hi Dave,
Thank you very much for your response.
May I ask you to clarify what the subsequent attribute/function do ?
/ pretrialsignal = (keyboard, 57)
Can I also ask you why would you set this timeout to the trial?
/ timeout = 5000
Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have. 
Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element? 
Thank you so much!

Eleonora


/ pretrialsignal = (keyboard, 57)

https://www.millisecond.com/support/docs/v6/html/language/attributes/pretrialsignal.htm

This just makes sure that the space barr is down when the example trial actually starts. It's just there for the sake of the example code, you probably handle that in <trial space> in your code (which I don't have).

> Can I also ask you why would you set this timeout to the trial?
> / timeout = 5000

Again, this is only for the sake of illustration. I want the example trial to immediately end if the space bar is released during the trial, and this achieves just that. You're using /trialduration in the corresponding trial, which fixes the duration.

> Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have.

Yes, that's sufficient.

> Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element?

The data will end up in a separate data file, with columns as defined in the <datastream mousecoordinates> elements. This is separate from and in addition to any data file defined per <data>.



Oh I see, the only problem is that the trial should end when subjects make the mouse response..
Indeed before I set this in the trial safe_3_backward_inc_respond as:
/ correctresponse = (lbuttondown)
That was why I asked if 2 input devices could be used within a trial, as I need to both record mouse and keyboard responses, but the mouse click should also be what triggers the end of the trial.
I am afraid that if the inputdevice is set as keyboard this is not possible though.. ? Is there any trick that can be used? 

Thank you again,

Eleonora

No, two input devices in a single <trial> are not possible. However, I don't see where or why you need both keyboard and mouse in

<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
      trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
      trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>

That trial, as you currently have it, does not register any responses to begin with, validresponse is set to no response.

You wrote: "They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond)."

That is, <trial safe_3_backward_inc_respond> does not need two input devices, it only needs the mouse. <trial safe_3_backward_inc> can be set to keyboard and register any potential key release as well as log mouse coordinates as demonstrated.

Oh, sorry, I probably did not express myself well. They have to keep the spacebar pressed for the whole trial safe_3_backward_inc and they can release it when the trial safe_3_backward_inc_respond begins, which is when they have to make the mouse response.
So the potential spacebar release should be recorded during both safe_3_backward_inc AND safe_3_backward_inc_respond, to make sure that they released the spacebar just before making the mouse response (that they did not release it too early) 
However, this trick allow us to check anyway if they released the spacebar before the begin of the trial safe_3_backward_inc_respond, so in some way it kinda solve the problem :-)
Greatly appreciated, thank you so much!

Eleonora

Hi Dave,
Sorry to bother again, but I am having problems in recording the spacebar release in the data: I followed a couple of examples that I found in the forum (https://www.millisecond.com/forums/Topic15810.aspx#15812 and https://www.millisecond.com/forums/Topic16749.aspx#16752) 
For now my code is:
<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/fixate_duration = 0
/time_sound = round(rand(1000,3000))
/time_second_frame = time_sound+1000+83.5
/time_third_frame = time_sound+1000+83.5+83.5
/time_fourth_frame = time_sound+1000+83.5+83.5+83.5
/time_fifth_frame = time_sound++1000+83.5+83.5+83.5+83.5
/spacebarpresscount= ""
</values>

<trial fixate>
/ pretrialpause = 1000
/ ontrialbegin = [values.fixate_duration = round(rand(500,1000))]
/ stimulusframes = [1 = cross]
/ trialduration = values.fixate_duration
</trial>

<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.spacebarpresscount=""; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulustime(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulustime(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulustime(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulustimes = [1 = safe_first_frame]
/ inputdevice = keyboard
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ isvalidresponse = [if(trial.safe_3_backward_inc.response == -57){values.spacebarpresscount += 1;}]
/ monkeyresponse = (-57)
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulustimes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>
<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<block 3_safe_backward_con>
/ trials = [1= sequence(fixate,safe_3_backward_con)]
</block>


<data>
/ columns = [date,time,group,subject, display.canvaswidth, display.canvasheight, session, build, blocknum, blockcode, trialnum,trialcode, pretrialpause,
posttrialpause, trialduration, values.Actiontype, values.congruency, values.object, values.length, values.fixate_duration, values.spacebarpresscount,
stimulusitem, stimulusitem, stimulusitem, stimulusitem,stimulusitem,stimulusitem,stimulusitem
stimulusonset, stimulusonset, stimulusonset, stimulusonset, stimulusonset, stimulusonset, stimulusonset
correct, latency, response,values.x,values.y]
</data>

But when I run the code, the column spacebarpresscount is always empty. I've also tried /spacebarpresscount= 0 instead of /spacebarpresscount= "", unfortunately nothing changed..
Any suggestion?

Thank you so much!
Dave
Dave
Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)
Group: Administrators
Posts: 10K, Visits: 63K
eleonora_parr - 1/14/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Hi all, 
I am programming an experiment in which I would need to record both mouse coordinates and keyboard responses within a single trial:
the structure of the experiment looks like this:

<text space>
/ fontstyle = ("Arial", 18pt, true)
/ items = ("Press the spacebar to continue")
</text>

<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/time_sound = (round(rand(60,180)))
/time_second_frame = time_sound+60+5
/time_third_frame = time_sound+60+5+5
/time_fourth_frame = time_sound+60+5+5+5
/time_fifth_frame = time_sound+60+5+5+5+5
</values>


<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulusframes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>

So that the intertrial interval is represented by the "space trial": here participants have to press the spacebar to start the next trial and keep it pressed for the whole trial. They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond).
I need to know and make sure that participants keep the spacebar pressed for the whole trial interval, as this information represents an exclusion criterion for the experiment. 
Is there a way to record both spacebar release (or the duration of spacebar pressing) and mouse coordinates wihin a single trial? 

Thank you very much.

Eleonora

To record the potential space bar release, you need to set inputdevice to keyboard in <trial safe_3_backward_inc> and define the valid response as -57 (the prepended minus indicates a key release). To record mouse coordinates during that same trial, you can use /datastreams.

<trial example>
// press on the space bar starts the trial
/ pretrialsignal = (keyboard, 57)
/ stimulusframes = [1=mytext]
/ inputdevice = keyboard
/ showmousecursor = true
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ timeout = 5000
/ datastreams = (mousecoordinates)
</trial>

<datastream mousecoordinates> 
/ columns = (build, computer.platform,
date, time, subject, group, session,
display.canvasheight, display.canvaswidth,
blockcode, blocknum,
trialcode, trialnum,
script.elapsedtime,
mouse.x, mouse.y)
</datastream>

<text mytext>
/ items = ("Don't release.")
</text>

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



Hi Dave,
Thank you very much for your response.
May I ask you to clarify what the subsequent attribute/function do ?
/ pretrialsignal = (keyboard, 57)
Can I also ask you why would you set this timeout to the trial?
/ timeout = 5000
Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have. 
Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element? 
Thank you so much!

Eleonora


/ pretrialsignal = (keyboard, 57)

https://www.millisecond.com/support/docs/v6/html/language/attributes/pretrialsignal.htm

This just makes sure that the space barr is down when the example trial actually starts. It's just there for the sake of the example code, you probably handle that in <trial space> in your code (which I don't have).

> Can I also ask you why would you set this timeout to the trial?
> / timeout = 5000

Again, this is only for the sake of illustration. I want the example trial to immediately end if the space bar is released during the trial, and this achieves just that. You're using /trialduration in the corresponding trial, which fixes the duration.

> Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have.

Yes, that's sufficient.

> Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element?

The data will end up in a separate data file, with columns as defined in the <datastream mousecoordinates> elements. This is separate from and in addition to any data file defined per <data>.



Oh I see, the only problem is that the trial should end when subjects make the mouse response..
Indeed before I set this in the trial safe_3_backward_inc_respond as:
/ correctresponse = (lbuttondown)
That was why I asked if 2 input devices could be used within a trial, as I need to both record mouse and keyboard responses, but the mouse click should also be what triggers the end of the trial.
I am afraid that if the inputdevice is set as keyboard this is not possible though.. ? Is there any trick that can be used? 

Thank you again,

Eleonora

No, two input devices in a single <trial> are not possible. However, I don't see where or why you need both keyboard and mouse in

<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
      trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
      trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>

That trial, as you currently have it, does not register any responses to begin with, validresponse is set to no response.

You wrote: "They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond)."

That is, <trial safe_3_backward_inc_respond> does not need two input devices, it only needs the mouse. <trial safe_3_backward_inc> can be set to keyboard and register any potential key release as well as log mouse coordinates as demonstrated.

Oh, sorry, I probably did not express myself well. They have to keep the spacebar pressed for the whole trial safe_3_backward_inc and they can release it when the trial safe_3_backward_inc_respond begins, which is when they have to make the mouse response.
So the potential spacebar release should be recorded during both safe_3_backward_inc AND safe_3_backward_inc_respond, to make sure that they released the spacebar just before making the mouse response (that they did not release it too early) 
However, this trick allow us to check anyway if they released the spacebar before the begin of the trial safe_3_backward_inc_respond, so in some way it kinda solve the problem :-)
Greatly appreciated, thank you so much!

Eleonora

Hi Dave,
Sorry to bother again, but I am having problems in recording the spacebar release in the data: I followed a couple of examples that I found in the forum (https://www.millisecond.com/forums/Topic15810.aspx#15812 and https://www.millisecond.com/forums/Topic16749.aspx#16752) 
For now my code is:
<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/fixate_duration = 0
/time_sound = round(rand(1000,3000))
/time_second_frame = time_sound+1000+83.5
/time_third_frame = time_sound+1000+83.5+83.5
/time_fourth_frame = time_sound+1000+83.5+83.5+83.5
/time_fifth_frame = time_sound++1000+83.5+83.5+83.5+83.5
/spacebarpresscount= ""
</values>

<trial fixate>
/ pretrialpause = 1000
/ ontrialbegin = [values.fixate_duration = round(rand(500,1000))]
/ stimulusframes = [1 = cross]
/ trialduration = values.fixate_duration
</trial>

<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.spacebarpresscount=""; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulustime(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulustime(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulustime(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulustimes = [1 = safe_first_frame]
/ inputdevice = keyboard
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ isvalidresponse = [if(trial.safe_3_backward_inc.response == -57){values.spacebarpresscount += 1;}]
/ monkeyresponse = (-57)
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulustimes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>
<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<block 3_safe_backward_con>
/ trials = [1= sequence(fixate,safe_3_backward_con)]
</block>


<data>
/ columns = [date,time,group,subject, display.canvaswidth, display.canvasheight, session, build, blocknum, blockcode, trialnum,trialcode, pretrialpause,
posttrialpause, trialduration, values.Actiontype, values.congruency, values.object, values.length, values.fixate_duration, values.spacebarpresscount,
stimulusitem, stimulusitem, stimulusitem, stimulusitem,stimulusitem,stimulusitem,stimulusitem
stimulusonset, stimulusonset, stimulusonset, stimulusonset, stimulusonset, stimulusonset, stimulusonset
correct, latency, response,values.x,values.y]
</data>

But when I run the code, the column spacebarpresscount is always empty. I've also tried /spacebarpresscount= 0 instead of /spacebarpresscount= "", unfortunately nothing changed..
Any suggestion?

Thank you so much!

Please provide code that is complete enough to actually run.
Dave
Dave
Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)
Group: Administrators
Posts: 10K, Visits: 63K
Dave - 1/14/2021
eleonora_parr - 1/14/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Dave - 1/13/2021
eleonora_parr - 1/13/2021
Hi all, 
I am programming an experiment in which I would need to record both mouse coordinates and keyboard responses within a single trial:
the structure of the experiment looks like this:

<text space>
/ fontstyle = ("Arial", 18pt, true)
/ items = ("Press the spacebar to continue")
</text>

<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/time_sound = (round(rand(60,180)))
/time_second_frame = time_sound+60+5
/time_third_frame = time_sound+60+5+5
/time_fourth_frame = time_sound+60+5+5+5
/time_fifth_frame = time_sound+60+5+5+5+5
</values>


<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulusframes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>

So that the intertrial interval is represented by the "space trial": here participants have to press the spacebar to start the next trial and keep it pressed for the whole trial. They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond).
I need to know and make sure that participants keep the spacebar pressed for the whole trial interval, as this information represents an exclusion criterion for the experiment. 
Is there a way to record both spacebar release (or the duration of spacebar pressing) and mouse coordinates wihin a single trial? 

Thank you very much.

Eleonora

To record the potential space bar release, you need to set inputdevice to keyboard in <trial safe_3_backward_inc> and define the valid response as -57 (the prepended minus indicates a key release). To record mouse coordinates during that same trial, you can use /datastreams.

<trial example>
// press on the space bar starts the trial
/ pretrialsignal = (keyboard, 57)
/ stimulusframes = [1=mytext]
/ inputdevice = keyboard
/ showmousecursor = true
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ timeout = 5000
/ datastreams = (mousecoordinates)
</trial>

<datastream mousecoordinates> 
/ columns = (build, computer.platform,
date, time, subject, group, session,
display.canvasheight, display.canvaswidth,
blockcode, blocknum,
trialcode, trialnum,
script.elapsedtime,
mouse.x, mouse.y)
</datastream>

<text mytext>
/ items = ("Don't release.")
</text>

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



Hi Dave,
Thank you very much for your response.
May I ask you to clarify what the subsequent attribute/function do ?
/ pretrialsignal = (keyboard, 57)
Can I also ask you why would you set this timeout to the trial?
/ timeout = 5000
Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have. 
Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element? 
Thank you so much!

Eleonora


/ pretrialsignal = (keyboard, 57)

https://www.millisecond.com/support/docs/v6/html/language/attributes/pretrialsignal.htm

This just makes sure that the space barr is down when the example trial actually starts. It's just there for the sake of the example code, you probably handle that in <trial space> in your code (which I don't have).

> Can I also ask you why would you set this timeout to the trial?
> / timeout = 5000

Again, this is only for the sake of illustration. I want the example trial to immediately end if the space bar is released during the trial, and this achieves just that. You're using /trialduration in the corresponding trial, which fixes the duration.

> Also, I have 24 types of trials like the trial safe_3_backward_inc. Is it sufficient to just set / datastreams = (mousecoordinates) at the end of each trial to record the mouse coordinates for every trial that I have.

Yes, that's sufficient.

> Last question: Is the datastream function equivalent to data? Can I insert in there also other data that I want to record or do I have to create an additional <data> element?

The data will end up in a separate data file, with columns as defined in the <datastream mousecoordinates> elements. This is separate from and in addition to any data file defined per <data>.



Oh I see, the only problem is that the trial should end when subjects make the mouse response..
Indeed before I set this in the trial safe_3_backward_inc_respond as:
/ correctresponse = (lbuttondown)
That was why I asked if 2 input devices could be used within a trial, as I need to both record mouse and keyboard responses, but the mouse click should also be what triggers the end of the trial.
I am afraid that if the inputdevice is set as keyboard this is not possible though.. ? Is there any trick that can be used? 

Thank you again,

Eleonora

No, two input devices in a single <trial> are not possible. However, I don't see where or why you need both keyboard and mouse in

<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulusframe(sound.take, values.time_sound);
      trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_second_frame, values.time_second_frame);
      trial.safe_3_backward_inc.insertstimulusframe(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulusframes = [1 = safe_first_frame]
/ validresponse = (0)
/ inputdevice = mousekey
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>

That trial, as you currently have it, does not register any responses to begin with, validresponse is set to no response.

You wrote: "They can release the spacebar just at the end of the trial safe_3_backward_inc, when they have then to make the mouse response (trial safe_3_backward_inc_respond)."

That is, <trial safe_3_backward_inc_respond> does not need two input devices, it only needs the mouse. <trial safe_3_backward_inc> can be set to keyboard and register any potential key release as well as log mouse coordinates as demonstrated.

Oh, sorry, I probably did not express myself well. They have to keep the spacebar pressed for the whole trial safe_3_backward_inc and they can release it when the trial safe_3_backward_inc_respond begins, which is when they have to make the mouse response.
So the potential spacebar release should be recorded during both safe_3_backward_inc AND safe_3_backward_inc_respond, to make sure that they released the spacebar just before making the mouse response (that they did not release it too early) 
However, this trick allow us to check anyway if they released the spacebar before the begin of the trial safe_3_backward_inc_respond, so in some way it kinda solve the problem :-)
Greatly appreciated, thank you so much!

Eleonora

Hi Dave,
Sorry to bother again, but I am having problems in recording the spacebar release in the data: I followed a couple of examples that I found in the forum (https://www.millisecond.com/forums/Topic15810.aspx#15812 and https://www.millisecond.com/forums/Topic16749.aspx#16752) 
For now my code is:
<values>
/Actiontype=0
/congruency = 0
/object = 0
/length = 0
/ x=0
/ y=0
/fixate_duration = 0
/time_sound = round(rand(1000,3000))
/time_second_frame = time_sound+1000+83.5
/time_third_frame = time_sound+1000+83.5+83.5
/time_fourth_frame = time_sound+1000+83.5+83.5+83.5
/time_fifth_frame = time_sound++1000+83.5+83.5+83.5+83.5
/spacebarpresscount= ""
</values>

<trial fixate>
/ pretrialpause = 1000
/ ontrialbegin = [values.fixate_duration = round(rand(500,1000))]
/ stimulusframes = [1 = cross]
/ trialduration = values.fixate_duration
</trial>

<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.spacebarpresscount=""; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulustime(sound.take, values.time_sound);
                trial.safe_3_backward_inc.insertstimulustime(picture.safe_minus_second_frame, values.time_second_frame);
                trial.safe_3_backward_inc.insertstimulustime(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulustimes = [1 = safe_first_frame]
/ inputdevice = keyboard
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ isvalidresponse = [if(trial.safe_3_backward_inc.response == -57){values.spacebarpresscount += 1;}]
/ monkeyresponse = (-57)
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>
<trial safe_3_backward_inc_respond>
/ stimulustimes = [1=safe_w]
/ inputdevice = mouse
/ showmousecursor = true
/ validresponse = (lbuttondown)
/ correctresponse = (lbuttondown)
/ ontrialend = [values.x=trial.safe_3_backward_inc_respond.responsex;values.y=trial.safe_3_backward_inc_respond.responsey;]
/ branch = [trial.space;]
</trial>
<trial space>
/ stimulusframes = [1=space]
/ inputdevice = keyboard
/ correctresponse =(57)
/ validresponse = (57)
/ posttrialpause = 500
</trial>

<block 3_safe_backward_con>
/ trials = [1= sequence(fixate,safe_3_backward_con)]
</block>


<data>
/ columns = [date,time,group,subject, display.canvaswidth, display.canvasheight, session, build, blocknum, blockcode, trialnum,trialcode, pretrialpause,
posttrialpause, trialduration, values.Actiontype, values.congruency, values.object, values.length, values.fixate_duration, values.spacebarpresscount,
stimulusitem, stimulusitem, stimulusitem, stimulusitem,stimulusitem,stimulusitem,stimulusitem
stimulusonset, stimulusonset, stimulusonset, stimulusonset, stimulusonset, stimulusonset, stimulusonset
correct, latency, response,values.x,values.y]
</data>

But when I run the code, the column spacebarpresscount is always empty. I've also tried /spacebarpresscount= 0 instead of /spacebarpresscount= "", unfortunately nothing changed..
Any suggestion?

Thank you so much!

Please provide code that is complete enough to actually run.

One problem you have here

<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.spacebarpresscount=""; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [trial.safe_3_backward_inc.insertstimulustime(sound.take, values.time_sound);
      trial.safe_3_backward_inc.insertstimulustime(picture.safe_minus_second_frame, values.time_second_frame);
      trial.safe_3_backward_inc.insertstimulustime(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulustimes = [1 = safe_first_frame]
/ inputdevice = keyboard
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ isvalidresponse = [if(trial.safe_3_backward_inc.response == -57){values.spacebarpresscount += 1;}]
/ monkeyresponse = (-57)
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>

is that there's actually no time in the trial during which it would poll for any response. By default, Inquisit only starts accepting responses once the trial has completed its entire stimulus presentation sequence, here: after/coinciding with the onset of picture.safe_minus_third_frame. That, however, is also the time where the trial actually ends. If you want to accept responses *while* the stimulus presentation sequence is still in progress, from the very start of the <trial> object, set /beginresponsetime = -1.

https://www.millisecond.com/support/docs/v6/html/language/attributes/beginresponsetime.htm

Then, depending on what you want to happen when a response is registered (here: release of the space bar), you may in addition have to change the trial's /responseinterrupt.

https://www.millisecond.com/support/docs/v6/html/language/attributes/responseinterrupt.htm

The default is immediate, i.e. the trial will not present the remaining stimuli once a response has been registered. If you want the trial to complete the stimulus presentation sequence instead, set /responseinterrupt = frames.

In sum, something like this:

<trial safe_3_backward_inc>
/ ontrialbegin = [values.Actiontype="Withdrawal"; values.spacebarpresscount=""; values.congruency = "Incongruent"; values.object = "safe"; values.length = 3]
/ ontrialbegin = [
    trial.safe_3_backward_inc.resetstimulusframes();
    trial.safe_3_backward_inc.insertstimulustime(sound.take, values.time_sound);
    trial.safe_3_backward_inc.insertstimulustime(picture.safe_minus_second_frame, values.time_second_frame);
    trial.safe_3_backward_inc.insertstimulustime(picture.safe_minus_third_frame, values.time_third_frame);]
/ stimulustimes = [1 = safe_first_frame]
/ inputdevice = keyboard
/ validresponse = (-57, 0)
/ correctresponse = (0)
/ beginresponsetime = -1
/ responseinterrupt = frames
/ showmousecursor = false
/ trialduration = values.time_third_frame
/ isvalidresponse = [if(trial.safe_3_backward_inc.response == -57){values.spacebarpresscount += 1;}]
/ monkeyresponse = (-57)
/ branch = [trial.safe_3_backward_inc_respond;]
</trial>


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search