Experiment

Experiment

Script in Procedures

Script in Procedures

r

Do logic specific to blocks and trialsGet values of list attributesSet up canvasesDraw canvasesDo stuff with participant’s responses (play correct/incorrect sound, change color of fixation cross depending on correctness)Keep track of participant scores

Block specific

Get values of list attributes

Set up Canvasses

Draw Canvasses

Keep track of participant scores

Give feedback to respnses (visual/auditory)

Trial specific

Get values of list attributes

Set up Canvasses

Draw Canvasses

Keep track of participant scores

Give feedback to respnses (visual/auditory)

randomize

r

you can randomize things by dirctly putting it into the code variable = random (min rand no, max rand no) or you can put it in a list and work with c.getAttrib, the plus side when doing this is that it is recorded and you know when what is presented in which trial. Randomisation can be done by putting the list in the ramdom mode. Downside is that it may create a lot of extra trials because every position has to be presented before end of the trial.

User Script

r

Eprime allows you to declare, but not initialize (assign values to) variables in the User script. This has to be done in the Init script. Constants however have to be initialized immediately.

Constants

r

Constants can only be assigned a value once, which cannot be changed afterwardsConstants are always defined at the beginning of the programConvention: constant names are specified in uppercase const NO_OF_PERSONS as integer = 5Note: value is assigned directly at declaration, not afterwards as is the case with variables.

Type declarations

r

Type declaration: Type Person name as String age as integer gender as String End TypeNow you can declare this type like any other variable and access its contents through the “dot notation” Dim member as Person member.name = “John” member.age = 25 member.gender = “male”

Global Variables (incl. arrays etc.)

r

Variables in E-basic:Declared with the keyword Dim (dimension)Variable name must start with a letter but may contain other alphanumeric characters. If it consists of more words Use CamelCase: thisIsAVeryLongNamedVariable Use underscores: this_is_another_long_named_variableHave to be assigned a datatypeExample: Dim age as integerage can now be referred to and integer values can be assigned to it:age = 28 (age + age will return 56)Other datatypes:Integer Any number between –32,768 and 32,767Long Any number between –2,147,483,648 and 2,147,483,647Double Any real number between: Negative –1.797693134862315E308 <= double <= –4.94066E-324 Positive 4.94066E-324 <= double <= 1.797693134862315E308String a string of characters contained within “”For example: “boat” or “experiment”Boolean True or false (e.g. isRaining = true)Currency, Date, Variant, etc.

Functions

r

A function is like a subroutine, but returns a single value of a type you specify

Set up Canvasses

Subroutines

r

Some segments of code might need to be executed at various locations in the program --> make a subroutineA subroutine is a collection of code which can be called at any location in the program.Subroutines should be defined in the beginning of the program (after constants and global variables)

Set up Canvasses

Init

r

Initialize necessary global variables you have declared in the User scriptMainly for setting up variables or doing logic that remains the same for the rest of the program (e.g. search element positions)

Initialize global variables

Set up variables

Logic that remains the same for the rest of the program

Set canvasses that are dim-med in User Script