up Inquisit Language Reference

onTrialEnd attribute

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

Member of

<block> <expt> <likert> <openended> <sliderTrial> <survey> <surveyPage> <trial>

Syntax

/ onTrialEnd = { script }

Parameters

Name Type Description
script script

Remarks

This attribute executes commands after a trial is complete, for example conditionally updating 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 (Note: 'this' represents 'trial.myTrial' in this context):

<trial myTrial>
/ stimulusTimes=[0=teststim]
/ onTrialEnd={
  if (this.beginResponseTime > values.timeout) values.timeout += 100;
}
</trial>

The following trial updates a score based on the participants response (Note: 'this' represents 'trial.myTrial' in this context):

<trial myTrial>
/ stimulusTimes=[0=teststim]
/ onTrialEnd={
  if (this.response == "1") 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. (Note: 'this' represents 'trial.myTrial' in this context)

<trial myTrial>
/ stimulusTimes=[0=teststim]
/ onTrialEnd={
  if (this.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 (Note: 'this' represents 'trial.myTrial' in this context).

<trial myTrial>
/ stimulusTimes=[0=teststim]
/ onTrialEnd={
  values.fastest = Math.min(values.fastest, this.latency);
}
</trial>

Copyright Millisecond Software, LLC. All rights reserved.