Repeatedly Presenting Stimulus Items Until a Correct Response is Given

A common requirement for learning tasks is to require that subjects correctly respond to every stimulus in a set before advancing to the next phase of the experiment. Such a procedure might randomly select items from the stimulus set to be presented, and participants are instructed to classify the stimulus item according to some set of choices. If the item is correctly classified, it is removed from the selection pool. If the participant makes an error, the item is replaced into the selection pool so that it may be selected and presented on a future trial. Once the subject correctly classifies each stimulus, their learning task is complete.

Implementing such a task in Inquisit is surprisingly simple with the addition of two features, 1) the noreplacecorrect option for controlling random seletion, and 2) the selectedcount variable for tracking the number of selected items in a stimulus set.

For the sake of example, our task will require that a set of words be correctly classified as pleasant or unpleasant. The first step in creating our learning task is to define the stimulus set. Our pleasant and unpleasant text stimuli are defined below.

```<text pleasant>
/ items = pleasant
/ select = noreplacecorrect
</text>
```
```<text unpleasant>
/ items = unpleasant
/ select = noreplacecorrect
</text>
```
```<item pleasant>
/ 1 = "        HONOR        "
/ 2 = "        LUCKY        "
/ 3 = "       DIAMOND       "
/ 4 = "        LOYAL        "
/ 5 = "       FREEDOM       "
/ 6 = "       RAINBOW       "
/ 7 = "         LOVE        "
/ 8 = "        HONEST       "
/ 9 = "        PEACE        "
/10 = "        HEAVEN       "
</item>
```
```<item unpleasant>
/ 1 = "         EVIL        "
/ 2 = "        CANCER       "
/ 3 = "       SICKNESS      "
/ 4 = "       DISASTER      "
/ 5 = "       POVERTY       "
/ 6 = "        VOMIT        "
/ 7 = "         BOMB        "
/ 8 = "        ROTTEN       "
/ 9 = "        ABUSE        "
/10 = "        MURDER       "
</item>
```

Note that the selection option is set to noreplacecorrect. This option instructs inquisit to randomly select stimulus items without replacing them if a correct response is given. If an incorrect response is given, the item is replaced.

The next step is to define the trials that present the pleasant or unpleasant stimuli and record the participants' classifications.

```<trial pleasant>
/ stimulusframes = [1=pleasant]
/ validresponse = ("a", "5")
/ correctresponse = ("5")
/ branch = (text.pleasant.selectedcount, EQ, 0, unpleasant)
/ branch = (text.unpleasant.selectedcount, EQ, 0, pleasant)
</trial>

<trial unpleasant>
/ stimulusframes = [1=unpleasant]
/ validresponse = ("a", "5")
/ correctresponse = ("a")
/ branch = (text.unpleasant.selectedcount, EQ, 0, pleasant)
</trial>
```

The first trial presents pleasant stimuli and defines the "5" key as the correct response. The second trial presents the unpleasant stimuli and defines the "a" key as the correct response. In either case, if

Finally, we'll define a block that keeps running these trials until runs until

The batch element must be defined in its own seperate file. To run the batch element, simply open the script containing the batch element definition in Inquisit and run it as you would run any other script.

This is a very simple approach, but it is also somewhat limited. The batch provides no way to launch other programs besides Inquisit, and it does not allow you to counterbalance the order in which the scripts are run. For that, we can rely on Windows batch files.