The onexptbegin attribute specifies commands to be run at the beginning of a expt.
Applies to
<expt>
Syntax
/ onexptbegin = [expression; expression; expression; ...]Parameters
| expression | One or more expressions, delimited by semi-colons. Click here for help with expression syntax. |
Remarks
This parameter executes one or more specified expressions at the beginning of a expt. The expressions can read and conditionally update the various properties in the script. This is useful for dynamically configuring the expt and its blocks and trials based on the value of the subject id, the computer/display settings, and other properties.
Examples
The following expt updates a text item based on whether the subject code is even or odd:
<expt myexpt>
/ blocks=[1-5=practice; 6-10=test)]
/ onexptbegin=[if (mod(script.subjectid, 2) == 0) text.welcome.item.1 = "You have been assigned to condition A";]
/ onexptbegin=[if mod(script.subjectid, 2) == 1 then text.welcome.item.1 = "You have been assigned to condition B; "]
</expt>