Debugging in E-Prime
Errors may occur during both the generation and the running of an experiment. This article describes how to access the debugging messages in both situations.
Generation Errors Within E-Studio
When an experiment is generated within E-Studio, the Output window provides feedback concerning the status of the generation procedure. The Output window may be displayed using the View menu in E-Studio. Within the Output window, the Generate tab displays information concerning the generation process of the program. For example, if an experiment is generated without errors, the Generate tab in the Output window will display messages indicating that the script was generated successfully.
When any errors are produced as a result of generating script within E-Studio, the errors will be reported by a dialog box.
The errors will also be sent to the Debug tab in the Output window. After dismissing the error dialog, the errors may be re-displayed by opening the Output window (View menu) and clicking the Debug tab.
Each error will display the line number in the script at which the error occurred, and the Script window will open automatically in E-Studio to display the full experiment script. Within the Script window, the cursor will blink at the line at which the error was encountered.
When errors occur during the running of an experiment (i.e., runtime error), a dialog will be displayed indicating the runtime error, and the line in the script at which the error occurred. As with generation errors, runtime error messages are sent to the Output window, and the Full Script is opened in E-Studio and the error location highlighted.
Tips to Help Make Debugging Easier
- Run in fixed order to verify proper stimulus selection before adding randomization.
- Think small -- test small portions of the program for functionality before expanding the program.
- Use Debug.Print to send information to the Output window during runtime. This information may be evaluated after the run terminates in order to verify values.
- Use Display.Canvas.Text in an Inline object in conjunction with a Sleep command to display debugging information to the screen at runtime without requiring input from the user to continue.
- Use the Display.MsgBox command (INFO: Display.MsgBox usage in E-Prime 3.0 ) to display values during the run of an experiment. The MsgBox will not allow the program to continue until the user presses enter to dismiss the dialog box.
- Assign values as attributes so that they may be displayed on a TextDisplay or Slide object during the run of an experiment, or logged to the data file for later examination.