Mouse responses are collected with the mouse_response item. The mouse_response is primarily intended to collect individual mouse clicks. If you want to collect mouse-cursor trajectories, take a look at the mousetrap plugins:
The mouse_response sets the standard response variables as described here:
Mouse buttons have a number (
1, etc.) as well as a name (
left_button, etc.). Both can be used to specify correct and allowed responses, but the
response variable will be set to a number.
The Correct response field indicates which response is considered correct. After a correct response, the
correct variable is automatically set to 1; after an incorrect response or a timeout (i.e. everything else),
correct is set to 0; if no correct response is specified,
correct is set to 'undefined'.
You can indicate the correct response in three main ways:
- Leave the field empty. If you leave the Correct response field empty, OpenSesame will automatically check if a variable called
correct_responsehas been defined, and, if so, use this variable for the correct response.
- Enter a literal value. You can explicitly enter a response, such as 1. This is only useful if the correct response is fixed.
- Enter a variable name. You can enter a variable, such as '[cr]'. In this case, this variable will be used for the correct response.
The Allowed responses field indicates a list of allowed responses. All other responses will be ignored, except for 'Escape', which will pause the experiment. The allowed responses should be a semicolon-separated list of responses, such as '1;3' to allow the left and right mouse buttons. To accept all responses, leave the Allowed responses field empty.
The Timeout field indicates a timeout value in milliseconds, or 'infinite' for no timeout. When a timeout occurs, the following happens:
response_timeis set to the timeout value, or rather to the time it takes for a timeout to be registered, which may deviate slightly from the timeout value.
responseis set to 'None'. This means that you can specify 'None' for the correct response a timeout should occur; this can be useful, for example, in a go/no-go task, when the participant should withold a response on no-go trials.
Coordinates and regions of interest (ROIs)
cursor_y variables hold the location of the mouse click.
If you indicate a linked sketchpad, the variable
cursor_roi will hold a comma-separated list of names of elements that contain the clicked coordinate. In other words, elements on the sketchpad automatically serve as regions of interest for the mouse click.
Collecting mouse responses in Python
You can use the
mouse object to collect mouse responses in Python: