User`s guide

E-Prime User’s Guide
Chapter 4: Using E-Basic
Page 138
The total trial count variable is updated simply by increasing the previous value by one (i.e.,
g_nTotalTrial+1). The second line of script referring to the c.SetAttrib command is used
to place the value of g_nTotalTrial into an attribute for access by another object and to log the
value in the data file. Refer to the next step for information pertaining to setting values as
attributes.
4.4.4 Set or reference values in script
If variables are to be retrieved and/or logged, they must be placed into the experimental context
as attributes. Otherwise, they exist only temporarily, and are discarded at the conclusion of the
Procedure in which they are defined. Attributes defined in a List object are automatically placed
into the experimental context. For example, if a List object defines an attribute named "Stim,” and
the values of Stim are used to define the stimulus displayed during each trial, the value of Stim for
each trial will automatically be logged in the data file.
In order to enter a temporary variable (e.g., g_nTotalTrial from the previous step) into the
experimental context, either for the purpose of logging that value in the data file or for later
access by another object, use the c.SetAttrib command. In the previous step, the value of
the g_nTotalTrial variable was set as an attribute (i.e., c.SetAttrib "TrialCount,"
g_nTotalTrial). The TrialCount attribute may then be accessed by another object using
bracket notation, and the value of TrialCount will be logged in the data file.
The values of attributes and properties from the experimental context may be accessed via script
using the c.GetAttrib command. For example, the stimulus might display a random number
selected from a range of values depending on the condition. "Condition" could be entered as a
List attribute defining the possible conditions, and this value could be retrieved at runtime to set
the possible range of values for the random number selection.