Save Mouse Position
Save Mouse Position

Required Experiment Builder Version: 1.4 or higher
EyeLink Required: Yes
Type: Concept Example
Difficulty Level: Easy

This example demonstrates:
  • How to create a mouse contingent Image Resource to act as a mouse cursor
  • How to use Mouse click to end a trial
  • How to save the mouse position in the edf file to view the trace in Data Viewer and output a report with mouse position over time

This demo shows how to write a TARGET_POS and FIXPOINT messages to the edf file whenever the task detects a change in mouse position. At the analysis stage, Data Viewer reads the TARGET_POS message and creates a target position which you can see in Data Viewer's 2D Temporal Graph view (click on the icons marked in red in the attached image) and output via a Sample Report (Analysis > Reports > Sample Report) as TARGET_X and TARGET_Y variables. Data Viewer will also read the FIXPOINT message and draw a circular target in Data Viewer's Trial Playback Animation view. For more information on how these messages are formatted please take a look at the Data Viewer manual: open Data Viewer, click on Help > Contents (from the top menu bar) and navigate to the section "Protocol for EyeLink Data to Viewer Integration -> Target Position" and "Protocol for EyeLink Data to Viewer Integration -> Simple Drawing Commands". Note that the FIXPOINT message is optional as this simply draws a target in the Trial Playback Animation view but if you want to output a report containing the x y coordinates you need the TARGET_POS message. For more general Data Viewer information please take a look at our video tutorial series for Data Viewer here:

The demo works similarly to the Pursuit example (Open Expeirment Builder, click on File -> Examples -> Pursuit), which is described in the Expeirment Builder manual (Help > Contents > Examples > Pursuit). In the demo attached here, the CHECK_MOUSEPOSITION_CHANGED node checks whether a mouse position change has occurred by comparing the current mouse x and y position to the previous x y position. If so, the REPORT_NEW_MOUSE_POSITION writes the !V TARGET_POS message via its "Message" field and also updates the lastMouseX and lastMouseY variables with the most recent mouse position. Then the DRAW_TARGET_DV node writes the !V FIXPOINT message.

  1. Download the mouse_dv.ebz example from this message.
  2. Launch the Experiment Builder application.
  3. Unpack the mouse_dv.ebz file to a location on your Experiment Builder PC with "File menu -> Unpack".
  4. Open the project in Experiment Builder.
  5. Deploy the project to a new folder.
  6. Run the mouse_dv.exe from the deployed directory.


.ebz   mouse_dv.ebz (Size: 21.61 KB / Downloads: 4)