up Inquisit Language Reference

ontrialend attribute

The ontrialend attribute specifies commands to be run at the end of a trial.

Member of

<expt> <surveypage> <trial>

Syntax

/ ontrialend = [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 after a trial is complete. The expressions can read and conditionally update the various properties in the script. This is useful for dynamically configuring the experiment based on, for example, the subject's performance on that trial.

Examples

The following trial lengthens the timeout based on the subject's response time:

<trial mytrial>
/ stimulusframes=[1=teststim]
/ ontrialend=[if (trial.mytrial.beginresponsetime > values.timeout) values.timeout = values.timeout + 100]
</trial>

The following trial updates a score based on the participants response:

<trial mytrial>
/ stimulusframes=[1=teststim]
/ ontrialend=[if (trial.mytrial.response == "1") values.totalpoints = values.totalpoints + 10]
</trial>

The following trial sets the volume of a sound stimulus progressively louder up to a max of -10000 if the participant responds incorrectly.

<trial mytrial>
/ stimulusframes=[1=teststim]
/ ontrialend=[if (trial.mytrial.correct == false) sound.feedback.volume = max(-10000, sound.feedback.volume - 100)]
</trial>

The following trial tracks the subject's fastest score using a custom value.

<trial mytrial>
/ stimulusframes=[1=teststim]
/ ontrialend=[values.fastest = min(values.fastest, trial.mytrial.latency)]
</trial>

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