The onScriptBegin attribute specifies commands to be run at the beginning of a script.
<batch>
Name | Type | Description |
---|---|---|
script | script |
The following code shows how to set a script parameter via the batch element. The parameter needs to be declared in the batch script as well as the task script. In this particular case, participants assigned to group1 run script 'twostepdecisiontask.iqjs' with 'payoff version1', whereas participants assigned to group2 run the same script with 'payoff version 2'.
<batch main1>
/ groups = (1 of 2)
/ onScriptBegin = {
parameters.version = 1;
}
/ file = "twostepdecisiontask.iqjs"
</batch>
<batch main2>
/ groups = (2 of 2)
/ onScriptBegin = {
parameters.payOffVersion = 2;
}
/ file = "twostepdecisiontask.iqjs"
</batch>