User`s guide

E-Prime User’s Guide
Chapter 4: Using E-Basic
Page 123
CC
CC
hh
hh
aa
aa
pp
pp
tt
tt
ee
ee
rr
rr
44
44
::
::
UU
UU
ss
ss
ii
ii
nn
nn
gg
gg
EE
EE
--
--
BB
BB
aa
aa
ss
ss
ii
ii
cc
cc
4.1 Why Use E-Basic?
Although E-Studio is a robust application, E-Basic is the underlying scripting language.
Specifically, the graphical design created in E-Studio is translated to E-Basic script when the
experiment is compiled or generated. While E-Studio is filled with interesting and clever
functionality, chances are that it can be improved to satisfy the end user's specific or custom
needs. That is where E-Basic is useful. If the design of E-Studio is too constricting, E-Basic
affords the ability to accommodate the needs of individual users.
E-Studio provides the foundation for experiments in E-Prime. It is recommended that all users,
regardless of their programming expertise, take full advantage of the graphical design interface in
E-Studio rather than writing straight E-Basic scripts. E-Studio's graphical interface can do most, if
not all, of the work. Many users will not even need to use E-Basic.
The majority of all experiments can be done using E-Studio's graphical design interface. The
basic structure of almost all experiments includes blocks of trials within a session. It is more
efficient to use the E-Studio design interface to set this up. It's more effective to drag and drop
icons onto procedural timelines than it is to write the equivalent script.
E-Basic is the underlying scripting language of E-Prime, and the power of the E-Prime system.
Where E-Studio leaves off, E-Basic may be used to extend the system. This is similar to the use
of Visual Basic for Applications™ within the Microsoft Office™ suite of applications. On its own,
E-Basic is not particularly useful. However when used in conjunction with E-Studio and E-Run,
power and flexibility abound.
E-Basic really excels when used to extend the functionality of E-Studio. For example, the ability
to exit a set of practice trials based on a percentage correct criterion is something that not all
users are interested in, and for which there is no graphical option. The function can be
accomplished through a few lines of E-Basic script strategically placed in an InLine object or two.
The example, which follows, illustrates most of the script necessary to set up a criterion-based
exit:
'Terminate Practice Trials if greater than 80% accuracy
If PracticeProp.Mean < .80 Then
PracticeResults.Text = "Your accuracy for the practice"&_
"trials was " & CStr(PracticeProp.Mean)*100 &
"%.\n\nYou must achieve 80% accuracy in order to"&_
"continue with the experimental trials.\n\n Press"&_
" the spacebar to repeat the practice trials."
Else
PracBlockList.Terminate
PracticeResults.Text = "Your accuracy for the practice"&_
"trials was " & CStr(PracticeProp.Mean)*100 & "%."&_
"\n\n Press the spacebar to continue"
End If
Upon reading this code carefully, it is not difficult to guess what it is supposed to do. One of the
nicest features of E-Basic is that the language is similar to ordinary English. If the example looks
like a foreign language, rest assured, this chapter has a section devoted to the beginner user in