The Task Events feature in E-Prime expands E-Prime's synchronization capabilities by offering a wide variety of options to take action when specific time critical events occur during an experiment. Task Events can be thought of in terms of “cause and effect,” where the cause is the Event (e.g., incorrect response, click of a button, onset time of an object, etc.) that triggers the effect, or the Task (e.g., run a series of script commands, send a signal to the serial port, etc.). For example, your experiment may require that a signal be sent to a port to indicate the time when the stimulus is displayed. In this example, the display of the stimulus is the Event/cause that triggers the signal to be sent (i.e., Task/effect).
Task Events are configured on the object to which they are related, which is determined by the needs of the experiment. For example, if the user would like to send a signal from E-Prime to an external device at the time the stimulus is displayed, the Task Event should be configured on the object presenting the stimulus. If the desired Event is related to the participant's response, the Task Event should be configured on the object that enables the Input Mask (i.e., collects the input).
IMPORTANT: If PreRelease is in use, it may be necessary to specify the Task Event on the next occurring object in the Procedure. For example, if the desire is to set a task event on the FinishTime of an object, but PreRelease is set to “(same as duration)” (i.e., default setting), FinishTime is not the actual end time of the object. It may be necessary to specify the StartTime or OnsetTime of the next occurring object as the Event. It is important to consider the timing properties of the object when defining task events.
Task events typically occur during time-critical portions of an experiment. For this reason, the actions that may be defined are restricted. The following actions are prohibited within the action associated with a task event:
- Operations affecting the display (e.g., Canvas object commands)
- Sleep command
- Commands invoking another task event to start
In addition, if the task event specified requires a significant amount of time (e.g., extensive script segments), timing within the experiment may be affected. While a task event is processing, other events (including processing of input masks, painting of echo clients, termination of audio or movie playback, etc.) are blocked until the task event concludes. Therefore, events can be delayed, or potentially missed completely. For example, if a key is pressed during execution of a task event, echo of that input to the screen will be delayed until the task event terminates. To maintain accurate timing, task events should be brief, involving only essential actions, before returning to experiment execution. If extensive script is required in association with a task event, it is suggested that a Boolean value be set within the task event to trigger non-essential script at a later/non-critical time in the experiment outside of the task event, itself.
During experiment design, warnings of suspected timing errors will be reported by the Experiment Advisor within E-Studio’s Output window (refer to E-STUDIO: Experiment Advisor  for additional information). Additionally, refer to the Experiment Advisor report for errors generated in the user interface or at runtime. Errors will be generated in the case of each of the following:
- The specified script routine cannot be found or run
- Another task event is triggered
- Calls to Canvas.Copy (i.e., affects display)
- RteRunnableObject.Run is called
- Calls to StimDisplay.Draw (i.e., affects display)
- Calls to SlideVisualStim.Draw (i.e., affects display)
- Task Action routine or Parameter does not meet requirements
NOTE: The primary use of Task Events is to communicate with external devices through the passing of information from E-Prime to that external device. Task Events may also be used to process a signal sent from an external device to E-Prime when associated with one or more Task Events. Communicating with external equipment is accomplished through devices and input masks, which are then controlled using Task Events.
For further information on Task Events, refer to the following: