up Inquisit Language Reference

ontrialbegin attribute

The ontrialbegin attribute specifies commands to be run at the beginning of a trial.

Member of

<expt> <surveypage> <trial>

Syntax

/ ontrialbegin = [expression; expression; expression; ...]

Parameters

expression One or more expressions, delimited by semi-colons. See help with expression syntax for more information.

Remarks

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.

Examples

The following trial updates feedback text based on whether the subject's last response was correct:

<trial mytrial>
/ stimulusframes=[1=feedback, ratepicture]
/ ontrialbegin=[if (values.lastcorrect == true) text.feedback.item.1 = "Your last response was correct"]
</trial>

The following trial shortens a response timeout by 5 millisecond increments with each iteration of the trial.

<trial mytrial>
/ stimulusframes=[1=testmessage]
/ ontrialbegin=[trial.mytrial.timeout = 1000 - (block.myblock.currenttrialnumber * 5)"]
</trial>

The following trial sets the volume of a sound stimulus to a randomly selected value.

<trial mytrial>
/ stimulusframes=[1=hearingtest]
/ ontrialbegin=[sound.hearingtest.volume = rand(-10000, 0)"]
</trial>

The following trial updates a simple trial counter before it runs.

<trial mytrial>
/ stimulusframes=[1,3,5,7,9 = littletrial; 2,4,6,8,10 = bigtrial)]
/ ontrialbegin=[values.testtrialcounter = values.testtrialcounter + 1]
</trial>

Send comments on this topic:
Copyright Millisecond Software, LLC. All rights reserved.