Create an InLine Object and Enter the Script
Once the appropriate placement of the script has been determined, create an InLine object at that location. If the script is to determine a random number during the trial Procedure (TrialProc) prior to the stimulus display, the most appropriate location for the InLine object containing this script is as the first event in the TrialProc.
Actually, any time prior to the event displaying the stimulus would be appropriate, but it is good practice to separate the setup events from the critical events of the trial (e.g., Fixation-Stimulus-Feedback). It is also good programming practice to apply useful names to the user-created InLine objects. In this example, the default name of InLine1 has been changed to the more meaningful GetRndNum.
After placing an InLine object in the appropriate location, double click the InLine object to open it, and enter the script required to accomplish the task. To select a random number (1-499), and to place the selected value into a form usable by E-Prime 3.0, enter the following script.
The Random function is used to select a random value from 1-499, and the SetAttrib command is used to place that value into an attribute for later access. Notice the single quote character used to enter a comment in the script above. The single quote character is used to skip all characters between the apostrophe and the end of the current line. An alternative method to create comments is with the Rem statement (for “remark”). Refer to the Comments topic on the Contents tab (listed under E-Prime Command Reference) for more information.