Inquisit Language Reference
The ontrialbegin attribute specifies commands to be run at the beginning of a trial.
<expt> <surveypage> <trial>
|expression||One or more expressions, delimited by semi-colons. See help with expression syntax for more information.|
This parameter executes one or more specified expressions at the beginning of a trial. The expressions can read and conditionally update the various properties in the script. This is useful for dynamically configuring the trial and its stimuli based on the state of the script or the subject's performance.
The following trial updates feedback text based on whether the subject's last response was correct:
/ stimulusframes=[1=feedback, ratepicture]
/ ontrialbegin=[if (values.lastcorrect == true) text.feedback.item.1 = "Your last response was correct"]
The following trial shortens a response timeout by 5 millisecond increments with each iteration of the trial.
/ ontrialbegin=[trial.mytrial.timeout = 1000 - (block.myblock.currenttrialnumber * 5)"]
The following trial sets the volume of a sound stimulus to a randomly selected value.
/ ontrialbegin=[sound.hearingtest.volume = rand(-10000, 0)"]
The following trial updates a simple trial counter before it runs.
/ stimulusframes=[1,3,5,7,9 = littletrial; 2,4,6,8,10 = bigtrial)]
/ ontrialbegin=[values.testtrialcounter = values.testtrialcounter + 1]