up Inquisit Language Reference

onBlockBegin attribute

The onBlockBegin attribute specifies commands to be run at the beginning of a block.

Member of

<block> <survey> <expt>

Syntax

/ onBlockBegin = { script }

Parameters

Name Type Description
script script

Remarks

This parameter executes one or more specified expressions at the beginning of a block. The expressions can read and conditionally update the various properties in the script. This is useful for dynamically configuring the block and its trials based on the state of the script or the subject's performance.

Examples

The following block lengthens the timeout based on the subject's mean response time on the last block:

<block myBlock>
/ trials=[1-5=practicetrial; 6-10=testtrial)]
/ onBlockBegin={
  if (values.lastblockreponseTimes > 1000) trial.testtrial.timeout = 950;
}
</block>

The following block sets the content of a text stimulus based on the percent of correct responses on previous blocks.

<block myBlock>
/ trials=[1-10=noreplace(lefttrial, righttrial)]
/ onBlockBegin={
  if (block.practice.percentCorrect > 80) text.status.setItem("nice job!",0);
}
</block>

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

<block myBlock>
/ trials=[1-12=noreplace(testtrial, testtrial, distractortrial)]
/ onBlockBegin={
  sound.testsound.volume = rand(-10000, 0)";
}
</block>

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

<block myBlock>
/ trials=[1,3,5,7,9 = littletrial; 2,4,6,8,10 = bigtrial)]
/ onBlockBegin={
  values.testblockcounter ++;
}
</block>

Copyright Millisecond Software, LLC. All rights reserved.