Millisecond Forums

Learning to criterion

https://forums.millisecond.com/Topic36554.aspx

By raven - 9/24/2024

Hi Dave,

I'm adapting a task I've already created to include the ability to drop any stimuli that have been learnt to a specific criterion.
What is the best way to go about this? After looking on the forums and language reference, I can't seem to find any reference to criterion elements.

Thanks in advance!
By Dave - 9/24/2024

raven - 9/24/2024
Hi Dave,

I'm adapting a task I've already created to include the ability to drop any stimuli that have been learnt to a specific criterion.
What is the best way to go about this? After looking on the forums and language reference, I can't seem to find any reference to criterion elements.

Thanks in advance!

Based on your description I have no idea what you want to do. I'm also unclear what you mean by "criterion elements" -- there is no such thing.

Provide a detailed explanation of what you aim to do, along with relevant example code.
By raven - 10/19/2024

Hi Dave,

Basically, if participants press the correct key to criterion (60% accuracy) at the end of one block, I want to start a different block where the first stimulus that has been learned to criterion is no longer there, but the stimuli remain, until they are also learned to criterion.

The issues I can't seem to resolve, and am hoping you can help with, are as follows:

1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

3. Is there a better way to achieve what I'm trying to do? For example, is there a criterion function in Inquisit?

Below is the code that I have been working with.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.start_block]
</expt>

<block start_block>
/ trials=[1-5=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.percentCorrect >= 60) block.branch_block_a]
/ branch=[if (trial.b_trial.percentCorrect >= 60) block.branch_block_b]
</block>

<trial a_trial>
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_a>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_a>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_a>
/ items = ("***** This is the Branch Block A *****
~n
Stimulus A has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = red
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_b>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_b>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_b>
/ items = ("***** This is the Branch Block B *****
~n
Stimulus B has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = green
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


Thank you!


By Dave - 10/20/2024

raven - 10/20/2024
Hi Dave,

Basically, if participants press the correct key to criterion (60% accuracy) at the end of one block, I want to start a different block where the first stimulus that has been learned to criterion is no longer there, but the stimuli remain, until they are also learned to criterion.

The issues I can't seem to resolve, and am hoping you can help with, are as follows:

1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

3. Is there a better way to achieve what I'm trying to do? For example, is there a criterion function in Inquisit?

Below is the code that I have been working with.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.start_block]
</expt>

<block start_block>
/ trials=[1-5=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.percentCorrect >= 60) block.branch_block_a]
/ branch=[if (trial.b_trial.percentCorrect >= 60) block.branch_block_b]
</block>

<trial a_trial>
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_a>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_a>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_a>
/ items = ("***** This is the Branch Block A *****
~n
Stimulus A has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = red
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_b>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_b>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_b>
/ items = ("***** This is the Branch Block B *****
~n
Stimulus B has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = green
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


Thank you!



> 1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

There is no such thing as <%num_a_correct%> or <%num_b_correct%>.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


It's <%values.num_a_correct%> and <%values.num_b_correct%> respectively.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


> 2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

Use /skip attributes.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.learning_block]
</expt>

<values>
/ a_learned = false
/ b_learned = false
</values>

<page blocksummary>
^Number of A trials in this block: <%trial.a_trial.trialcount%>
^Percent correct of A trials in this block: <%trial.a_trial.percentcorrect%>
^A learned: <%values.a_learned%>

^Number of B trials in this block: <%trial.b_trial.trialcount%>
^Percent correct of B trials in this block: <%trial.b_trial.percentcorrect%>
^B learned: <%values.b_learned%>
</page>


<block learning_block>
/ postinstructions = (page.blocksummary)
/ onblockend = [
    if (values.num_a_correct >= 60) {
        values.a_learned = true;
    };
    if (values.num_b_correct >= 60) {
        values.b_learned = true;
    }
]
/ trials=[1-20=noreplace(trial.a_trial, trial.b_trial)]
/ branch = [
    if (!values.a_learned || !values.b_learned) { // if either hasn't been learned, run another learning block
        return block.learning_block;
    }
]
</block>

<trial a_trial>
/ skip = [
    values.a_learned;
]
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ skip = [
    values.b_learned;
]

/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
    values.num_a_correct values.num_b_correct trial.a_trial.percentcorrect trial.b_trial.percentcorrect
    values.a_learned, values.b_learned)
</data>


By raven - 10/20/2024

Dave - 10/20/2024
raven - 10/20/2024
Hi Dave,

Basically, if participants press the correct key to criterion (60% accuracy) at the end of one block, I want to start a different block where the first stimulus that has been learned to criterion is no longer there, but the stimuli remain, until they are also learned to criterion.

The issues I can't seem to resolve, and am hoping you can help with, are as follows:

1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

3. Is there a better way to achieve what I'm trying to do? For example, is there a criterion function in Inquisit?

Below is the code that I have been working with.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.start_block]
</expt>

<block start_block>
/ trials=[1-5=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.percentCorrect >= 60) block.branch_block_a]
/ branch=[if (trial.b_trial.percentCorrect >= 60) block.branch_block_b]
</block>

<trial a_trial>
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_a>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_a>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_a>
/ items = ("***** This is the Branch Block A *****
~n
Stimulus A has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = red
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_b>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_b>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_b>
/ items = ("***** This is the Branch Block B *****
~n
Stimulus B has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = green
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


Thank you!



> 1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

There is no such thing as <%num_a_correct%> or <%num_b_correct%>.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


It's <%values.num_a_correct%> and <%values.num_b_correct%> respectively.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


> 2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

Use /skip attributes.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.learning_block]
</expt>

<values>
/ a_learned = false
/ b_learned = false
</values>

<page blocksummary>
^Number of A trials in this block: <%trial.a_trial.trialcount%>
^Percent correct of A trials in this block: <%trial.a_trial.percentcorrect%>
^A learned: <%values.a_learned%>

^Number of B trials in this block: <%trial.b_trial.trialcount%>
^Percent correct of B trials in this block: <%trial.b_trial.percentcorrect%>
^B learned: <%values.b_learned%>
</page>


<block learning_block>
/ postinstructions = (page.blocksummary)
/ onblockend = [
    if (values.num_a_correct >= 60) {
        values.a_learned = true;
    };
    if (values.num_b_correct >= 60) {
        values.b_learned = true;
    }
]
/ trials=[1-20=noreplace(trial.a_trial, trial.b_trial)]
/ branch = [
    if (!values.a_learned || !values.b_learned) { // if either hasn't been learned, run another learning block
        return block.learning_block;
    }
]
</block>

<trial a_trial>
/ skip = [
    values.a_learned;
]
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ skip = [
    values.b_learned;
]

/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
    values.num_a_correct values.num_b_correct trial.a_trial.percentcorrect trial.b_trial.percentcorrect
    values.a_learned, values.b_learned)
</data>



Hi Dave,
Thanks for the help, much appreciated.
There seems to be an issue that when Stimulus B is learned to criterion, but not A, it goes to the Stimulus A branch block, not B.
Is there something wrong with the logic of the code here or is it something else:
<block start_block>
/ trials=[1-10=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.correctCount >= 5) block.branch_block_a]
/ branch=[if (trial.b_trial.correctCount >= 5) block.branch_block_b]
</block>


Thanks!

By raven - 10/20/2024

raven - 10/21/2024
Dave - 10/20/2024
raven - 10/20/2024
Hi Dave,

Basically, if participants press the correct key to criterion (60% accuracy) at the end of one block, I want to start a different block where the first stimulus that has been learned to criterion is no longer there, but the stimuli remain, until they are also learned to criterion.

The issues I can't seem to resolve, and am hoping you can help with, are as follows:

1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

3. Is there a better way to achieve what I'm trying to do? For example, is there a criterion function in Inquisit?

Below is the code that I have been working with.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.start_block]
</expt>

<block start_block>
/ trials=[1-5=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.percentCorrect >= 60) block.branch_block_a]
/ branch=[if (trial.b_trial.percentCorrect >= 60) block.branch_block_b]
</block>

<trial a_trial>
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_a>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_a>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_a>
/ items = ("***** This is the Branch Block A *****
~n
Stimulus A has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = red
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_b>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_b>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_b>
/ items = ("***** This is the Branch Block B *****
~n
Stimulus B has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = green
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


Thank you!



> 1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

There is no such thing as <%num_a_correct%> or <%num_b_correct%>.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


It's <%values.num_a_correct%> and <%values.num_b_correct%> respectively.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


> 2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

Use /skip attributes.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.learning_block]
</expt>

<values>
/ a_learned = false
/ b_learned = false
</values>

<page blocksummary>
^Number of A trials in this block: <%trial.a_trial.trialcount%>
^Percent correct of A trials in this block: <%trial.a_trial.percentcorrect%>
^A learned: <%values.a_learned%>

^Number of B trials in this block: <%trial.b_trial.trialcount%>
^Percent correct of B trials in this block: <%trial.b_trial.percentcorrect%>
^B learned: <%values.b_learned%>
</page>


<block learning_block>
/ postinstructions = (page.blocksummary)
/ onblockend = [
    if (values.num_a_correct >= 60) {
        values.a_learned = true;
    };
    if (values.num_b_correct >= 60) {
        values.b_learned = true;
    }
]
/ trials=[1-20=noreplace(trial.a_trial, trial.b_trial)]
/ branch = [
    if (!values.a_learned || !values.b_learned) { // if either hasn't been learned, run another learning block
        return block.learning_block;
    }
]
</block>

<trial a_trial>
/ skip = [
    values.a_learned;
]
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ skip = [
    values.b_learned;
]

/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
    values.num_a_correct values.num_b_correct trial.a_trial.percentcorrect trial.b_trial.percentcorrect
    values.a_learned, values.b_learned)
</data>



Hi Dave,
Thanks for the help, much appreciated.
There seems to be an issue that when Stimulus B is learned to criterion, but not A, it goes to the Stimulus A branch block, not B.
Is there something wrong with the logic of the code here or is it something else:
<block start_block>
/ trials=[1-10=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.correctCount >= 5) block.branch_block_a]
/ branch=[if (trial.b_trial.correctCount >= 5) block.branch_block_b]
</block>


Thanks!


Hi Dave,
Please ignore my previous reply, I managed to figure it out.
Thanks again!
By raven - 10/21/2024

Dave - 10/20/2024
raven - 10/20/2024
Hi Dave,

Basically, if participants press the correct key to criterion (60% accuracy) at the end of one block, I want to start a different block where the first stimulus that has been learned to criterion is no longer there, but the stimuli remain, until they are also learned to criterion.

The issues I can't seem to resolve, and am hoping you can help with, are as follows:

1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

3. Is there a better way to achieve what I'm trying to do? For example, is there a criterion function in Inquisit?

Below is the code that I have been working with.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.start_block]
</expt>

<block start_block>
/ trials=[1-5=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.percentCorrect >= 60) block.branch_block_a]
/ branch=[if (trial.b_trial.percentCorrect >= 60) block.branch_block_b]
</block>

<trial a_trial>
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_a>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_a>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_a>
/ items = ("***** This is the Branch Block A *****
~n
Stimulus A has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = red
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_b>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_b>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_b>
/ items = ("***** This is the Branch Block B *****
~n
Stimulus B has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = green
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


Thank you!



> 1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

There is no such thing as <%num_a_correct%> or <%num_b_correct%>.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


It's <%values.num_a_correct%> and <%values.num_b_correct%> respectively.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


> 2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

Use /skip attributes.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.learning_block]
</expt>

<values>
/ a_learned = false
/ b_learned = false
</values>

<page blocksummary>
^Number of A trials in this block: <%trial.a_trial.trialcount%>
^Percent correct of A trials in this block: <%trial.a_trial.percentcorrect%>
^A learned: <%values.a_learned%>

^Number of B trials in this block: <%trial.b_trial.trialcount%>
^Percent correct of B trials in this block: <%trial.b_trial.percentcorrect%>
^B learned: <%values.b_learned%>
</page>


<block learning_block>
/ postinstructions = (page.blocksummary)
/ onblockend = [
    if (values.num_a_correct >= 60) {
        values.a_learned = true;
    };
    if (values.num_b_correct >= 60) {
        values.b_learned = true;
    }
]
/ trials=[1-20=noreplace(trial.a_trial, trial.b_trial)]
/ branch = [
    if (!values.a_learned || !values.b_learned) { // if either hasn't been learned, run another learning block
        return block.learning_block;
    }
]
</block>

<trial a_trial>
/ skip = [
    values.a_learned;
]
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ skip = [
    values.b_learned;
]

/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
    values.num_a_correct values.num_b_correct trial.a_trial.percentcorrect trial.b_trial.percentcorrect
    values.a_learned, values.b_learned)
</data>



Hi Dave,

If one stimulus has been learned, say Stimulus A, I'd like to bring in another stimulus, say Stimulus C (i.e., trial.c_trial).
Is there a wa to achieve this without disrupting the flow of the program?

Thanks!
By Dave - 10/21/2024

raven - 10/21/2024
Dave - 10/20/2024
raven - 10/20/2024
Hi Dave,

Basically, if participants press the correct key to criterion (60% accuracy) at the end of one block, I want to start a different block where the first stimulus that has been learned to criterion is no longer there, but the stimuli remain, until they are also learned to criterion.

The issues I can't seem to resolve, and am hoping you can help with, are as follows:

1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

3. Is there a better way to achieve what I'm trying to do? For example, is there a criterion function in Inquisit?

Below is the code that I have been working with.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.start_block]
</expt>

<block start_block>
/ trials=[1-5=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.percentCorrect >= 60) block.branch_block_a]
/ branch=[if (trial.b_trial.percentCorrect >= 60) block.branch_block_b]
</block>

<trial a_trial>
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_a>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_a>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_a>
/ items = ("***** This is the Branch Block A *****
~n
Stimulus A has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = red
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_b>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_b>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_b>
/ items = ("***** This is the Branch Block B *****
~n
Stimulus B has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = green
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


Thank you!



> 1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

There is no such thing as <%num_a_correct%> or <%num_b_correct%>.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


It's <%values.num_a_correct%> and <%values.num_b_correct%> respectively.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


> 2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

Use /skip attributes.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.learning_block]
</expt>

<values>
/ a_learned = false
/ b_learned = false
</values>

<page blocksummary>
^Number of A trials in this block: <%trial.a_trial.trialcount%>
^Percent correct of A trials in this block: <%trial.a_trial.percentcorrect%>
^A learned: <%values.a_learned%>

^Number of B trials in this block: <%trial.b_trial.trialcount%>
^Percent correct of B trials in this block: <%trial.b_trial.percentcorrect%>
^B learned: <%values.b_learned%>
</page>


<block learning_block>
/ postinstructions = (page.blocksummary)
/ onblockend = [
    if (values.num_a_correct >= 60) {
        values.a_learned = true;
    };
    if (values.num_b_correct >= 60) {
        values.b_learned = true;
    }
]
/ trials=[1-20=noreplace(trial.a_trial, trial.b_trial)]
/ branch = [
    if (!values.a_learned || !values.b_learned) { // if either hasn't been learned, run another learning block
        return block.learning_block;
    }
]
</block>

<trial a_trial>
/ skip = [
    values.a_learned;
]
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ skip = [
    values.b_learned;
]

/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
    values.num_a_correct values.num_b_correct trial.a_trial.percentcorrect trial.b_trial.percentcorrect
    values.a_learned, values.b_learned)
</data>



Hi Dave,

If one stimulus has been learned, say Stimulus A, I'd like to bring in another stimulus, say Stimulus C (i.e., trial.c_trial).
Is there a wa to achieve this without disrupting the flow of the program?

Thanks!

The same approach I already showed you applies. /skip the c trial as long as either the a and b trials have not been learned. Don't skip it as soon as either has been learned.
By raven - 10/21/2024

Dave - 10/21/2024
raven - 10/21/2024
Dave - 10/20/2024
raven - 10/20/2024
Hi Dave,

Basically, if participants press the correct key to criterion (60% accuracy) at the end of one block, I want to start a different block where the first stimulus that has been learned to criterion is no longer there, but the stimuli remain, until they are also learned to criterion.

The issues I can't seem to resolve, and am hoping you can help with, are as follows:

1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

3. Is there a better way to achieve what I'm trying to do? For example, is there a criterion function in Inquisit?

Below is the code that I have been working with.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.start_block]
</expt>

<block start_block>
/ trials=[1-5=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.percentCorrect >= 60) block.branch_block_a]
/ branch=[if (trial.b_trial.percentCorrect >= 60) block.branch_block_b]
</block>

<trial a_trial>
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_a>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_a>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_a>
/ items = ("***** This is the Branch Block A *****
~n
Stimulus A has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = red
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_b>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_b>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_b>
/ items = ("***** This is the Branch Block B *****
~n
Stimulus B has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = green
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


Thank you!



> 1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

There is no such thing as <%num_a_correct%> or <%num_b_correct%>.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


It's <%values.num_a_correct%> and <%values.num_b_correct%> respectively.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


> 2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

Use /skip attributes.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.learning_block]
</expt>

<values>
/ a_learned = false
/ b_learned = false
</values>

<page blocksummary>
^Number of A trials in this block: <%trial.a_trial.trialcount%>
^Percent correct of A trials in this block: <%trial.a_trial.percentcorrect%>
^A learned: <%values.a_learned%>

^Number of B trials in this block: <%trial.b_trial.trialcount%>
^Percent correct of B trials in this block: <%trial.b_trial.percentcorrect%>
^B learned: <%values.b_learned%>
</page>


<block learning_block>
/ postinstructions = (page.blocksummary)
/ onblockend = [
    if (values.num_a_correct >= 60) {
        values.a_learned = true;
    };
    if (values.num_b_correct >= 60) {
        values.b_learned = true;
    }
]
/ trials=[1-20=noreplace(trial.a_trial, trial.b_trial)]
/ branch = [
    if (!values.a_learned || !values.b_learned) { // if either hasn't been learned, run another learning block
        return block.learning_block;
    }
]
</block>

<trial a_trial>
/ skip = [
    values.a_learned;
]
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ skip = [
    values.b_learned;
]

/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
    values.num_a_correct values.num_b_correct trial.a_trial.percentcorrect trial.b_trial.percentcorrect
    values.a_learned, values.b_learned)
</data>



Hi Dave,

If one stimulus has been learned, say Stimulus A, I'd like to bring in another stimulus, say Stimulus C (i.e., trial.c_trial).
Is there a wa to achieve this without disrupting the flow of the program?

Thanks!

The same approach I already showed you applies. /skip the c trial as long as either the a and b trials have not been learned. Don't skip it as soon as either has been learned.

Ok, that makes sense, thanks! :)
By raven - 10/21/2024

raven - 10/21/2024
Dave - 10/21/2024
raven - 10/21/2024
Dave - 10/20/2024
raven - 10/20/2024
Hi Dave,

Basically, if participants press the correct key to criterion (60% accuracy) at the end of one block, I want to start a different block where the first stimulus that has been learned to criterion is no longer there, but the stimuli remain, until they are also learned to criterion.

The issues I can't seem to resolve, and am hoping you can help with, are as follows:

1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

3. Is there a better way to achieve what I'm trying to do? For example, is there a criterion function in Inquisit?

Below is the code that I have been working with.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.start_block]
</expt>

<block start_block>
/ trials=[1-5=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.percentCorrect >= 60) block.branch_block_a]
/ branch=[if (trial.b_trial.percentCorrect >= 60) block.branch_block_b]
</block>

<trial a_trial>
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_a>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_a>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_a>
/ items = ("***** This is the Branch Block A *****
~n
Stimulus A has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = red
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_b>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_b>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_b>
/ items = ("***** This is the Branch Block B *****
~n
Stimulus B has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = green
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


Thank you!



> 1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

There is no such thing as <%num_a_correct%> or <%num_b_correct%>.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


It's <%values.num_a_correct%> and <%values.num_b_correct%> respectively.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


> 2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

Use /skip attributes.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.learning_block]
</expt>

<values>
/ a_learned = false
/ b_learned = false
</values>

<page blocksummary>
^Number of A trials in this block: <%trial.a_trial.trialcount%>
^Percent correct of A trials in this block: <%trial.a_trial.percentcorrect%>
^A learned: <%values.a_learned%>

^Number of B trials in this block: <%trial.b_trial.trialcount%>
^Percent correct of B trials in this block: <%trial.b_trial.percentcorrect%>
^B learned: <%values.b_learned%>
</page>


<block learning_block>
/ postinstructions = (page.blocksummary)
/ onblockend = [
    if (values.num_a_correct >= 60) {
        values.a_learned = true;
    };
    if (values.num_b_correct >= 60) {
        values.b_learned = true;
    }
]
/ trials=[1-20=noreplace(trial.a_trial, trial.b_trial)]
/ branch = [
    if (!values.a_learned || !values.b_learned) { // if either hasn't been learned, run another learning block
        return block.learning_block;
    }
]
</block>

<trial a_trial>
/ skip = [
    values.a_learned;
]
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ skip = [
    values.b_learned;
]

/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
    values.num_a_correct values.num_b_correct trial.a_trial.percentcorrect trial.b_trial.percentcorrect
    values.a_learned, values.b_learned)
</data>



Hi Dave,

If one stimulus has been learned, say Stimulus A, I'd like to bring in another stimulus, say Stimulus C (i.e., trial.c_trial).
Is there a wa to achieve this without disrupting the flow of the program?

Thanks!

The same approach I already showed you applies. /skip the c trial as long as either the a and b trials have not been learned. Don't skip it as soon as either has been learned.

Ok, that makes sense, thanks! :)

Hi Dave,
I have another question.
How would I make it so that there are separate blocks for each phase of learning?
For example, if a participant learns Stimulus A to criterion in Block 1, then there will be a break, after which they will start Block 2 where they would only be presented with Stimulus B and C, until one of them is learned to criterion, etc.
I'm not sure how this can be done using the / skip attribute approach. Or should a different approach be used to achieve this?
Thanks!
By Dave - 10/22/2024

raven - 10/22/2024
raven - 10/21/2024
Dave - 10/21/2024
raven - 10/21/2024
Dave - 10/20/2024
raven - 10/20/2024
Hi Dave,

Basically, if participants press the correct key to criterion (60% accuracy) at the end of one block, I want to start a different block where the first stimulus that has been learned to criterion is no longer there, but the stimuli remain, until they are also learned to criterion.

The issues I can't seem to resolve, and am hoping you can help with, are as follows:

1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

3. Is there a better way to achieve what I'm trying to do? For example, is there a criterion function in Inquisit?

Below is the code that I have been working with.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.start_block]
</expt>

<block start_block>
/ trials=[1-5=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.percentCorrect >= 60) block.branch_block_a]
/ branch=[if (trial.b_trial.percentCorrect >= 60) block.branch_block_b]
</block>

<trial a_trial>
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_a>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_a>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_a>
/ items = ("***** This is the Branch Block A *****
~n
Stimulus A has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = red
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_b>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_b>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_b>
/ items = ("***** This is the Branch Block B *****
~n
Stimulus B has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = green
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


Thank you!



> 1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

There is no such thing as <%num_a_correct%> or <%num_b_correct%>.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


It's <%values.num_a_correct%> and <%values.num_b_correct%> respectively.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


> 2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

Use /skip attributes.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.learning_block]
</expt>

<values>
/ a_learned = false
/ b_learned = false
</values>

<page blocksummary>
^Number of A trials in this block: <%trial.a_trial.trialcount%>
^Percent correct of A trials in this block: <%trial.a_trial.percentcorrect%>
^A learned: <%values.a_learned%>

^Number of B trials in this block: <%trial.b_trial.trialcount%>
^Percent correct of B trials in this block: <%trial.b_trial.percentcorrect%>
^B learned: <%values.b_learned%>
</page>


<block learning_block>
/ postinstructions = (page.blocksummary)
/ onblockend = [
    if (values.num_a_correct >= 60) {
        values.a_learned = true;
    };
    if (values.num_b_correct >= 60) {
        values.b_learned = true;
    }
]
/ trials=[1-20=noreplace(trial.a_trial, trial.b_trial)]
/ branch = [
    if (!values.a_learned || !values.b_learned) { // if either hasn't been learned, run another learning block
        return block.learning_block;
    }
]
</block>

<trial a_trial>
/ skip = [
    values.a_learned;
]
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ skip = [
    values.b_learned;
]

/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
    values.num_a_correct values.num_b_correct trial.a_trial.percentcorrect trial.b_trial.percentcorrect
    values.a_learned, values.b_learned)
</data>



Hi Dave,

If one stimulus has been learned, say Stimulus A, I'd like to bring in another stimulus, say Stimulus C (i.e., trial.c_trial).
Is there a wa to achieve this without disrupting the flow of the program?

Thanks!

The same approach I already showed you applies. /skip the c trial as long as either the a and b trials have not been learned. Don't skip it as soon as either has been learned.

Ok, that makes sense, thanks! :)

Hi Dave,
I have another question.
How would I make it so that there are separate blocks for each phase of learning?
For example, if a participant learns Stimulus A to criterion in Block 1, then there will be a break, after which they will start Block 2 where they would only be presented with Stimulus B and C, until one of them is learned to criterion, etc.
I'm not sure how this can be done using the / skip attribute approach. Or should a different approach be used to achieve this?
Thanks!

Why would that require separate blocks? But regardless, the /skip approach is just as applicable as it was before.
By raven - 10/22/2024

Dave - 10/22/2024
raven - 10/22/2024
raven - 10/21/2024
Dave - 10/21/2024
raven - 10/21/2024
Dave - 10/20/2024
raven - 10/20/2024
Hi Dave,

Basically, if participants press the correct key to criterion (60% accuracy) at the end of one block, I want to start a different block where the first stimulus that has been learned to criterion is no longer there, but the stimuli remain, until they are also learned to criterion.

The issues I can't seem to resolve, and am hoping you can help with, are as follows:

1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

3. Is there a better way to achieve what I'm trying to do? For example, is there a criterion function in Inquisit?

Below is the code that I have been working with.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.start_block]
</expt>

<block start_block>
/ trials=[1-5=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.percentCorrect >= 60) block.branch_block_a]
/ branch=[if (trial.b_trial.percentCorrect >= 60) block.branch_block_b]
</block>

<trial a_trial>
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_a>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_a>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_a>
/ items = ("***** This is the Branch Block A *****
~n
Stimulus A has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = red
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_b>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_b>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_b>
/ items = ("***** This is the Branch Block B *****
~n
Stimulus B has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = green
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


Thank you!



> 1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

There is no such thing as <%num_a_correct%> or <%num_b_correct%>.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


It's <%values.num_a_correct%> and <%values.num_b_correct%> respectively.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


> 2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

Use /skip attributes.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.learning_block]
</expt>

<values>
/ a_learned = false
/ b_learned = false
</values>

<page blocksummary>
^Number of A trials in this block: <%trial.a_trial.trialcount%>
^Percent correct of A trials in this block: <%trial.a_trial.percentcorrect%>
^A learned: <%values.a_learned%>

^Number of B trials in this block: <%trial.b_trial.trialcount%>
^Percent correct of B trials in this block: <%trial.b_trial.percentcorrect%>
^B learned: <%values.b_learned%>
</page>


<block learning_block>
/ postinstructions = (page.blocksummary)
/ onblockend = [
    if (values.num_a_correct >= 60) {
        values.a_learned = true;
    };
    if (values.num_b_correct >= 60) {
        values.b_learned = true;
    }
]
/ trials=[1-20=noreplace(trial.a_trial, trial.b_trial)]
/ branch = [
    if (!values.a_learned || !values.b_learned) { // if either hasn't been learned, run another learning block
        return block.learning_block;
    }
]
</block>

<trial a_trial>
/ skip = [
    values.a_learned;
]
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ skip = [
    values.b_learned;
]

/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
    values.num_a_correct values.num_b_correct trial.a_trial.percentcorrect trial.b_trial.percentcorrect
    values.a_learned, values.b_learned)
</data>



Hi Dave,

If one stimulus has been learned, say Stimulus A, I'd like to bring in another stimulus, say Stimulus C (i.e., trial.c_trial).
Is there a wa to achieve this without disrupting the flow of the program?

Thanks!

The same approach I already showed you applies. /skip the c trial as long as either the a and b trials have not been learned. Don't skip it as soon as either has been learned.

Ok, that makes sense, thanks! :)

Hi Dave,
I have another question.
How would I make it so that there are separate blocks for each phase of learning?
For example, if a participant learns Stimulus A to criterion in Block 1, then there will be a break, after which they will start Block 2 where they would only be presented with Stimulus B and C, until one of them is learned to criterion, etc.
I'm not sure how this can be done using the / skip attribute approach. Or should a different approach be used to achieve this?
Thanks!

Why would that require separate blocks? But regardless, the /skip approach is just as applicable as it was before.

Ok, will give that a go.
Thanks again!
By raven - 10/29/2024

raven - 10/22/2024
Dave - 10/22/2024
raven - 10/22/2024
raven - 10/21/2024
Dave - 10/21/2024
raven - 10/21/2024
Dave - 10/20/2024
raven - 10/20/2024
Hi Dave,

Basically, if participants press the correct key to criterion (60% accuracy) at the end of one block, I want to start a different block where the first stimulus that has been learned to criterion is no longer there, but the stimuli remain, until they are also learned to criterion.

The issues I can't seem to resolve, and am hoping you can help with, are as follows:

1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

3. Is there a better way to achieve what I'm trying to do? For example, is there a criterion function in Inquisit?

Below is the code that I have been working with.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.start_block]
</expt>

<block start_block>
/ trials=[1-5=noreplace(trial.a_trial, trial.b_trial)]
/ branch=[if (trial.a_trial.percentCorrect >= 60) block.branch_block_a]
/ branch=[if (trial.b_trial.percentCorrect >= 60) block.branch_block_b]
</block>

<trial a_trial>
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        trial.feedback_screen
    }
    ]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_a>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_a>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_a>
/ items = ("***** This is the Branch Block A *****
~n
Stimulus A has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = red
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<block branch_block_b>
    / trials = [
    1=noreplace(branch_block_trial_a)
]
</block>

<trial branch_block_trial_b>
/ stimulusframes = [
    1=clearscreen, text.branch_block_text_a
]
/ validresponse = (" ")

</trial>

<text branch_block_text_b>
/ items = ("***** This is the Branch Block B *****
~n
Stimulus B has been learned to criterion")
/ fontstyle = ("Courier", 18pt, true)
/ color = green
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


Thank you!



> 1. The percentage of time that a participant presses the correct key for each stimulus is not displayed correctly on the feedback screen. It should get the value from the percentCorrect property, but that doesn't seem to be working.

There is no such thing as <%num_a_correct%> or <%num_b_correct%>.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


It's <%values.num_a_correct%> and <%values.num_b_correct%> respectively.

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>


> 2. How can I make it so that when one stimulus has been learned to criterion, the others remain until they are all learned?

Use /skip attributes.

<values>
/ num_a_correct = 0;
/ num_b_correct = 0;
</values>

<expt>
/ blocks = [1=block.learning_block]
</expt>

<values>
/ a_learned = false
/ b_learned = false
</values>

<page blocksummary>
^Number of A trials in this block: <%trial.a_trial.trialcount%>
^Percent correct of A trials in this block: <%trial.a_trial.percentcorrect%>
^A learned: <%values.a_learned%>

^Number of B trials in this block: <%trial.b_trial.trialcount%>
^Percent correct of B trials in this block: <%trial.b_trial.percentcorrect%>
^B learned: <%values.b_learned%>
</page>


<block learning_block>
/ postinstructions = (page.blocksummary)
/ onblockend = [
    if (values.num_a_correct >= 60) {
        values.a_learned = true;
    };
    if (values.num_b_correct >= 60) {
        values.b_learned = true;
    }
]
/ trials=[1-20=noreplace(trial.a_trial, trial.b_trial)]
/ branch = [
    if (!values.a_learned || !values.b_learned) { // if either hasn't been learned, run another learning block
        return block.learning_block;
    }
]
</block>

<trial a_trial>
/ skip = [
    values.a_learned;
]
/ ontrialend = [
    values.num_a_correct = trial.a_trial.percentCorrect
]

/ stimulusframes = [1=clearscreen, a_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a_trial_stimulus>
/ items = ("Stimulus A")
/ hposition = 50%
</text>

<trial b_trial>
/ skip = [
    values.b_learned;
]

/ ontrialend = [
    values.num_b_correct = trial.b_trial.percentCorrect
]
/ stimulusframes = [1=clearscreen, b_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b_trial_stimulus>
/ items = ("Stimulus B")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a_correct; 150=num_b_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a_correct>
/ items = ("Percentage Stimulus A Correct: <%values.num_a_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_b_correct>
/ items = ("Percentage Stimulus B Correct: <%values.num_b_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
    values.num_a_correct values.num_b_correct trial.a_trial.percentcorrect trial.b_trial.percentcorrect
    values.a_learned, values.b_learned)
</data>



Hi Dave,

If one stimulus has been learned, say Stimulus A, I'd like to bring in another stimulus, say Stimulus C (i.e., trial.c_trial).
Is there a wa to achieve this without disrupting the flow of the program?

Thanks!

The same approach I already showed you applies. /skip the c trial as long as either the a and b trials have not been learned. Don't skip it as soon as either has been learned.

Ok, that makes sense, thanks! :)

Hi Dave,
I have another question.
How would I make it so that there are separate blocks for each phase of learning?
For example, if a participant learns Stimulus A to criterion in Block 1, then there will be a break, after which they will start Block 2 where they would only be presented with Stimulus B and C, until one of them is learned to criterion, etc.
I'm not sure how this can be done using the / skip attribute approach. Or should a different approach be used to achieve this?
Thanks!

Why would that require separate blocks? But regardless, the /skip approach is just as applicable as it was before.

Ok, will give that a go.
Thanks again!


Hi Dave,

Given the code below:
1. How can I make it so that when the response is "a" 3 or more times for both/either the a1 and a2 trials, both the a1 and a2 trials are skipped when that criterion is met. The same applies for the b1 and b2 trials. Despite the fact that the a2 trial's correct response is "b", and the b2 trial's correct response is "a"? So, essentially, regardless of the correct response for trials a1 and a2, the criterion should be based on the desired response, which is "a" for the a_trials, and "b" for the b_trials.

2. Is there a way to counterbalance for odd/even participant numbers using expt so that the desired responses are switched (e.g., for even numbered participants, the desired response for the a1 and a2 trials is now "b", and the desired response for the  b1 and b2 trials is now "a"?

<values>
/ num_a_trials_response_a = 0;
/ num_a1_correct = 0;
/ num_a2_correct = 0;

/ num_b_trials_response_b = 0;
/ num_b1_correct = 0;
/ num_b2_correct = 0;
</values>

<expt one>
/ blocks = [1=block.learning_block1]
/ subjects = (1 of 2)
</expt>

<expt two>
/ blocks = [1=block.learning_block2]
/ subjects = (2 of 2)
</expt>

<values>
/ a_learned = false
/ a1_learned = false
/ a2_learned = false

/ b_learned = false
/ b1_learned = false
/ b2_learned = false
</values>

<values>
/ a_trial_count = trial.a1_trial.trialcount + trial.a2_trial.trialcount
/ b_trial_count = trial.b1_trial.trialcount + trial.b2_trial.trialcount
</values>

<page blocksummary>
^Number of A trials in this block: <%values.a_trial_count%>
^Number of A trials in this block where 'A' was the response: <%???%>
^A desired response: <%values.a_learned%>

^Number of A1 trials in this block: <%trial.a1_trial.trialcount%>
^Number correct A1 trials in this block: <%trial.a1_trial.percentcorrect%>
^A1 learned: <%values.a1_learned%>

^Number of A2 trials in this block: <%trial.a2_trial.trialcount%>
^Number correct A2 trials in this block: <%trial.a2_trial.percentcorrect%>
^A2 learned: <%values.a2_learned%>

^Number of B trials in this block: <%values.b_trial_count%>
^Number of B trials in this block where 'A' was the response: <%???%>
^B desired response: <%values.b_learned%>

^Number of B1 trials in this block: <%trial.b1_trial.trialcount%>
^Number correct B1 trials in this block: <%trial.b1_trial.percentcorrect%>
^B1 learned: <%values.b1_learned%>

^Number of B2 trials in this block: <%trial.b2_trial.trialcount%>
^Number correct B2 trials in this block: <%trial.b2_trial.percentcorrect%>
^B2 learned: <%values.b2_learned%>
</page>


<block learning_block1>
/ postinstructions = (page.blocksummary)
/ onblockend = [
if (values.num_a_trials_response_a >= 3) {
values.a1_learned = true;
        values.a2_learned = true;
};
if (values.num_b_trials_response_b >= 3) {
values.b1_learned = true;
        values.b2_learned = true;
}
]
/ trials=[1-18=noreplace(trial.a1_trial, trial.a1_trial, trial.a2_trial, trial.b1_trial, trial.b2_trial, trial.b2_trial)]
/ branch = [
if (!values.a1_learned || !values.a2_learned || !values.b1_learned || !values.b2_learned) { // if either hasn't been learned, run another learning block
return block.learning_block;
}
]
</block>

<trial a1_trial>
/ skip = [
values.a1_learned;
]
/ ontrialend = [
values.num_a1_correct = trial.a1_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a1_trial_stimulus>
/ items = ("Stimulus A1")
/ hposition = 50%
</text>

<trial a2_trial>
/ skip = [
values.a2_learned;
]
/ ontrialend = [
values.num_a2_correct = trial.a2_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a2_trial_stimulus>
/ items = ("Stimulus A2")
/ hposition = 50%
</text>

<trial b1_trial>
/ skip = [
values.b1_learned;
]

/ ontrialend = [
values.num_b1_correct = trial.b1_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b1_trial_stimulus>
/ items = ("Stimulus B1")
/ hposition = 50%
</text>

<trial b2_trial>
/ skip = [
values.b2_learned;
]

/ ontrialend = [
values.num_b2_correct = trial.b2_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b2_trial_stimulus>
/ items = ("Stimulus B2")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a1_correct; 100=num_a2_correct; 200=num_b1_correct; 200=num_b2_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a1_correct>
/ items = ("Percentage Stimulus A1 Correct: <%values.num_a1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_a2_correct>
/ items = ("Percentage Stimulus A2 Correct: <%values.num_a2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<text num_b1_correct>
/ items = ("Percentage Stimulus B1 Correct: <%values.num_b1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 60%)
</text>

<text num_b2_correct>
/ items = ("Percentage Stimulus B2 Correct: <%values.num_b2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 70%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
values.num_a1_correct values.num_a2_correct values.num_b1_correct values.num_b2_correct trial.a1_trial.percentcorrect trial.a2_trial.percentcorrect trial.b1_trial.percentcorrect trial.b2_trial.percentcorrect
values.a1_learned, values.a2_learned, values.b1_learned values.b2_learned)
</data>


Thanks!
By Dave - 10/29/2024

raven - 10/29/2024


Hi Dave,

Given the code below:
1. How can I make it so that when the response is "a" 3 or more times for both/either the a1 and a2 trials, both the a1 and a2 trials are skipped when that criterion is met. The same applies for the b1 and b2 trials. Despite the fact that the a2 trial's correct response is "b", and the b2 trial's correct response is "a"? So, essentially, regardless of the correct response for trials a1 and a2, the criterion should be based on the desired response, which is "a" for the a_trials, and "b" for the b_trials.

2. Is there a way to counterbalance for odd/even participant numbers using expt so that the desired responses are switched (e.g., for even numbered participants, the desired response for the a1 and a2 trials is now "b", and the desired response for the  b1 and b2 trials is now "a"?

<values>
/ num_a_trials_response_a = 0;
/ num_a1_correct = 0;
/ num_a2_correct = 0;

/ num_b_trials_response_b = 0;
/ num_b1_correct = 0;
/ num_b2_correct = 0;
</values>

<expt one>
/ blocks = [1=block.learning_block1]
/ subjects = (1 of 2)
</expt>

<expt two>
/ blocks = [1=block.learning_block2]
/ subjects = (2 of 2)
</expt>

<values>
/ a_learned = false
/ a1_learned = false
/ a2_learned = false

/ b_learned = false
/ b1_learned = false
/ b2_learned = false
</values>

<values>
/ a_trial_count = trial.a1_trial.trialcount + trial.a2_trial.trialcount
/ b_trial_count = trial.b1_trial.trialcount + trial.b2_trial.trialcount
</values>

<page blocksummary>
^Number of A trials in this block: <%values.a_trial_count%>
^Number of A trials in this block where 'A' was the response: <%???%>
^A desired response: <%values.a_learned%>

^Number of A1 trials in this block: <%trial.a1_trial.trialcount%>
^Number correct A1 trials in this block: <%trial.a1_trial.percentcorrect%>
^A1 learned: <%values.a1_learned%>

^Number of A2 trials in this block: <%trial.a2_trial.trialcount%>
^Number correct A2 trials in this block: <%trial.a2_trial.percentcorrect%>
^A2 learned: <%values.a2_learned%>

^Number of B trials in this block: <%values.b_trial_count%>
^Number of B trials in this block where 'A' was the response: <%???%>
^B desired response: <%values.b_learned%>

^Number of B1 trials in this block: <%trial.b1_trial.trialcount%>
^Number correct B1 trials in this block: <%trial.b1_trial.percentcorrect%>
^B1 learned: <%values.b1_learned%>

^Number of B2 trials in this block: <%trial.b2_trial.trialcount%>
^Number correct B2 trials in this block: <%trial.b2_trial.percentcorrect%>
^B2 learned: <%values.b2_learned%>
</page>


<block learning_block1>
/ postinstructions = (page.blocksummary)
/ onblockend = [
if (values.num_a_trials_response_a >= 3) {
values.a1_learned = true;
        values.a2_learned = true;
};
if (values.num_b_trials_response_b >= 3) {
values.b1_learned = true;
        values.b2_learned = true;
}
]
/ trials=[1-18=noreplace(trial.a1_trial, trial.a1_trial, trial.a2_trial, trial.b1_trial, trial.b2_trial, trial.b2_trial)]
/ branch = [
if (!values.a1_learned || !values.a2_learned || !values.b1_learned || !values.b2_learned) { // if either hasn't been learned, run another learning block
return block.learning_block;
}
]
</block>

<trial a1_trial>
/ skip = [
values.a1_learned;
]
/ ontrialend = [
values.num_a1_correct = trial.a1_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a1_trial_stimulus>
/ items = ("Stimulus A1")
/ hposition = 50%
</text>

<trial a2_trial>
/ skip = [
values.a2_learned;
]
/ ontrialend = [
values.num_a2_correct = trial.a2_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a2_trial_stimulus>
/ items = ("Stimulus A2")
/ hposition = 50%
</text>

<trial b1_trial>
/ skip = [
values.b1_learned;
]

/ ontrialend = [
values.num_b1_correct = trial.b1_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b1_trial_stimulus>
/ items = ("Stimulus B1")
/ hposition = 50%
</text>

<trial b2_trial>
/ skip = [
values.b2_learned;
]

/ ontrialend = [
values.num_b2_correct = trial.b2_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b2_trial_stimulus>
/ items = ("Stimulus B2")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a1_correct; 100=num_a2_correct; 200=num_b1_correct; 200=num_b2_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a1_correct>
/ items = ("Percentage Stimulus A1 Correct: <%values.num_a1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_a2_correct>
/ items = ("Percentage Stimulus A2 Correct: <%values.num_a2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<text num_b1_correct>
/ items = ("Percentage Stimulus B1 Correct: <%values.num_b1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 60%)
</text>

<text num_b2_correct>
/ items = ("Percentage Stimulus B2 Correct: <%values.num_b2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 70%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
values.num_a1_correct values.num_a2_correct values.num_b1_correct values.num_b2_correct trial.a1_trial.percentcorrect trial.a2_trial.percentcorrect trial.b1_trial.percentcorrect trial.b2_trial.percentcorrect
values.a1_learned, values.a2_learned, values.b1_learned values.b2_learned)
</data>


Thanks!

You count things up in variables and skip on that basis. As simple as that.

As for counterbalancing, parameterize the correct responses, define two expt elements, set the correct responses to the applicable values /onexptbegin respectively.

By Dave - 10/29/2024

Dave - 10/29/2024
raven - 10/29/2024


Hi Dave,

Given the code below:
1. How can I make it so that when the response is "a" 3 or more times for both/either the a1 and a2 trials, both the a1 and a2 trials are skipped when that criterion is met. The same applies for the b1 and b2 trials. Despite the fact that the a2 trial's correct response is "b", and the b2 trial's correct response is "a"? So, essentially, regardless of the correct response for trials a1 and a2, the criterion should be based on the desired response, which is "a" for the a_trials, and "b" for the b_trials.

2. Is there a way to counterbalance for odd/even participant numbers using expt so that the desired responses are switched (e.g., for even numbered participants, the desired response for the a1 and a2 trials is now "b", and the desired response for the  b1 and b2 trials is now "a"?

<values>
/ num_a_trials_response_a = 0;
/ num_a1_correct = 0;
/ num_a2_correct = 0;

/ num_b_trials_response_b = 0;
/ num_b1_correct = 0;
/ num_b2_correct = 0;
</values>

<expt one>
/ blocks = [1=block.learning_block1]
/ subjects = (1 of 2)
</expt>

<expt two>
/ blocks = [1=block.learning_block2]
/ subjects = (2 of 2)
</expt>

<values>
/ a_learned = false
/ a1_learned = false
/ a2_learned = false

/ b_learned = false
/ b1_learned = false
/ b2_learned = false
</values>

<values>
/ a_trial_count = trial.a1_trial.trialcount + trial.a2_trial.trialcount
/ b_trial_count = trial.b1_trial.trialcount + trial.b2_trial.trialcount
</values>

<page blocksummary>
^Number of A trials in this block: <%values.a_trial_count%>
^Number of A trials in this block where 'A' was the response: <%???%>
^A desired response: <%values.a_learned%>

^Number of A1 trials in this block: <%trial.a1_trial.trialcount%>
^Number correct A1 trials in this block: <%trial.a1_trial.percentcorrect%>
^A1 learned: <%values.a1_learned%>

^Number of A2 trials in this block: <%trial.a2_trial.trialcount%>
^Number correct A2 trials in this block: <%trial.a2_trial.percentcorrect%>
^A2 learned: <%values.a2_learned%>

^Number of B trials in this block: <%values.b_trial_count%>
^Number of B trials in this block where 'A' was the response: <%???%>
^B desired response: <%values.b_learned%>

^Number of B1 trials in this block: <%trial.b1_trial.trialcount%>
^Number correct B1 trials in this block: <%trial.b1_trial.percentcorrect%>
^B1 learned: <%values.b1_learned%>

^Number of B2 trials in this block: <%trial.b2_trial.trialcount%>
^Number correct B2 trials in this block: <%trial.b2_trial.percentcorrect%>
^B2 learned: <%values.b2_learned%>
</page>


<block learning_block1>
/ postinstructions = (page.blocksummary)
/ onblockend = [
if (values.num_a_trials_response_a >= 3) {
values.a1_learned = true;
        values.a2_learned = true;
};
if (values.num_b_trials_response_b >= 3) {
values.b1_learned = true;
        values.b2_learned = true;
}
]
/ trials=[1-18=noreplace(trial.a1_trial, trial.a1_trial, trial.a2_trial, trial.b1_trial, trial.b2_trial, trial.b2_trial)]
/ branch = [
if (!values.a1_learned || !values.a2_learned || !values.b1_learned || !values.b2_learned) { // if either hasn't been learned, run another learning block
return block.learning_block;
}
]
</block>

<trial a1_trial>
/ skip = [
values.a1_learned;
]
/ ontrialend = [
values.num_a1_correct = trial.a1_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a1_trial_stimulus>
/ items = ("Stimulus A1")
/ hposition = 50%
</text>

<trial a2_trial>
/ skip = [
values.a2_learned;
]
/ ontrialend = [
values.num_a2_correct = trial.a2_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a2_trial_stimulus>
/ items = ("Stimulus A2")
/ hposition = 50%
</text>

<trial b1_trial>
/ skip = [
values.b1_learned;
]

/ ontrialend = [
values.num_b1_correct = trial.b1_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b1_trial_stimulus>
/ items = ("Stimulus B1")
/ hposition = 50%
</text>

<trial b2_trial>
/ skip = [
values.b2_learned;
]

/ ontrialend = [
values.num_b2_correct = trial.b2_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b2_trial_stimulus>
/ items = ("Stimulus B2")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a1_correct; 100=num_a2_correct; 200=num_b1_correct; 200=num_b2_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a1_correct>
/ items = ("Percentage Stimulus A1 Correct: <%values.num_a1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_a2_correct>
/ items = ("Percentage Stimulus A2 Correct: <%values.num_a2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<text num_b1_correct>
/ items = ("Percentage Stimulus B1 Correct: <%values.num_b1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 60%)
</text>

<text num_b2_correct>
/ items = ("Percentage Stimulus B2 Correct: <%values.num_b2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 70%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
values.num_a1_correct values.num_a2_correct values.num_b1_correct values.num_b2_correct trial.a1_trial.percentcorrect trial.a2_trial.percentcorrect trial.b1_trial.percentcorrect trial.b2_trial.percentcorrect
values.a1_learned, values.a2_learned, values.b1_learned values.b2_learned)
</data>


Thanks!

You count things up in variables and skip on that basis. As simple as that.

As for counterbalancing, parameterize the correct responses, define two expt elements, set the correct responses to the applicable values /onexptbegin respectively.


These are all the exact same techniques that have already been discussed in this very thread.

<values>
/ num_a_trials_response_a = 0;
/ num_a1_correct = 0;
/ num_a2_correct = 0;

/ num_b_trials_response_b = 0;
/ num_b1_correct = 0;
/ num_b2_correct = 0;
</values>

<parameters>
/ a1_correctkey = "?"
/ a2_correctkey = "?"
/ b1_correctkey = "?"
/ b2_correctkey = "?"
</parameters>


<expt one>
/ onexptbegin = [
    parameters.a1_correctkey = "a";
    parameters.a2_correctkey = "b";
    parameters.b1_correctkey = "b";
    parameters.b2_correctkey = "a";
]
/ blocks = [1=block.learning_block]
/ subjects = (1 of 2)
</expt>

<expt two>
/ onexptbegin = [
    parameters.a1_correctkey = "b";
    parameters.a2_correctkey = "a";
    parameters.b1_correctkey = "a";
    parameters.b2_correctkey = "b";
]
/ blocks = [1=block.learning_block]
/ subjects = (2 of 2)
</expt>

<values>
/ a_skip = false
/ b_skip = false
/ a_responsecount = 0
/ b_responsecount = 0
/ a_trial_count = 0
/ b_trial_count = 0
</values>

<page blocksummary>
^Number of A trials in this block: <%values.a_trial_count%>
^Number of A trials in this block where 'A' was the response: <%values.a_responsecount%>

^Number of B trials in this block: <%values.b_trial_count%>
^Number of B trials in this block where 'B' was the response: <%values.b_responsecount%>
</page>


<block learning_block>
/ postinstructions = (page.blocksummary)
/ trials=[1-18=noreplace(trial.a1_trial, trial.a1_trial, trial.a2_trial, trial.b1_trial, trial.b2_trial, trial.b2_trial)]
</block>

<trial a1_trial>
/ skip = [
    values.a_skip;
]
/ ontrialend = [
    values.a_trial_count += 1;
    if (trial.a1_trial.responsetext == "a") {
        values.a_responsecount += 1;
    };
    if (values.a_responsecount >= 3) {
        values.a_skip = true;
    };
]
/ stimulusframes = [1=clearscreen, a1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = (parameters.a1_correctkey)
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a1_trial_stimulus>
/ items = ("Stimulus A1")
/ hposition = 50%
</text>

<trial a2_trial>
/ skip = [
    values.a_skip;
]
/ ontrialend = [
    values.a_trial_count += 1;
    if (trial.a2_trial.responsetext == "a") {
        values.a_responsecount += 1;
    };
    if (values.a_responsecount >= 3) {
        values.a_skip = true;
    };
]
/ stimulusframes = [1=clearscreen, a2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = (parameters.a2_correctkey)
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text a2_trial_stimulus>
/ items = ("Stimulus A2")
/ hposition = 50%
</text>

<trial b1_trial>
/ skip = [
    values.b_skip;
]
/ ontrialend = [
    values.b_trial_count += 1;
    if (trial.b1_trial.responsetext == "b") {
        values.b_responsecount += 1;
    };
    if (values.b_responsecount >= 3) {
        values.b_skip = true;
    };
]
/ stimulusframes = [1=clearscreen, b1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = (parameters.b1_correctkey)
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b1_trial_stimulus>
/ items = ("Stimulus B1")
/ hposition = 50%
</text>

<trial b2_trial>
/ skip = [
    values.b_skip;
]
/ ontrialend = [
    values.b_trial_count += 1;
    if (trial.b2_trial.responsetext == "b") {
        values.b_responsecount += 1;
    };
    if (values.b_responsecount >= 3) {
        values.b_skip = true;
    };
]
/ stimulusframes = [1=clearscreen, b2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = (parameters.b2_correctkey)
/ branch = [
    {
        return trial.feedback_screen
    }
]
</trial>

<text b2_trial_stimulus>
/ items = ("Stimulus B2")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a1_correct; 100=num_a2_correct; 200=num_b1_correct; 200=num_b2_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a1_correct>
/ items = ("Percentage Stimulus A1 Correct: <%trial.a1_trial.percentcorrect%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_a2_correct>
/ items = ("Percentage Stimulus A2 Correct: <%trial.a2_trial.percentcorrect%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<text num_b1_correct>
/ items = ("Percentage Stimulus B1 Correct: <%trial.b1_trial.percentcorrect%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 60%)
</text>

<text num_b2_correct>
/ items = ("Percentage Stimulus B2 Correct: <%trial.b2_trial.percentcorrect%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 70%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
    trial.a1_trial.percentcorrect trial.a2_trial.percentcorrect trial.b1_trial.percentcorrect trial.b2_trial.percentcorrect
    values.a_responsecount, values.b_responsecount, values.a_skip, values.b_skip)
</data>
By raven - 10/30/2024

Dave - 10/29/2024
raven - 10/29/2024


Hi Dave,

Given the code below:
1. How can I make it so that when the response is "a" 3 or more times for both/either the a1 and a2 trials, both the a1 and a2 trials are skipped when that criterion is met. The same applies for the b1 and b2 trials. Despite the fact that the a2 trial's correct response is "b", and the b2 trial's correct response is "a"? So, essentially, regardless of the correct response for trials a1 and a2, the criterion should be based on the desired response, which is "a" for the a_trials, and "b" for the b_trials.

2. Is there a way to counterbalance for odd/even participant numbers using expt so that the desired responses are switched (e.g., for even numbered participants, the desired response for the a1 and a2 trials is now "b", and the desired response for the  b1 and b2 trials is now "a"?

<values>
/ num_a_trials_response_a = 0;
/ num_a1_correct = 0;
/ num_a2_correct = 0;

/ num_b_trials_response_b = 0;
/ num_b1_correct = 0;
/ num_b2_correct = 0;
</values>

<expt one>
/ blocks = [1=block.learning_block1]
/ subjects = (1 of 2)
</expt>

<expt two>
/ blocks = [1=block.learning_block2]
/ subjects = (2 of 2)
</expt>

<values>
/ a_learned = false
/ a1_learned = false
/ a2_learned = false

/ b_learned = false
/ b1_learned = false
/ b2_learned = false
</values>

<values>
/ a_trial_count = trial.a1_trial.trialcount + trial.a2_trial.trialcount
/ b_trial_count = trial.b1_trial.trialcount + trial.b2_trial.trialcount
</values>

<page blocksummary>
^Number of A trials in this block: <%values.a_trial_count%>
^Number of A trials in this block where 'A' was the response: <%???%>
^A desired response: <%values.a_learned%>

^Number of A1 trials in this block: <%trial.a1_trial.trialcount%>
^Number correct A1 trials in this block: <%trial.a1_trial.percentcorrect%>
^A1 learned: <%values.a1_learned%>

^Number of A2 trials in this block: <%trial.a2_trial.trialcount%>
^Number correct A2 trials in this block: <%trial.a2_trial.percentcorrect%>
^A2 learned: <%values.a2_learned%>

^Number of B trials in this block: <%values.b_trial_count%>
^Number of B trials in this block where 'A' was the response: <%???%>
^B desired response: <%values.b_learned%>

^Number of B1 trials in this block: <%trial.b1_trial.trialcount%>
^Number correct B1 trials in this block: <%trial.b1_trial.percentcorrect%>
^B1 learned: <%values.b1_learned%>

^Number of B2 trials in this block: <%trial.b2_trial.trialcount%>
^Number correct B2 trials in this block: <%trial.b2_trial.percentcorrect%>
^B2 learned: <%values.b2_learned%>
</page>


<block learning_block1>
/ postinstructions = (page.blocksummary)
/ onblockend = [
if (values.num_a_trials_response_a >= 3) {
values.a1_learned = true;
        values.a2_learned = true;
};
if (values.num_b_trials_response_b >= 3) {
values.b1_learned = true;
        values.b2_learned = true;
}
]
/ trials=[1-18=noreplace(trial.a1_trial, trial.a1_trial, trial.a2_trial, trial.b1_trial, trial.b2_trial, trial.b2_trial)]
/ branch = [
if (!values.a1_learned || !values.a2_learned || !values.b1_learned || !values.b2_learned) { // if either hasn't been learned, run another learning block
return block.learning_block;
}
]
</block>

<trial a1_trial>
/ skip = [
values.a1_learned;
]
/ ontrialend = [
values.num_a1_correct = trial.a1_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a1_trial_stimulus>
/ items = ("Stimulus A1")
/ hposition = 50%
</text>

<trial a2_trial>
/ skip = [
values.a2_learned;
]
/ ontrialend = [
values.num_a2_correct = trial.a2_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a2_trial_stimulus>
/ items = ("Stimulus A2")
/ hposition = 50%
</text>

<trial b1_trial>
/ skip = [
values.b1_learned;
]

/ ontrialend = [
values.num_b1_correct = trial.b1_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b1_trial_stimulus>
/ items = ("Stimulus B1")
/ hposition = 50%
</text>

<trial b2_trial>
/ skip = [
values.b2_learned;
]

/ ontrialend = [
values.num_b2_correct = trial.b2_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b2_trial_stimulus>
/ items = ("Stimulus B2")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a1_correct; 100=num_a2_correct; 200=num_b1_correct; 200=num_b2_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a1_correct>
/ items = ("Percentage Stimulus A1 Correct: <%values.num_a1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_a2_correct>
/ items = ("Percentage Stimulus A2 Correct: <%values.num_a2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<text num_b1_correct>
/ items = ("Percentage Stimulus B1 Correct: <%values.num_b1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 60%)
</text>

<text num_b2_correct>
/ items = ("Percentage Stimulus B2 Correct: <%values.num_b2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 70%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
values.num_a1_correct values.num_a2_correct values.num_b1_correct values.num_b2_correct trial.a1_trial.percentcorrect trial.a2_trial.percentcorrect trial.b1_trial.percentcorrect trial.b2_trial.percentcorrect
values.a1_learned, values.a2_learned, values.b1_learned values.b2_learned)
</data>


Thanks!

You count things up in variables and skip on that basis. As simple as that.

As for counterbalancing, parameterize the correct responses, define two expt elements, set the correct responses to the applicable values /onexptbegin respectively.


Thanks! Would it be a case of using an IF statement to count if the desired key was pressed in each trial, or is there a more efficient way to achieve this?

For example, if the desired response is "z" (scan code 44):

/ ontrialend = [
    if (trial.a_trial.response == 44) {
        values.num_a_correct += 1;
    }
    else {
        values.num_a_correct += 0;
    }
]


By Dave - 10/30/2024

raven - 10/30/2024
Dave - 10/29/2024
raven - 10/29/2024


Hi Dave,

Given the code below:
1. How can I make it so that when the response is "a" 3 or more times for both/either the a1 and a2 trials, both the a1 and a2 trials are skipped when that criterion is met. The same applies for the b1 and b2 trials. Despite the fact that the a2 trial's correct response is "b", and the b2 trial's correct response is "a"? So, essentially, regardless of the correct response for trials a1 and a2, the criterion should be based on the desired response, which is "a" for the a_trials, and "b" for the b_trials.

2. Is there a way to counterbalance for odd/even participant numbers using expt so that the desired responses are switched (e.g., for even numbered participants, the desired response for the a1 and a2 trials is now "b", and the desired response for the  b1 and b2 trials is now "a"?

<values>
/ num_a_trials_response_a = 0;
/ num_a1_correct = 0;
/ num_a2_correct = 0;

/ num_b_trials_response_b = 0;
/ num_b1_correct = 0;
/ num_b2_correct = 0;
</values>

<expt one>
/ blocks = [1=block.learning_block1]
/ subjects = (1 of 2)
</expt>

<expt two>
/ blocks = [1=block.learning_block2]
/ subjects = (2 of 2)
</expt>

<values>
/ a_learned = false
/ a1_learned = false
/ a2_learned = false

/ b_learned = false
/ b1_learned = false
/ b2_learned = false
</values>

<values>
/ a_trial_count = trial.a1_trial.trialcount + trial.a2_trial.trialcount
/ b_trial_count = trial.b1_trial.trialcount + trial.b2_trial.trialcount
</values>

<page blocksummary>
^Number of A trials in this block: <%values.a_trial_count%>
^Number of A trials in this block where 'A' was the response: <%???%>
^A desired response: <%values.a_learned%>

^Number of A1 trials in this block: <%trial.a1_trial.trialcount%>
^Number correct A1 trials in this block: <%trial.a1_trial.percentcorrect%>
^A1 learned: <%values.a1_learned%>

^Number of A2 trials in this block: <%trial.a2_trial.trialcount%>
^Number correct A2 trials in this block: <%trial.a2_trial.percentcorrect%>
^A2 learned: <%values.a2_learned%>

^Number of B trials in this block: <%values.b_trial_count%>
^Number of B trials in this block where 'A' was the response: <%???%>
^B desired response: <%values.b_learned%>

^Number of B1 trials in this block: <%trial.b1_trial.trialcount%>
^Number correct B1 trials in this block: <%trial.b1_trial.percentcorrect%>
^B1 learned: <%values.b1_learned%>

^Number of B2 trials in this block: <%trial.b2_trial.trialcount%>
^Number correct B2 trials in this block: <%trial.b2_trial.percentcorrect%>
^B2 learned: <%values.b2_learned%>
</page>


<block learning_block1>
/ postinstructions = (page.blocksummary)
/ onblockend = [
if (values.num_a_trials_response_a >= 3) {
values.a1_learned = true;
        values.a2_learned = true;
};
if (values.num_b_trials_response_b >= 3) {
values.b1_learned = true;
        values.b2_learned = true;
}
]
/ trials=[1-18=noreplace(trial.a1_trial, trial.a1_trial, trial.a2_trial, trial.b1_trial, trial.b2_trial, trial.b2_trial)]
/ branch = [
if (!values.a1_learned || !values.a2_learned || !values.b1_learned || !values.b2_learned) { // if either hasn't been learned, run another learning block
return block.learning_block;
}
]
</block>

<trial a1_trial>
/ skip = [
values.a1_learned;
]
/ ontrialend = [
values.num_a1_correct = trial.a1_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a1_trial_stimulus>
/ items = ("Stimulus A1")
/ hposition = 50%
</text>

<trial a2_trial>
/ skip = [
values.a2_learned;
]
/ ontrialend = [
values.num_a2_correct = trial.a2_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a2_trial_stimulus>
/ items = ("Stimulus A2")
/ hposition = 50%
</text>

<trial b1_trial>
/ skip = [
values.b1_learned;
]

/ ontrialend = [
values.num_b1_correct = trial.b1_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b1_trial_stimulus>
/ items = ("Stimulus B1")
/ hposition = 50%
</text>

<trial b2_trial>
/ skip = [
values.b2_learned;
]

/ ontrialend = [
values.num_b2_correct = trial.b2_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b2_trial_stimulus>
/ items = ("Stimulus B2")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a1_correct; 100=num_a2_correct; 200=num_b1_correct; 200=num_b2_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a1_correct>
/ items = ("Percentage Stimulus A1 Correct: <%values.num_a1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_a2_correct>
/ items = ("Percentage Stimulus A2 Correct: <%values.num_a2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<text num_b1_correct>
/ items = ("Percentage Stimulus B1 Correct: <%values.num_b1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 60%)
</text>

<text num_b2_correct>
/ items = ("Percentage Stimulus B2 Correct: <%values.num_b2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 70%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
values.num_a1_correct values.num_a2_correct values.num_b1_correct values.num_b2_correct trial.a1_trial.percentcorrect trial.a2_trial.percentcorrect trial.b1_trial.percentcorrect trial.b2_trial.percentcorrect
values.a1_learned, values.a2_learned, values.b1_learned values.b2_learned)
</data>


Thanks!

You count things up in variables and skip on that basis. As simple as that.

As for counterbalancing, parameterize the correct responses, define two expt elements, set the correct responses to the applicable values /onexptbegin respectively.


Thanks! Would it be a case of using an IF statement to count if the desired key was pressed in each trial, or is there a more efficient way to achieve this?

For example, if the desired response is "z" (scan code 44):

/ ontrialend = [
    if (trial.a_trial.response == 44) {
        values.num_a_correct += 1;
    }
    else {
        values.num_a_correct += 0;
    }
]



Yes, as you can clearly see in the example code I gave you.

No, there isn't a more eficient way, and there is nothing inefficient about using conditional logic in the first place
By raven - 10/30/2024

Dave - 10/30/2024
raven - 10/30/2024
Dave - 10/29/2024
raven - 10/29/2024


Hi Dave,

Given the code below:
1. How can I make it so that when the response is "a" 3 or more times for both/either the a1 and a2 trials, both the a1 and a2 trials are skipped when that criterion is met. The same applies for the b1 and b2 trials. Despite the fact that the a2 trial's correct response is "b", and the b2 trial's correct response is "a"? So, essentially, regardless of the correct response for trials a1 and a2, the criterion should be based on the desired response, which is "a" for the a_trials, and "b" for the b_trials.

2. Is there a way to counterbalance for odd/even participant numbers using expt so that the desired responses are switched (e.g., for even numbered participants, the desired response for the a1 and a2 trials is now "b", and the desired response for the  b1 and b2 trials is now "a"?

<values>
/ num_a_trials_response_a = 0;
/ num_a1_correct = 0;
/ num_a2_correct = 0;

/ num_b_trials_response_b = 0;
/ num_b1_correct = 0;
/ num_b2_correct = 0;
</values>

<expt one>
/ blocks = [1=block.learning_block1]
/ subjects = (1 of 2)
</expt>

<expt two>
/ blocks = [1=block.learning_block2]
/ subjects = (2 of 2)
</expt>

<values>
/ a_learned = false
/ a1_learned = false
/ a2_learned = false

/ b_learned = false
/ b1_learned = false
/ b2_learned = false
</values>

<values>
/ a_trial_count = trial.a1_trial.trialcount + trial.a2_trial.trialcount
/ b_trial_count = trial.b1_trial.trialcount + trial.b2_trial.trialcount
</values>

<page blocksummary>
^Number of A trials in this block: <%values.a_trial_count%>
^Number of A trials in this block where 'A' was the response: <%???%>
^A desired response: <%values.a_learned%>

^Number of A1 trials in this block: <%trial.a1_trial.trialcount%>
^Number correct A1 trials in this block: <%trial.a1_trial.percentcorrect%>
^A1 learned: <%values.a1_learned%>

^Number of A2 trials in this block: <%trial.a2_trial.trialcount%>
^Number correct A2 trials in this block: <%trial.a2_trial.percentcorrect%>
^A2 learned: <%values.a2_learned%>

^Number of B trials in this block: <%values.b_trial_count%>
^Number of B trials in this block where 'A' was the response: <%???%>
^B desired response: <%values.b_learned%>

^Number of B1 trials in this block: <%trial.b1_trial.trialcount%>
^Number correct B1 trials in this block: <%trial.b1_trial.percentcorrect%>
^B1 learned: <%values.b1_learned%>

^Number of B2 trials in this block: <%trial.b2_trial.trialcount%>
^Number correct B2 trials in this block: <%trial.b2_trial.percentcorrect%>
^B2 learned: <%values.b2_learned%>
</page>


<block learning_block1>
/ postinstructions = (page.blocksummary)
/ onblockend = [
if (values.num_a_trials_response_a >= 3) {
values.a1_learned = true;
        values.a2_learned = true;
};
if (values.num_b_trials_response_b >= 3) {
values.b1_learned = true;
        values.b2_learned = true;
}
]
/ trials=[1-18=noreplace(trial.a1_trial, trial.a1_trial, trial.a2_trial, trial.b1_trial, trial.b2_trial, trial.b2_trial)]
/ branch = [
if (!values.a1_learned || !values.a2_learned || !values.b1_learned || !values.b2_learned) { // if either hasn't been learned, run another learning block
return block.learning_block;
}
]
</block>

<trial a1_trial>
/ skip = [
values.a1_learned;
]
/ ontrialend = [
values.num_a1_correct = trial.a1_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a1_trial_stimulus>
/ items = ("Stimulus A1")
/ hposition = 50%
</text>

<trial a2_trial>
/ skip = [
values.a2_learned;
]
/ ontrialend = [
values.num_a2_correct = trial.a2_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a2_trial_stimulus>
/ items = ("Stimulus A2")
/ hposition = 50%
</text>

<trial b1_trial>
/ skip = [
values.b1_learned;
]

/ ontrialend = [
values.num_b1_correct = trial.b1_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b1_trial_stimulus>
/ items = ("Stimulus B1")
/ hposition = 50%
</text>

<trial b2_trial>
/ skip = [
values.b2_learned;
]

/ ontrialend = [
values.num_b2_correct = trial.b2_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b2_trial_stimulus>
/ items = ("Stimulus B2")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a1_correct; 100=num_a2_correct; 200=num_b1_correct; 200=num_b2_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a1_correct>
/ items = ("Percentage Stimulus A1 Correct: <%values.num_a1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_a2_correct>
/ items = ("Percentage Stimulus A2 Correct: <%values.num_a2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<text num_b1_correct>
/ items = ("Percentage Stimulus B1 Correct: <%values.num_b1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 60%)
</text>

<text num_b2_correct>
/ items = ("Percentage Stimulus B2 Correct: <%values.num_b2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 70%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
values.num_a1_correct values.num_a2_correct values.num_b1_correct values.num_b2_correct trial.a1_trial.percentcorrect trial.a2_trial.percentcorrect trial.b1_trial.percentcorrect trial.b2_trial.percentcorrect
values.a1_learned, values.a2_learned, values.b1_learned values.b2_learned)
</data>


Thanks!

You count things up in variables and skip on that basis. As simple as that.

As for counterbalancing, parameterize the correct responses, define two expt elements, set the correct responses to the applicable values /onexptbegin respectively.


Thanks! Would it be a case of using an IF statement to count if the desired key was pressed in each trial, or is there a more efficient way to achieve this?

For example, if the desired response is "z" (scan code 44):

/ ontrialend = [
    if (trial.a_trial.response == 44) {
        values.num_a_correct += 1;
    }
    else {
        values.num_a_correct += 0;
    }
]



Yes, as you can clearly see in the example code I gave you.

No, there isn't a more eficient way, and there is nothing inefficient about using conditional logic in the first place

Ok, sounds good. Thanks for all your help so far! :)
By raven - 11/5/2024

raven - 10/30/2024
Dave - 10/30/2024
raven - 10/30/2024
Dave - 10/29/2024
raven - 10/29/2024


Hi Dave,

Given the code below:
1. How can I make it so that when the response is "a" 3 or more times for both/either the a1 and a2 trials, both the a1 and a2 trials are skipped when that criterion is met. The same applies for the b1 and b2 trials. Despite the fact that the a2 trial's correct response is "b", and the b2 trial's correct response is "a"? So, essentially, regardless of the correct response for trials a1 and a2, the criterion should be based on the desired response, which is "a" for the a_trials, and "b" for the b_trials.

2. Is there a way to counterbalance for odd/even participant numbers using expt so that the desired responses are switched (e.g., for even numbered participants, the desired response for the a1 and a2 trials is now "b", and the desired response for the  b1 and b2 trials is now "a"?

<values>
/ num_a_trials_response_a = 0;
/ num_a1_correct = 0;
/ num_a2_correct = 0;

/ num_b_trials_response_b = 0;
/ num_b1_correct = 0;
/ num_b2_correct = 0;
</values>

<expt one>
/ blocks = [1=block.learning_block1]
/ subjects = (1 of 2)
</expt>

<expt two>
/ blocks = [1=block.learning_block2]
/ subjects = (2 of 2)
</expt>

<values>
/ a_learned = false
/ a1_learned = false
/ a2_learned = false

/ b_learned = false
/ b1_learned = false
/ b2_learned = false
</values>

<values>
/ a_trial_count = trial.a1_trial.trialcount + trial.a2_trial.trialcount
/ b_trial_count = trial.b1_trial.trialcount + trial.b2_trial.trialcount
</values>

<page blocksummary>
^Number of A trials in this block: <%values.a_trial_count%>
^Number of A trials in this block where 'A' was the response: <%???%>
^A desired response: <%values.a_learned%>

^Number of A1 trials in this block: <%trial.a1_trial.trialcount%>
^Number correct A1 trials in this block: <%trial.a1_trial.percentcorrect%>
^A1 learned: <%values.a1_learned%>

^Number of A2 trials in this block: <%trial.a2_trial.trialcount%>
^Number correct A2 trials in this block: <%trial.a2_trial.percentcorrect%>
^A2 learned: <%values.a2_learned%>

^Number of B trials in this block: <%values.b_trial_count%>
^Number of B trials in this block where 'A' was the response: <%???%>
^B desired response: <%values.b_learned%>

^Number of B1 trials in this block: <%trial.b1_trial.trialcount%>
^Number correct B1 trials in this block: <%trial.b1_trial.percentcorrect%>
^B1 learned: <%values.b1_learned%>

^Number of B2 trials in this block: <%trial.b2_trial.trialcount%>
^Number correct B2 trials in this block: <%trial.b2_trial.percentcorrect%>
^B2 learned: <%values.b2_learned%>
</page>


<block learning_block1>
/ postinstructions = (page.blocksummary)
/ onblockend = [
if (values.num_a_trials_response_a >= 3) {
values.a1_learned = true;
        values.a2_learned = true;
};
if (values.num_b_trials_response_b >= 3) {
values.b1_learned = true;
        values.b2_learned = true;
}
]
/ trials=[1-18=noreplace(trial.a1_trial, trial.a1_trial, trial.a2_trial, trial.b1_trial, trial.b2_trial, trial.b2_trial)]
/ branch = [
if (!values.a1_learned || !values.a2_learned || !values.b1_learned || !values.b2_learned) { // if either hasn't been learned, run another learning block
return block.learning_block;
}
]
</block>

<trial a1_trial>
/ skip = [
values.a1_learned;
]
/ ontrialend = [
values.num_a1_correct = trial.a1_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a1_trial_stimulus>
/ items = ("Stimulus A1")
/ hposition = 50%
</text>

<trial a2_trial>
/ skip = [
values.a2_learned;
]
/ ontrialend = [
values.num_a2_correct = trial.a2_trial.correctCount
]

/ stimulusframes = [1=clearscreen, a2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text a2_trial_stimulus>
/ items = ("Stimulus A2")
/ hposition = 50%
</text>

<trial b1_trial>
/ skip = [
values.b1_learned;
]

/ ontrialend = [
values.num_b1_correct = trial.b1_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b1_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("b")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b1_trial_stimulus>
/ items = ("Stimulus B1")
/ hposition = 50%
</text>

<trial b2_trial>
/ skip = [
values.b2_learned;
]

/ ontrialend = [
values.num_b2_correct = trial.b2_trial.correctCount
]
/ stimulusframes = [1=clearscreen, b2_trial_stimulus]
/ inputdevice = keyboard
/ validresponse = ("a", "b")
/ correctresponse = ("a")
/ branch = [
{
return trial.feedback_screen
}
]
</trial>

<text b2_trial_stimulus>
/ items = ("Stimulus B2")
/ hposition = 50%
</text>

<trial feedback_screen>
/ stimulustimes = [0=clearscreen; 50=feedback_screen; 100=num_a1_correct; 100=num_a2_correct; 200=num_b1_correct; 200=num_b2_correct]
/ timeout = 1500
</trial>

<text feedback_screen>
/ items = ("Feedback Screen")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 30%)
</text>

<text num_a1_correct>
/ items = ("Percentage Stimulus A1 Correct: <%values.num_a1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 40%)
</text>

<text num_a2_correct>
/ items = ("Percentage Stimulus A2 Correct: <%values.num_a2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 50%)
</text>

<text num_b1_correct>
/ items = ("Percentage Stimulus B1 Correct: <%values.num_b1_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 60%)
</text>

<text num_b2_correct>
/ items = ("Percentage Stimulus B2 Correct: <%values.num_b2_correct%>")
/ fontstyle = ("Courier", 18pt, true)
/ color = blue
/ size = (80%, 20%)
/ position = (50%, 70%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode stimulusitem stimulusitem response latency correct
values.num_a1_correct values.num_a2_correct values.num_b1_correct values.num_b2_correct trial.a1_trial.percentcorrect trial.a2_trial.percentcorrect trial.b1_trial.percentcorrect trial.b2_trial.percentcorrect
values.a1_learned, values.a2_learned, values.b1_learned values.b2_learned)
</data>


Thanks!

You count things up in variables and skip on that basis. As simple as that.

As for counterbalancing, parameterize the correct responses, define two expt elements, set the correct responses to the applicable values /onexptbegin respectively.


Thanks! Would it be a case of using an IF statement to count if the desired key was pressed in each trial, or is there a more efficient way to achieve this?

For example, if the desired response is "z" (scan code 44):

/ ontrialend = [
    if (trial.a_trial.response == 44) {
        values.num_a_correct += 1;
    }
    else {
        values.num_a_correct += 0;
    }
]



Yes, as you can clearly see in the example code I gave you.

No, there isn't a more eficient way, and there is nothing inefficient about using conditional logic in the first place

Ok, sounds good. Thanks for all your help so far! :)

Hi Dave,

Is it possible to have conditional statements within /skip?

For example, in the following code, I'd like the trial to be skipped if either the block_1 trial_a has been learned, or the block_2 trial_b has been learned:

/ skip = [
    block.block_1 && values.trial_a_criterion_learned;
    block.block_2 && values.trial_b_criterion_learned;
]



Thanks!
By Dave - 11/5/2024

/ skip = [
    if (script.currentblock == "block_1" && values.trial_a_criterion_learned) {
        return true;
    };
    if (script.currentblock == "block_2" && values.trial_b_criterion_learned) {
        return true;
    };
]

By raven - 11/6/2024

Dave - 11/5/2024
/ skip = [
    if (script.currentblock == "block_1" && values.trial_a_criterion_learned) {
        return true;
    };
    if (script.currentblock == "block_2" && values.trial_b_criterion_learned) {
        return true;
    };
]


Hi Dave, thanks for your reply.

I tried running the following code with three conditions, but when the first condition is met, it skips both the first and second conditions, and just keeps looping through trial_c instead.
/ skip = [
  if (script.currentblock == "block_1" && values.trial_a_criterion_learned) {
   return true;
  };
  if (script.currentblock == "block_2" && values.trial_b_criterion_learned) {
   return true;
  };
if (script.currentblock == "block_3" && values.trial_c_criterion_learned) {
 return true;
};
]


Any ideas?

By Dave - 11/6/2024

raven - 11/6/2024
Dave - 11/5/2024
/ skip = [
    if (script.currentblock == "block_1" && values.trial_a_criterion_learned) {
        return true;
    };
    if (script.currentblock == "block_2" && values.trial_b_criterion_learned) {
        return true;
    };
]


Hi Dave, thanks for your reply.

I tried running the following code with three conditions, but when the first condition is met, it skips both the first and second conditions, and just keeps looping through trial_c instead.
/ skip = [
  if (script.currentblock == "block_1" && values.trial_a_criterion_learned) {
   return true;
  };
  if (script.currentblock == "block_2" && values.trial_b_criterion_learned) {
   return true;
  };
if (script.currentblock == "block_3" && values.trial_c_criterion_learned) {
 return true;
};
]


Any ideas?


Post runnable code.
By raven - 11/7/2024

Dave - 11/6/2024
raven - 11/6/2024
Dave - 11/5/2024
/ skip = [
    if (script.currentblock == "block_1" && values.trial_a_criterion_learned) {
        return true;
    };
    if (script.currentblock == "block_2" && values.trial_b_criterion_learned) {
        return true;
    };
]


Hi Dave, thanks for your reply.

I tried running the following code with three conditions, but when the first condition is met, it skips both the first and second conditions, and just keeps looping through trial_c instead.
/ skip = [
  if (script.currentblock == "block_1" && values.trial_a_criterion_learned) {
   return true;
  };
  if (script.currentblock == "block_2" && values.trial_b_criterion_learned) {
   return true;
  };
if (script.currentblock == "block_3" && values.trial_c_criterion_learned) {
 return true;
};
]


Any ideas?


Post runnable code.

I managed to find a workaround.
Thanks!