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


Author
Message
eleonora_parr
eleonora_parr
Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)Partner Member (570 reputation)
Group: Forum Members
Posts: 40, Visits: 148
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
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
eleonora_parr - 4 Years Ago
Dave - 4 Years Ago
eleonora_parr - 4 Years Ago
                 / pretrialsignal = (keyboard, 57)...
Dave - 4 Years Ago
eleonora_parr - 4 Years Ago
                         No, two input devices in a single <trial> are not possible....
Dave - 4 Years Ago
                             Oh, sorry, I probably did not express myself well. They have to keep...
eleonora_parr - 4 Years Ago
                                 Hi Dave, Sorry to bother again, but I am having problems in recording...
eleonora_parr - 4 Years Ago
                                     Please provide code that is complete enough to actually run.
Dave - 4 Years Ago
                                         One problem you have here <trial safe_3_backward_inc> /...
Dave - 4 Years Ago
                                             Hi Dave, So, with this solution the spacebar release recording is...
eleonora_parr - 4 Years Ago
                                                 Try /responseinterrupt = trial then and/or setting the <sound>...
Dave - 4 Years Ago
                                                     And again, please, in the future provide code that will actually run....
Dave - 4 Years Ago
                                                         It works perfectly now! You're awesome!!Thank you!! And, yes sorry I...
eleonora_parr - 4 Years Ago
                                             Hi Dave, I just noticed that with the option "resetsframes" the...
eleonora_parr - 4 Years Ago
                                                 You randomize the trial timings, by picking a random onset time for...
Dave - 4 Years Ago
                                                     Thank you very much Dave! It is clear now! Eleonora
eleonora_parr - 4 Years Ago

Reading This Topic

Explore
Messages
Mentions
Search