e primetips

6
E-Prime Programming Tips EGI Summer School 2004 Built In Help The main areas of assistance available from the Help menu within E-Studio are E-Studio Help, E-Basic Help, and PST Web Support. E-Studio help provides information on the use of the E- Studio Graphical User Environment(GUI). To access E-Studio Help, choose Help Topics from the Help Menu. The three tabs provide three different ways to access information. You can search the Contents, Index, or use the Find feature. The first time you use Find, you will need to build an index. This just takes a moment. If you need general information on a topic, the Contents or Index may be best. For specific information, the Find feature is the quickest. For example, suppose you need more information on how to load an image in the Image Display object. You might start by looking at the property pages of the ImageDisplayObject by bringing up the ImageDisplayObject in either the Contents or Index. Note E-Prime uses typical programming formatting of naming objects with no spaces between words and capitalizing the first letter of each word. In the Properties section , the Filename property mentions the file name can be loaded from a List object. Now you might either use the Contents to open the properties of a list object or use the Find and type in “Load” to jump directly to the LoadMethod property of the List Object. E-Basic Help will provide information needed when the built in GUI elements do not provide the needed functionality. For example, using the UserBreakState to pause an experiment requires use of E-Basic.

Upload: tranquang

Post on 03-Oct-2015

12 views

Category:

Documents


0 download

TRANSCRIPT

E-Prime Advanced Tips

E-Prime Programming TipsEGI Summer School 2004Built In Help

The main areas of assistance available from the Help menu within E-Studio are E-Studio Help, E-Basic Help, and PST Web Support.

E-Studio help provides information on the use of the E-Studio Graphical User Environment(GUI). To access E-Studio Help, choose Help Topics from the Help Menu. The three tabs provide three different ways to access information. You can search the Contents, Index, or use the Find feature. The first time you use Find, you will need to build an index. This just takes a moment. If you need general information on a topic, the Contents or Index may be best. For specific information, the Find feature is the quickest.For example, suppose you need more information on how to load an image in the Image Display object. You might start by looking at the property pages of the ImageDisplayObject by bringing up the ImageDisplayObject in either the Contents or Index. Note E-Prime uses typical programming formatting of naming objects with no spaces between words and capitalizing the first letter of each word. In the Properties section , the Filename property mentions the file name can be loaded from a List object. Now you might either use the Contents to open the properties of a list object or use the Find and type in Load to jump directly to the LoadMethod property of the List Object.

E-Basic Help will provide information needed when the built in GUI elements do not provide the needed functionality. For example, using the UserBreakState to pause an experiment requires use of E-Basic.

To access the E-Basic Help, choose E-Basic Help from the Help menu within E-Studio. Note the help topics window shown is a screen shot, not the actual Help Topic Window. To access the Help Topics, with the same three tabs as explained above, click on Help Topics in the upper left corner. Alternately, all E-Basic topics are listed below.For example, suppose you want to pause your experiment. You might go to the Find tabpanel and type in pause. One of the items listed in the topics section is GetUserBreakState, which we will discuss further below.

Example Experiments

The built in help may not provide all the details needed for implementation. The best way to get that type of information is to look at an actual experiment that implements the method you need more information on. E-Prime comes with several sample experiments in the Shared Documents->Shared Experiments->Samples folder. Also, there are several websites that maintain databases of experiments. A web search on E-Prime Experiments will bring up several sites including: http://step.psy.cmu.edu/scripts/PST Web Support

Another important source of information is the PST Web Support Site, also available from the Help menu within E-Studio. You will need to register for web support, this is a painless process and should just take a moment. Once inside the web support you will find buttons to access downloads, example experiments, the knowledge base, or ask your own question.

When the above tools do not provide the needed information and you need to ask a real person, EGI and PSTs support responsibilities are divided by whether the question is related to general E-Prime usage or is specific to the E-Prime Biological Add-ons for Net Station (EBANS, or Net Station package file). PST handles the former, EGI the latter. If you are unsure which to contact, you may contact either and you will be refered to the proper support department. Using the UserBreakState

The UserBreakState allows experimenters to pause an experiment. During an experiment the UserBreakState is triggered by pressing the shift and alt keys simultaneously(the pause keys). This key combination should not be confused with the abort key combination of control-shift-alt. The abort key combination should not be used to pause an experiment, returning to an experiment from the abort dialog box can leave the experiment in an unstable state.An experiment must contain in-line code to use the pause keys. The needed calls are GetUserBreakState and SetUserBreakState. The UserBreakState is a Boolean value set to -1 by pressing the keys. GetUserBreakState is used to determine the current value of the UserBreakState. SetUserBreakState is used to turn off the UserBreakState once it has been set to -1 by the keys.GetUserBreakState is usually called once per trial at the end of the trial. The experiment programmer will need to determine the proper time to call GetUserBreakState. The keys can be pressed anytime, the program will only take the action set in the inline code when GetUserBreakState is called. The code below can be added to an inline object at the end of the trial procedure:If GetUserBreakState = -1 Then

SetUserBreakState 0

While GetUserBreakState -1

Sleep(200)

WEnd

Sleep(200)

SetUserBreakState 0

End If

Pressing the pause keys causes the If statement to be evaluated as true. We then use SetUserBreakState to set UserBreakState to zero. The while loop will evaluate to true until the pause keys are pressed again. This is the typical usage of the pause keys, press them once to enter the breakstate, press them again to leave the break state. The sleep commands are used to avoid the possibility of triggering the user break state repeatedly. Note the above code does not contain any code to inform the experimenter that the program has paused. This can be added by adding the lines below directly after the If statement:

'Display a message and sleep so the user will see it

Display.Canvas.Clear

Display.Canvas.Text 250, 100, "Pausing until ctrl+shift"

Note the top line is a comment, indicated by the single open quote.

The UserBreakState can also be used to terminate a portion of an experiment early:'Terminate if user break

If (GetUserBreakState 0) Then 'Check for user break

TrialList.Terminate

End If

SetUserBreakState 0

'Reset user break to end

The Slide Object

When simultaneous presentation of multiple stimuli types is required, the slide object is the object of choice. The slide object can be thought of as a wrapper for a number of sub-objects. The sub-objects can be text display, image display or sound out. In addition, a slide object can have different States this allows for alteration of the sub-objects based on the current state. Lets take a look at the example SlideRT that comes with E-Prime. The Slide object is called Stimulus The Stimulus object contains the 5 sub-objects, 4 text display objects and an Image display. The Stimulus Object also contains 4 states, up, down, left, and right. The state denotes in which text display object the stimulus will appear. When inspecting the properties, you must fist select either the main object(Stimulus) or one of the sub-objects first, then click the properties icon. If we select Stimulus then click on the Properties icon, You will see the ActiveState selection box under the general tab. The ActiveState contains an attribute StateName. If you look in the TrialList, you will see the attribute StateName defined: up, down, left, right. These match the states defined in the Stimulus object. Thus, which of the four text boxes will be determined at run time, based on the StateName attribute in the TrialList. In the Stimulus Object, you can inspect the sub-objects for each state by clicking on the state tabs in the lower left corner. In the image below, you will see the properties for the Left state are displayed.