User`s guide

E-Prime User’s Guide
Chapter 4: Using E-Basic
Page 150
The inheritance of the value to assign to an attribute follows the hierarchical structure, and values
may only be inherited by levels lower than the level at which the attribute is defined. Thus, if an
attribute is defined at the block level, it may be referenced at the trial or sub-trial level.
Inheritance occurs in a downward direction, while the search for a value occurs in an upward
direction. For example, if an attribute is defined at the block level and referenced at the trial level,
the value at the trial level will be inherited from the block level (i.e., downward). The resolution of
the value occurs by first searching the trial (i.e., current) level, then continuing the search at the
next highest level (e.g., block), and upward until the value is resolved.
4.5.3.3 Example 3: Getting Attributes from the Context
Object
The GetAttrib method is used to retrieve a value for an existing attribute in the context. Like
SetAttrib, the GetAttrib method is used in conjunction with the dot operator.
In the example below, the TextDisplay object displays a stimulus "X" or "Y.” In the script, the
clause is used to evaluate the current stimulus and set its display color. The
GetAttrib method will retrieve the value of the current stimulus. When GetAttrib returns a
value of "X" the ForeColor property of the TextDisplay will be set to "Green,” so that all X’s will be
displayed in the color green. When GetAttrib returns a value of "Y,” the ForeColor property is set
to "Blue" so that all Y’s will be displayed in the color blue.
'Retrieve value of "Stimulus" and set display color
If c.GetAttrib ("Stimulus") = "X" Then
TextDisplay.ForeColor = CColor("Green")
ElseIf c.GetAttrib ("Stimulus") = "Y" Then
TextDisplay.ForeColor = CColor("Blue")
End If
4.5.3.4 Example 4: Global Variables
Often, it is desirable or useful to determine the subject’s performance over the course of the
experiment, or perhaps after a specified number of blocks or trials. One method of assessing
performance is to use a FeedbackDisplay object, which can automatically calculate summary
statistics (e.g., mean accuracy, mean RT, etc.). Another method of assessing performance
involves the use of the Summation object. This method involves more involvement from the user,
but does not require the user to provide feedback. The example below uses a Summation object
to determine average accuracy after a specified number of trials.
To use a Summation object to determine the average accuracy per condition or block, the
Summation object must be declared in the Script window on the User tab. In most cases,
accuracy would only be examined after a minimum number of trials. Thus, in order to start
evaluating mean accuracy after a certain number of trials had been run, it would also be
necessary to declare a counter to manually count the number of trials that have occurred. In the
script below, the PracticeProp summation variable is declared for use in evaluation of the practice
trial performance. The TrialCount integer variable is declared in the User Script window as well, to
keep track of the running trial count.
'Declare Variables
Dim PracticeProp As Summation
Dim TrialCount As Integer