User`s guide
E-Prime User’s Guide
Chapter 4: Using E-Basic
Page 136
After placing an InLine object in the appropriate location, double click the InLine object to open it,
and enter the script required to accomplish the task. To select a random number (1-499), and to
place the selected value into a form useable by E-Prime, the following script would be entered:
The Random function is used to select a random value from 1-499, and the SetAttrib command is
used to place that value into an attribute for later access. Notice the single quote character used
to enter a comment in the script above. The single quote character is used to skip all characters
between the apostrophe and the end of the current line. Similarly, the Rem statement may be
used to enter comments. Refer to the Contents topic in the E-Basic Online Help for more
information.
4.4.3 Determine the scope of variables and attributes
Variables or attributes declared within an E-Prime experiment are limited to the scope of the
Procedure in which they are defined. Variables to be used only during a single trial may be
declared and initialized at the trial level. For example, a variable used as a counter may be
declared locally, as in the following example:
When InitializeArray is placed in the trial Procedure, both "i" and "arrValue" will be accessible
during the trial. At the end of the trial Procedure, the "i" and "arrValue" variables will be discarded
(e.g., the value of arrValue will not be accessible by an event at the block level).
If a variable is to be maintained or accessed across multiple executions of a Procedure (e.g.,
performance over a series of blocks), the variable must be declared globally. Global variables
are declared using the User tab in the Script window. For example, a variable might be declared
to keep track of the total number of trials. Use the View menu to display the Script window in E-
Studio, and select the User tab to declare a global variable.










