Millisecond Forums

Ospan-modification help

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

By MilanSchoenmaeckers - 3/5/2020

Hi, 

I'm new to inquisit and trying to modify the regular Ospan-task from the millisecond library for my master's thesis.

https://www.millisecond.com/download/library/ospan/ -> this is the regular task. 

After answering whether the answer for a math problem is correct or incorrect, a letter appears on screen for the participant to memorize. For my task, I want to show the participant a picture of a light bulb above it. This light bulb will be either turned on in 20% of the trials or turned off in 80% of trials. 

These are the stimuli that I made:

<picture lightbulb_off>
/ items = ("lamp_uit.png")
/ position = (50, 30)
/ size = (20%, 20%)
</picture>

<picture lightbulb_on>
/ items = ("lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
</picture>

and this is the script that the regular task uses for the presentation of a letter:

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

Is there anyone who would want to offer me some help with this?

Thanks in advance. 
By Dave - 3/5/2020

MilanSchoenmaeckers - 3/5/2020
Hi, 

I'm new to inquisit and trying to modify the regular Ospan-task from the millisecond library for my master's thesis.

https://www.millisecond.com/download/library/ospan/ -> this is the regular task. 

After answering whether the answer for a math problem is correct or incorrect, a letter appears on screen for the participant to memorize. For my task, I want to show the participant a picture of a light bulb above it. This light bulb will be either turned on in 20% of the trials or turned off in 80% of trials. 

These are the stimuli that I made:

<picture lightbulb_off>
/ items = ("lamp_uit.png")
/ position = (50, 30)
/ size = (20%, 20%)
</picture>

<picture lightbulb_on>
/ items = ("lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
</picture>

and this is the script that the regular task uses for the presentation of a letter:

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

Is there anyone who would want to offer me some help with this?

Thanks in advance. 

Create a single <picture> element, have the two images -- lightbulb off and lightbulb on -- be the two items in in that <picture> element. Select the state (off/on) via a value.

<values>
/ lightbulb_state = 1
...
</values>

<picture lightbulb>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

Create a <list> with 80% the value for off (1), and 20% the value for on (2).

// work out how many trials there are and enter 1 and 2 in the appropriate amounts
<list lightbulbstates>
/ items = (1,1,1,1,1,...., 2,2,2,...)
</list>

Sample a value from that list at the start of the trial and display the lightbulb stimulus just like all the other stimuli in the trial.

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

Finally, log the lightbulb state to the data file by adding values.lightbulb_state to the <data> element's /columns.

By MilanSchoenmaeckers - 3/5/2020

Thank you for your fast reply!

However, to make it even more difficult, I made the trial_show_letter into two categories because there will be two blocks of trials called nonacting and acting. The difference between the two is that the frequency of the light bulb presented turned on/off differs between both conditions. In addition, for the acting trials participants need to press the spacebar each time they see the light bulb turned on. 

In regard to your reply, I made the following additions:

<values>
/ lightbulb_state = 1
</values>

<picture lightbulb_nonacting>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

<list lightbulbstates_nonacting>
/ items = (1,1,1,1,1,1,1,1,1,1,1,1,2,2,2)
</list>

<picture lightbulb_acting>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

<list lightbulbstates_acting>
/ items = (2,2,2,2,2,2,2,2,2,2,2,2,1,1,1)
</list>


I get the following errors for the following part of the script when I run the experiment:

1. Expression 'list.lightbulbstates.nextvalue' is invalid. Expression contains an unknown element or property name.
2. 'button28' is not a valid setting.


<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (button57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

I really appreciate the help!
By Dave - 3/5/2020

MilanSchoenmaeckers - 3/5/2020
Thank you for your fast reply!

However, to make it even more difficult, I made the trial_show_letter into two categories because there will be two blocks of trials called nonacting and acting. The difference between the two is that the frequency of the light bulb presented turned on/off differs between both conditions. In addition, for the acting trials participants need to press the spacebar each time they see the light bulb turned on. 

In regard to your reply, I made the following additions:

<values>
/ lightbulb_state = 1
</values>

<picture lightbulb_nonacting>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

<list lightbulbstates_nonacting>
/ items = (1,1,1,1,1,1,1,1,1,1,1,1,2,2,2)
</list>

<picture lightbulb_acting>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

<list lightbulbstates_acting>
/ items = (2,2,2,2,2,2,2,2,2,2,2,2,1,1,1)
</list>


I get the following errors for the following part of the script when I run the experiment:

1. Expression 'list.lightbulbstates.nextvalue' is invalid. Expression contains an unknown element or property name.
2. 'button28' is not a valid setting.


<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (button57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

I really appreciate the help!

The approach is exactly the same. You just need to sample from the <list>s you actually defined, not a <list> that doesn't actually exist.

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
...
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
...
</trial>

and if you want to define the space bar as response, you need to set the acting trial's /inputdevice to keyboard and define the space bar as response properly.

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>
By MilanSchoenmaeckers - 3/5/2020

Thanks again for your fast reply. 

The script does not contain anymore errors. However, when I run it with the test-monkey, no additions that I made from your input are shown. The practice trials work perfectly fine, but the actual trials are neverending and do not show the recall-grid anymore after the amount of letters have been shown in correspondence with their set size. 

This is the script of the blocks and the experiment:

<block PracLetter>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=white; text.MathScore.textcolor=white; values.stopblock=0]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block PracMath>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [values.mathaccuracy=0]
/ onblockend = [values.mathtimeout=(2.5*trial.prac_show_math.totalsdlatency)+trial.prac_show_math.totalmeanlatency]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=prac_show_math]
</block>

<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_NonActing>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<expt AOSPAN>
/ onexptbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ blocks = [1=InstrPracLetter; 2=PracLetter; 3=InstrPracMath; 4=PracMath;
    5=InstrPracBoth; 6=PracBoth; 7=InstrTestBoth; 8=TestBoth_NonActing; 9=TestBoth_Acting; 10=InstrFinal]
/onexptend = [values.completed = 1]
</expt>

And this is the script for the trials:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="TestBoth" && list.TestBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>


<trial prac_show_math>
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathProblem, PracMathPrompt]
/ validresponse = (lbuttondown)
/ branch = [trial.prac_solve_math]
/ recorddata = true
</trial>

<trial prac_solve_math>
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathAnswer, TRUE, FALSE]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (list.PracMathCorrect.nextvalue)
/ responsemessage = (anyresponse, PracMathAnswer, 800)
/ correctmessage = true(correcttext, 800)
/ errormessage = true(incorrecttext, 800)
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]
/ recorddata = true
</trial>

<trial prac_math_feedback>
/ ontrialend = [values.stopblock=1]
/ pretrialpause = 500
/ stimulusframes = [1=WhiteScreen, PracMathFeedback]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>

<trial InitMathProblem01>
/ ontrialbegin = [values.tmp_initmath01+=1]
/ ontrialbegin = [if(values.tmp_initmath01==1)
    {values.tmp_mathopt01=list.MathOpt01.nextvalue;
    values.tmp_mathsign=list.MathSign.nextvalue;
    values.tmp_mathopt02=list.MathOpt02.nextvalue;
    values.mathcorrect=list.MathCorrect.nextvalue;
    values.tmp_mathopt02sign=concat(values.tmp_mathsign, values.tmp_mathopt02);
    values.tmp_mathopt02sign=evaluate(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1)
    {values.tmp_mathopt02sign+=3;
    values.tmp_mathopt02=abs(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1 && values.tmp_mathopt02sign>0)
    values.tmp_mathsign="+"]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem);
    values.mathtrueanswer=values.mathanswer]
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial InitMathProblem02>
/ ontrialbegin = [values.tmp_initmath02+=1]
/ ontrialbegin = [if(values.tmp_initmath02==1)values.tmp_mathrand=list.MathRand.nextvalue]
/ ontrialbegin = [if(values.tmp_initmath02>1)values.tmp_mathrand+=2]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem)+values.tmp_mathrand]
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
    values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
    {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
    {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

All help is appreciated :)
By Dave - 3/5/2020

MilanSchoenmaeckers - 3/5/2020
Thanks again for your fast reply. 

The script does not contain anymore errors. However, when I run it with the test-monkey, no additions that I made from your input are shown. The practice trials work perfectly fine, but the actual trials are neverending and do not show the recall-grid anymore after the amount of letters have been shown in correspondence with their set size. 

This is the script of the blocks and the experiment:

<block PracLetter>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=white; text.MathScore.textcolor=white; values.stopblock=0]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block PracMath>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [values.mathaccuracy=0]
/ onblockend = [values.mathtimeout=(2.5*trial.prac_show_math.totalsdlatency)+trial.prac_show_math.totalmeanlatency]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=prac_show_math]
</block>

<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_NonActing>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<expt AOSPAN>
/ onexptbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ blocks = [1=InstrPracLetter; 2=PracLetter; 3=InstrPracMath; 4=PracMath;
    5=InstrPracBoth; 6=PracBoth; 7=InstrTestBoth; 8=TestBoth_NonActing; 9=TestBoth_Acting; 10=InstrFinal]
/onexptend = [values.completed = 1]
</expt>

And this is the script for the trials:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="TestBoth" && list.TestBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>


<trial prac_show_math>
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathProblem, PracMathPrompt]
/ validresponse = (lbuttondown)
/ branch = [trial.prac_solve_math]
/ recorddata = true
</trial>

<trial prac_solve_math>
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathAnswer, TRUE, FALSE]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (list.PracMathCorrect.nextvalue)
/ responsemessage = (anyresponse, PracMathAnswer, 800)
/ correctmessage = true(correcttext, 800)
/ errormessage = true(incorrecttext, 800)
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]
/ recorddata = true
</trial>

<trial prac_math_feedback>
/ ontrialend = [values.stopblock=1]
/ pretrialpause = 500
/ stimulusframes = [1=WhiteScreen, PracMathFeedback]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>

<trial InitMathProblem01>
/ ontrialbegin = [values.tmp_initmath01+=1]
/ ontrialbegin = [if(values.tmp_initmath01==1)
    {values.tmp_mathopt01=list.MathOpt01.nextvalue;
    values.tmp_mathsign=list.MathSign.nextvalue;
    values.tmp_mathopt02=list.MathOpt02.nextvalue;
    values.mathcorrect=list.MathCorrect.nextvalue;
    values.tmp_mathopt02sign=concat(values.tmp_mathsign, values.tmp_mathopt02);
    values.tmp_mathopt02sign=evaluate(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1)
    {values.tmp_mathopt02sign+=3;
    values.tmp_mathopt02=abs(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1 && values.tmp_mathopt02sign>0)
    values.tmp_mathsign="+"]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem);
    values.mathtrueanswer=values.mathanswer]
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial InitMathProblem02>
/ ontrialbegin = [values.tmp_initmath02+=1]
/ ontrialbegin = [if(values.tmp_initmath02==1)values.tmp_mathrand=list.MathRand.nextvalue]
/ ontrialbegin = [if(values.tmp_initmath02>1)values.tmp_mathrand+=2]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem)+values.tmp_mathrand]
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
    values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
    {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
    {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

All help is appreciated :)

You're *not* running the modified trials, you're running the regular, old, unmodified show_letter trial.

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
  values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
  {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
  {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>
By Dave - 3/5/2020

Dave - 3/5/2020
MilanSchoenmaeckers - 3/5/2020
Thanks again for your fast reply. 

The script does not contain anymore errors. However, when I run it with the test-monkey, no additions that I made from your input are shown. The practice trials work perfectly fine, but the actual trials are neverending and do not show the recall-grid anymore after the amount of letters have been shown in correspondence with their set size. 

This is the script of the blocks and the experiment:

<block PracLetter>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=white; text.MathScore.textcolor=white; values.stopblock=0]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block PracMath>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [values.mathaccuracy=0]
/ onblockend = [values.mathtimeout=(2.5*trial.prac_show_math.totalsdlatency)+trial.prac_show_math.totalmeanlatency]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=prac_show_math]
</block>

<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_NonActing>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<expt AOSPAN>
/ onexptbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ blocks = [1=InstrPracLetter; 2=PracLetter; 3=InstrPracMath; 4=PracMath;
    5=InstrPracBoth; 6=PracBoth; 7=InstrTestBoth; 8=TestBoth_NonActing; 9=TestBoth_Acting; 10=InstrFinal]
/onexptend = [values.completed = 1]
</expt>

And this is the script for the trials:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="TestBoth" && list.TestBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>


<trial prac_show_math>
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathProblem, PracMathPrompt]
/ validresponse = (lbuttondown)
/ branch = [trial.prac_solve_math]
/ recorddata = true
</trial>

<trial prac_solve_math>
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathAnswer, TRUE, FALSE]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (list.PracMathCorrect.nextvalue)
/ responsemessage = (anyresponse, PracMathAnswer, 800)
/ correctmessage = true(correcttext, 800)
/ errormessage = true(incorrecttext, 800)
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]
/ recorddata = true
</trial>

<trial prac_math_feedback>
/ ontrialend = [values.stopblock=1]
/ pretrialpause = 500
/ stimulusframes = [1=WhiteScreen, PracMathFeedback]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>

<trial InitMathProblem01>
/ ontrialbegin = [values.tmp_initmath01+=1]
/ ontrialbegin = [if(values.tmp_initmath01==1)
    {values.tmp_mathopt01=list.MathOpt01.nextvalue;
    values.tmp_mathsign=list.MathSign.nextvalue;
    values.tmp_mathopt02=list.MathOpt02.nextvalue;
    values.mathcorrect=list.MathCorrect.nextvalue;
    values.tmp_mathopt02sign=concat(values.tmp_mathsign, values.tmp_mathopt02);
    values.tmp_mathopt02sign=evaluate(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1)
    {values.tmp_mathopt02sign+=3;
    values.tmp_mathopt02=abs(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1 && values.tmp_mathopt02sign>0)
    values.tmp_mathsign="+"]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem);
    values.mathtrueanswer=values.mathanswer]
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial InitMathProblem02>
/ ontrialbegin = [values.tmp_initmath02+=1]
/ ontrialbegin = [if(values.tmp_initmath02==1)values.tmp_mathrand=list.MathRand.nextvalue]
/ ontrialbegin = [if(values.tmp_initmath02>1)values.tmp_mathrand+=2]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem)+values.tmp_mathrand]
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
    values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
    {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
    {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

All help is appreciated :)

You're *not* running the modified trials, you're running the regular, old, unmodified show_letter trial.

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
  values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
  {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
  {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

Perhaps it would be worthwhile to take a step back; take the original, unmodified OSPAN script and work through it until you sufficiently understand how it works. Only then proceed to make further modifications
By MilanSchoenmaeckers - 3/5/2020

Dave - 3/5/2020
Dave - 3/5/2020
MilanSchoenmaeckers - 3/5/2020
Thanks again for your fast reply. 

The script does not contain anymore errors. However, when I run it with the test-monkey, no additions that I made from your input are shown. The practice trials work perfectly fine, but the actual trials are neverending and do not show the recall-grid anymore after the amount of letters have been shown in correspondence with their set size. 

This is the script of the blocks and the experiment:

<block PracLetter>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=white; text.MathScore.textcolor=white; values.stopblock=0]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block PracMath>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [values.mathaccuracy=0]
/ onblockend = [values.mathtimeout=(2.5*trial.prac_show_math.totalsdlatency)+trial.prac_show_math.totalmeanlatency]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=prac_show_math]
</block>

<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_NonActing>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<expt AOSPAN>
/ onexptbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ blocks = [1=InstrPracLetter; 2=PracLetter; 3=InstrPracMath; 4=PracMath;
    5=InstrPracBoth; 6=PracBoth; 7=InstrTestBoth; 8=TestBoth_NonActing; 9=TestBoth_Acting; 10=InstrFinal]
/onexptend = [values.completed = 1]
</expt>

And this is the script for the trials:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="TestBoth" && list.TestBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>


<trial prac_show_math>
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathProblem, PracMathPrompt]
/ validresponse = (lbuttondown)
/ branch = [trial.prac_solve_math]
/ recorddata = true
</trial>

<trial prac_solve_math>
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathAnswer, TRUE, FALSE]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (list.PracMathCorrect.nextvalue)
/ responsemessage = (anyresponse, PracMathAnswer, 800)
/ correctmessage = true(correcttext, 800)
/ errormessage = true(incorrecttext, 800)
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]
/ recorddata = true
</trial>

<trial prac_math_feedback>
/ ontrialend = [values.stopblock=1]
/ pretrialpause = 500
/ stimulusframes = [1=WhiteScreen, PracMathFeedback]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>

<trial InitMathProblem01>
/ ontrialbegin = [values.tmp_initmath01+=1]
/ ontrialbegin = [if(values.tmp_initmath01==1)
    {values.tmp_mathopt01=list.MathOpt01.nextvalue;
    values.tmp_mathsign=list.MathSign.nextvalue;
    values.tmp_mathopt02=list.MathOpt02.nextvalue;
    values.mathcorrect=list.MathCorrect.nextvalue;
    values.tmp_mathopt02sign=concat(values.tmp_mathsign, values.tmp_mathopt02);
    values.tmp_mathopt02sign=evaluate(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1)
    {values.tmp_mathopt02sign+=3;
    values.tmp_mathopt02=abs(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1 && values.tmp_mathopt02sign>0)
    values.tmp_mathsign="+"]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem);
    values.mathtrueanswer=values.mathanswer]
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial InitMathProblem02>
/ ontrialbegin = [values.tmp_initmath02+=1]
/ ontrialbegin = [if(values.tmp_initmath02==1)values.tmp_mathrand=list.MathRand.nextvalue]
/ ontrialbegin = [if(values.tmp_initmath02>1)values.tmp_mathrand+=2]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem)+values.tmp_mathrand]
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
    values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
    {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
    {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

All help is appreciated :)

You're *not* running the modified trials, you're running the regular, old, unmodified show_letter trial.

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
  values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
  {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
  {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

Perhaps it would be worthwhile to take a step back; take the original, unmodified OSPAN script and work through it until you sufficiently understand how it works. Only then proceed to make further modifications

Thank you for replying and your hel. I will first take a step back and work through that script before posting any further questions. 
By Dave - 3/5/2020

MilanSchoenmaeckers - 3/5/2020
Dave - 3/5/2020
Dave - 3/5/2020
MilanSchoenmaeckers - 3/5/2020
Thanks again for your fast reply. 

The script does not contain anymore errors. However, when I run it with the test-monkey, no additions that I made from your input are shown. The practice trials work perfectly fine, but the actual trials are neverending and do not show the recall-grid anymore after the amount of letters have been shown in correspondence with their set size. 

This is the script of the blocks and the experiment:

<block PracLetter>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=white; text.MathScore.textcolor=white; values.stopblock=0]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block PracMath>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [values.mathaccuracy=0]
/ onblockend = [values.mathtimeout=(2.5*trial.prac_show_math.totalsdlatency)+trial.prac_show_math.totalmeanlatency]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=prac_show_math]
</block>

<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_NonActing>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<expt AOSPAN>
/ onexptbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ blocks = [1=InstrPracLetter; 2=PracLetter; 3=InstrPracMath; 4=PracMath;
    5=InstrPracBoth; 6=PracBoth; 7=InstrTestBoth; 8=TestBoth_NonActing; 9=TestBoth_Acting; 10=InstrFinal]
/onexptend = [values.completed = 1]
</expt>

And this is the script for the trials:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="TestBoth" && list.TestBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>


<trial prac_show_math>
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathProblem, PracMathPrompt]
/ validresponse = (lbuttondown)
/ branch = [trial.prac_solve_math]
/ recorddata = true
</trial>

<trial prac_solve_math>
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathAnswer, TRUE, FALSE]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (list.PracMathCorrect.nextvalue)
/ responsemessage = (anyresponse, PracMathAnswer, 800)
/ correctmessage = true(correcttext, 800)
/ errormessage = true(incorrecttext, 800)
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]
/ recorddata = true
</trial>

<trial prac_math_feedback>
/ ontrialend = [values.stopblock=1]
/ pretrialpause = 500
/ stimulusframes = [1=WhiteScreen, PracMathFeedback]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>

<trial InitMathProblem01>
/ ontrialbegin = [values.tmp_initmath01+=1]
/ ontrialbegin = [if(values.tmp_initmath01==1)
    {values.tmp_mathopt01=list.MathOpt01.nextvalue;
    values.tmp_mathsign=list.MathSign.nextvalue;
    values.tmp_mathopt02=list.MathOpt02.nextvalue;
    values.mathcorrect=list.MathCorrect.nextvalue;
    values.tmp_mathopt02sign=concat(values.tmp_mathsign, values.tmp_mathopt02);
    values.tmp_mathopt02sign=evaluate(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1)
    {values.tmp_mathopt02sign+=3;
    values.tmp_mathopt02=abs(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1 && values.tmp_mathopt02sign>0)
    values.tmp_mathsign="+"]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem);
    values.mathtrueanswer=values.mathanswer]
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial InitMathProblem02>
/ ontrialbegin = [values.tmp_initmath02+=1]
/ ontrialbegin = [if(values.tmp_initmath02==1)values.tmp_mathrand=list.MathRand.nextvalue]
/ ontrialbegin = [if(values.tmp_initmath02>1)values.tmp_mathrand+=2]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem)+values.tmp_mathrand]
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
    values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
    {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
    {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

All help is appreciated :)

You're *not* running the modified trials, you're running the regular, old, unmodified show_letter trial.

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
  values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
  {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
  {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

Perhaps it would be worthwhile to take a step back; take the original, unmodified OSPAN script and work through it until you sufficiently understand how it works. Only then proceed to make further modifications

Thank you for replying and your hel. I will first take a step back and work through that script before posting any further questions. 

If you're not sure about parts of the script, i.e. what they do / how they work, let me know here and I'll try to explain. Then, as the second step, I'd suggest you implement your nonacting condition first, because it does not require many major modifications compared to the original. Once you have that running, extend things to include the acting condition.
By MilanSchoenmaeckers - 3/6/2020

Dave - 3/5/2020
MilanSchoenmaeckers - 3/5/2020
Dave - 3/5/2020
Dave - 3/5/2020
MilanSchoenmaeckers - 3/5/2020
Thanks again for your fast reply. 

The script does not contain anymore errors. However, when I run it with the test-monkey, no additions that I made from your input are shown. The practice trials work perfectly fine, but the actual trials are neverending and do not show the recall-grid anymore after the amount of letters have been shown in correspondence with their set size. 

This is the script of the blocks and the experiment:

<block PracLetter>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=white; text.MathScore.textcolor=white; values.stopblock=0]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block PracMath>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [values.mathaccuracy=0]
/ onblockend = [values.mathtimeout=(2.5*trial.prac_show_math.totalsdlatency)+trial.prac_show_math.totalmeanlatency]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=prac_show_math]
</block>

<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_NonActing>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<expt AOSPAN>
/ onexptbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ blocks = [1=InstrPracLetter; 2=PracLetter; 3=InstrPracMath; 4=PracMath;
    5=InstrPracBoth; 6=PracBoth; 7=InstrTestBoth; 8=TestBoth_NonActing; 9=TestBoth_Acting; 10=InstrFinal]
/onexptend = [values.completed = 1]
</expt>

And this is the script for the trials:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="TestBoth" && list.TestBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>


<trial prac_show_math>
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathProblem, PracMathPrompt]
/ validresponse = (lbuttondown)
/ branch = [trial.prac_solve_math]
/ recorddata = true
</trial>

<trial prac_solve_math>
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathAnswer, TRUE, FALSE]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (list.PracMathCorrect.nextvalue)
/ responsemessage = (anyresponse, PracMathAnswer, 800)
/ correctmessage = true(correcttext, 800)
/ errormessage = true(incorrecttext, 800)
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]
/ recorddata = true
</trial>

<trial prac_math_feedback>
/ ontrialend = [values.stopblock=1]
/ pretrialpause = 500
/ stimulusframes = [1=WhiteScreen, PracMathFeedback]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>

<trial InitMathProblem01>
/ ontrialbegin = [values.tmp_initmath01+=1]
/ ontrialbegin = [if(values.tmp_initmath01==1)
    {values.tmp_mathopt01=list.MathOpt01.nextvalue;
    values.tmp_mathsign=list.MathSign.nextvalue;
    values.tmp_mathopt02=list.MathOpt02.nextvalue;
    values.mathcorrect=list.MathCorrect.nextvalue;
    values.tmp_mathopt02sign=concat(values.tmp_mathsign, values.tmp_mathopt02);
    values.tmp_mathopt02sign=evaluate(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1)
    {values.tmp_mathopt02sign+=3;
    values.tmp_mathopt02=abs(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1 && values.tmp_mathopt02sign>0)
    values.tmp_mathsign="+"]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem);
    values.mathtrueanswer=values.mathanswer]
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial InitMathProblem02>
/ ontrialbegin = [values.tmp_initmath02+=1]
/ ontrialbegin = [if(values.tmp_initmath02==1)values.tmp_mathrand=list.MathRand.nextvalue]
/ ontrialbegin = [if(values.tmp_initmath02>1)values.tmp_mathrand+=2]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem)+values.tmp_mathrand]
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
    values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
    {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
    {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

All help is appreciated :)

You're *not* running the modified trials, you're running the regular, old, unmodified show_letter trial.

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
  values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
  {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
  {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

Perhaps it would be worthwhile to take a step back; take the original, unmodified OSPAN script and work through it until you sufficiently understand how it works. Only then proceed to make further modifications

Thank you for replying and your hel. I will first take a step back and work through that script before posting any further questions. 

If you're not sure about parts of the script, i.e. what they do / how they work, let me know here and I'll try to explain. Then, as the second step, I'd suggest you implement your nonacting condition first, because it does not require many major modifications compared to the original. Once you have that running, extend things to include the acting condition.

Hi,

I think that I found the error that is causing me troubles with running the modified trials. The script is as followed:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

So this trial (/ trials = [1=InitSetSize]) is used in every block. Do I need to create two more lines of "/ ontrialbegin = " to incorporate the script below for the implementation of  my own modifications in the initial trial?

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_acting else trial.InitMathProblem01]
/ recorddata = true
</trial>

Again, thanks in advance for any input!
By Dave - 3/6/2020

MilanSchoenmaeckers - 3/6/2020
Dave - 3/5/2020
MilanSchoenmaeckers - 3/5/2020
Dave - 3/5/2020
Dave - 3/5/2020
MilanSchoenmaeckers - 3/5/2020
Thanks again for your fast reply. 

The script does not contain anymore errors. However, when I run it with the test-monkey, no additions that I made from your input are shown. The practice trials work perfectly fine, but the actual trials are neverending and do not show the recall-grid anymore after the amount of letters have been shown in correspondence with their set size. 

This is the script of the blocks and the experiment:

<block PracLetter>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=white; text.MathScore.textcolor=white; values.stopblock=0]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block PracMath>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [values.mathaccuracy=0]
/ onblockend = [values.mathtimeout=(2.5*trial.prac_show_math.totalsdlatency)+trial.prac_show_math.totalmeanlatency]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=prac_show_math]
</block>

<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_NonActing>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block TestBoth_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<expt AOSPAN>
/ onexptbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ blocks = [1=InstrPracLetter; 2=PracLetter; 3=InstrPracMath; 4=PracMath;
    5=InstrPracBoth; 6=PracBoth; 7=InstrTestBoth; 8=TestBoth_NonActing; 9=TestBoth_Acting; 10=InstrFinal]
/onexptend = [values.completed = 1]
</expt>

And this is the script for the trials:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="TestBoth" && list.TestBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>


<trial prac_show_math>
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathProblem, PracMathPrompt]
/ validresponse = (lbuttondown)
/ branch = [trial.prac_solve_math]
/ recorddata = true
</trial>

<trial prac_solve_math>
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathAnswer, TRUE, FALSE]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (list.PracMathCorrect.nextvalue)
/ responsemessage = (anyresponse, PracMathAnswer, 800)
/ correctmessage = true(correcttext, 800)
/ errormessage = true(incorrecttext, 800)
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]
/ recorddata = true
</trial>

<trial prac_math_feedback>
/ ontrialend = [values.stopblock=1]
/ pretrialpause = 500
/ stimulusframes = [1=WhiteScreen, PracMathFeedback]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>

<trial InitMathProblem01>
/ ontrialbegin = [values.tmp_initmath01+=1]
/ ontrialbegin = [if(values.tmp_initmath01==1)
    {values.tmp_mathopt01=list.MathOpt01.nextvalue;
    values.tmp_mathsign=list.MathSign.nextvalue;
    values.tmp_mathopt02=list.MathOpt02.nextvalue;
    values.mathcorrect=list.MathCorrect.nextvalue;
    values.tmp_mathopt02sign=concat(values.tmp_mathsign, values.tmp_mathopt02);
    values.tmp_mathopt02sign=evaluate(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1)
    {values.tmp_mathopt02sign+=3;
    values.tmp_mathopt02=abs(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1 && values.tmp_mathopt02sign>0)
    values.tmp_mathsign="+"]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem);
    values.mathtrueanswer=values.mathanswer]
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial InitMathProblem02>
/ ontrialbegin = [values.tmp_initmath02+=1]
/ ontrialbegin = [if(values.tmp_initmath02==1)values.tmp_mathrand=list.MathRand.nextvalue]
/ ontrialbegin = [if(values.tmp_initmath02>1)values.tmp_mathrand+=2]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem)+values.tmp_mathrand]
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
    values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
    {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
    {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

All help is appreciated :)

You're *not* running the modified trials, you're running the regular, old, unmodified show_letter trial.

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
  values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
  {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
  {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter]
/ recorddata = true
</trial>

Perhaps it would be worthwhile to take a step back; take the original, unmodified OSPAN script and work through it until you sufficiently understand how it works. Only then proceed to make further modifications

Thank you for replying and your hel. I will first take a step back and work through that script before posting any further questions. 

If you're not sure about parts of the script, i.e. what they do / how they work, let me know here and I'll try to explain. Then, as the second step, I'd suggest you implement your nonacting condition first, because it does not require many major modifications compared to the original. Once you have that running, extend things to include the acting condition.

Hi,

I think that I found the error that is causing me troubles with running the modified trials. The script is as followed:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

So this trial (/ trials = [1=InitSetSize]) is used in every block. Do I need to create two more lines of "/ ontrialbegin = " to incorporate the script below for the implementation of  my own modifications in the initial trial?

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_acting else trial.InitMathProblem01]
/ recorddata = true
</trial>

Again, thanks in advance for any input!

The init trial sets up the set size for the following "round" in the task, i.e. the amount of letters shown. This happens depending on the block name / the block we're currently in, as you can see here:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
  values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
  {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
  {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
  {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
...
</trial>

If you re-named any of the blocks or added differently named blocks, you need to extend or adjust the /ontrialbegin logic accordingly. The init trial also determines what trial then to run next depending on what the current block is per its /branch attribute:

/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]

I.e. if we're in the letter only practice block, it goes to <trial show_letter>, otherwise it goes to <trial InitMathProblem01>. That should make clear that the init trial has nothing to do with invoking your show_letter_nonacting or show_letter_acting trials. That only happens later and has to be done by other trials. Read through the script and focus on the /branch attributes to see the flow, i.e. which trial invokes what other trial after depending on what's currently going on (i.e. the block we're in, whether there are still letters to show in the current round, etc.).
By MilanSchoenmaeckers - 3/9/2020

Hi,

I encountered the following problem. First, when the picture of the lightbulb is shown on screen, the white background of the image stays onscreen whilst the next screen is loaded. Does this have to do with the picture itself or that I made a mistake in the script?

Lightbulb script:
<picture lightbulb_nonacting>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

Second, there seems to be going something wrong in my blocks. From the practice_both block onwards, the math problem is shown, followed by the possible answer that the participant has to give, and then the letter for later recall is shown with the picture of the light bulb. This is how the experiment should look like. However, this sequence is only followed for the first math-answer-letter combination, as the second combination only follows the sequence math-letter.

answer script:
<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
    {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]
/ recorddata = true
</trial>

math script:
<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
    values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
    {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

letter script:
<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>

Kind regards
By Dave - 3/9/2020

MilanSchoenmaeckers - 3/9/2020
Hi,

I encountered the following problem. First, when the picture of the lightbulb is shown on screen, the white background of the image stays onscreen whilst the next screen is loaded. Does this have to do with the picture itself or that I made a mistake in the script?

Lightbulb script:
<picture lightbulb_nonacting>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

Second, there seems to be going something wrong in my blocks. From the practice_both block onwards, the math problem is shown, followed by the possible answer that the participant has to give, and then the letter for later recall is shown with the picture of the light bulb. This is how the experiment should look like. However, this sequence is only followed for the first math-answer-letter combination, as the second combination only follows the sequence math-letter.

answer script:
<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
    {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]
/ recorddata = true
</trial>

math script:
<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
    values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
    {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter else trial.solve_math]
/ recorddata = true
</trial>

letter script:
<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>

Kind regards

> the white background of the image stays onscreen whilst the next screen is loaded. Does this have to do with the picture itself or that I made a mistake in the script?

The <picture> element is set to erase at the end of the trial, so that is where the white rectangle comes from.

As to your second question, the code you posted is too incomplete to say anything about it.
By MilanSchoenmaeckers - 3/9/2020

Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.
By Dave - 3/9/2020

MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.
By MilanSchoenmaeckers - 3/9/2020

Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!
By Dave - 3/9/2020

MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.
By MilanSchoenmaeckers - 3/12/2020

Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!
By Dave - 3/12/2020

MilanSchoenmaeckers - 3/12/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!

The init trial samples the set size (number of letters to be shown) for the upcoming round from a list and stores the result in values.currentsetsize.

The /branch then invokes the recall trial

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]

when as many letters (counted in values.lettercount) have been shown as there were supposed to be in the given round, i.e. when the letter count is equal to the set size.

In your modfied trials/blocks, you've evidently broken this logic. I.e. you're either not setting values.currentsetsize correctly, or you're not incrementing values.lettercount correctly, or both.
By MilanSchoenmaeckers - 3/12/2020

Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!

The init trial samples the set size (number of letters to be shown) for the upcoming round from a list and stores the result in values.currentsetsize.

The /branch then invokes the recall trial

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]

when as many letters (counted in values.lettercount) have been shown as there were supposed to be in the given round, i.e. when the letter count is equal to the set size.

In your modfied trials/blocks, you've evidently broken this logic. I.e. you're either not setting values.currentsetsize correctly, or you're not incrementing values.lettercount correctly, or both.

I see. So can I ask you where I should set or increment these values? Do I need to make another values. item or a list?
By Dave - 3/12/2020

MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!

The init trial samples the set size (number of letters to be shown) for the upcoming round from a list and stores the result in values.currentsetsize.

The /branch then invokes the recall trial

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]

when as many letters (counted in values.lettercount) have been shown as there were supposed to be in the given round, i.e. when the letter count is equal to the set size.

In your modfied trials/blocks, you've evidently broken this logic. I.e. you're either not setting values.currentsetsize correctly, or you're not incrementing values.lettercount correctly, or both.

I see. So can I ask you where I should set or increment these values? Do I need to make another values. item or a list?

You can see how/where they're incremented in the original script.
By Dave - 3/12/2020

Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!

The init trial samples the set size (number of letters to be shown) for the upcoming round from a list and stores the result in values.currentsetsize.

The /branch then invokes the recall trial

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]

when as many letters (counted in values.lettercount) have been shown as there were supposed to be in the given round, i.e. when the letter count is equal to the set size.

In your modfied trials/blocks, you've evidently broken this logic. I.e. you're either not setting values.currentsetsize correctly, or you're not incrementing values.lettercount correctly, or both.

I see. So can I ask you where I should set or increment these values? Do I need to make another values. item or a list?

You can see how/where they're incremented in the original script.

This is the original init trial:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]

/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

The  bolded parts is where values.currentsetsize is set. Depending on the block the trial finds itself in, the value is sampled from different lists. Again, if you've added or re-named blocks, you need to adjust and extend that logic accordingly.

values.lettercount is incremented by trial.show_letter.

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>
By MilanSchoenmaeckers - 3/12/2020

Dave - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!

The init trial samples the set size (number of letters to be shown) for the upcoming round from a list and stores the result in values.currentsetsize.

The /branch then invokes the recall trial

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]

when as many letters (counted in values.lettercount) have been shown as there were supposed to be in the given round, i.e. when the letter count is equal to the set size.

In your modfied trials/blocks, you've evidently broken this logic. I.e. you're either not setting values.currentsetsize correctly, or you're not incrementing values.lettercount correctly, or both.

I see. So can I ask you where I should set or increment these values? Do I need to make another values. item or a list?

You can see how/where they're incremented in the original script.

This is the original init trial:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]

/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

The  bolded parts is where values.currentsetsize is set. Depending on the block the trial finds itself in, the value is sampled from different lists. Again, if you've added or re-named blocks, you need to adjust and extend that logic accordingly.

values.lettercount is incremented by trial.show_letter.

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

I might be stupid, but I renamed the logic according to my re-named blocks.

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_NonActing")
    {values.currentsetsize=list.Non_ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_Acting")
    {values.currentsetsize=list.ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

I made both a Non_Acting_SetSize and Acting_SetSize list instead of the TestBothSetSize, so that shouldn't be the problem either right?

<list Non_ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

<list ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

I copied the script from the trial show_letter and adjusted the stimulusframes to incorporate my lightbulb stimuli. So the trial show_letter is now simply the show_letter_nonacting trial. 

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>

By Dave - 3/12/2020

MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!

The init trial samples the set size (number of letters to be shown) for the upcoming round from a list and stores the result in values.currentsetsize.

The /branch then invokes the recall trial

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]

when as many letters (counted in values.lettercount) have been shown as there were supposed to be in the given round, i.e. when the letter count is equal to the set size.

In your modfied trials/blocks, you've evidently broken this logic. I.e. you're either not setting values.currentsetsize correctly, or you're not incrementing values.lettercount correctly, or both.

I see. So can I ask you where I should set or increment these values? Do I need to make another values. item or a list?

You can see how/where they're incremented in the original script.

This is the original init trial:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]

/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

The  bolded parts is where values.currentsetsize is set. Depending on the block the trial finds itself in, the value is sampled from different lists. Again, if you've added or re-named blocks, you need to adjust and extend that logic accordingly.

values.lettercount is incremented by trial.show_letter.

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

I might be stupid, but I renamed the logic according to my re-named blocks.

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_NonActing")
    {values.currentsetsize=list.Non_ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_Acting")
    {values.currentsetsize=list.ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

I made both a Non_Acting_SetSize and Acting_SetSize list instead of the TestBothSetSize, so that shouldn't be the problem either right?

<list Non_ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

<list ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

I copied the script from the trial show_letter and adjusted the stimulusframes to incorporate my lightbulb stimuli. So the trial show_letter is now simply the show_letter_nonacting trial. 

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>


But are you actually running the show_letter_nonacting trial in the relevant block or are you running the regular show_letter trial? Again, check your /branch logic.
By MilanSchoenmaeckers - 3/12/2020

Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!

The init trial samples the set size (number of letters to be shown) for the upcoming round from a list and stores the result in values.currentsetsize.

The /branch then invokes the recall trial

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]

when as many letters (counted in values.lettercount) have been shown as there were supposed to be in the given round, i.e. when the letter count is equal to the set size.

In your modfied trials/blocks, you've evidently broken this logic. I.e. you're either not setting values.currentsetsize correctly, or you're not incrementing values.lettercount correctly, or both.

I see. So can I ask you where I should set or increment these values? Do I need to make another values. item or a list?

You can see how/where they're incremented in the original script.

This is the original init trial:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]

/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

The  bolded parts is where values.currentsetsize is set. Depending on the block the trial finds itself in, the value is sampled from different lists. Again, if you've added or re-named blocks, you need to adjust and extend that logic accordingly.

values.lettercount is incremented by trial.show_letter.

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

I might be stupid, but I renamed the logic according to my re-named blocks.

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_NonActing")
    {values.currentsetsize=list.Non_ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_Acting")
    {values.currentsetsize=list.ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

I made both a Non_Acting_SetSize and Acting_SetSize list instead of the TestBothSetSize, so that shouldn't be the problem either right?

<list Non_ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

<list ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

I copied the script from the trial show_letter and adjusted the stimulusframes to incorporate my lightbulb stimuli. So the trial show_letter is now simply the show_letter_nonacting trial. 

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>


But are you actually running the show_letter_nonacting trial in the relevant block or are you running the regular show_letter trial? Again, check your /branch logic.

I think so, these are my branches:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
<trial show_letter_practice>

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Non_Acting")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No / branch}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
By MilanSchoenmaeckers - 3/12/2020

MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!

The init trial samples the set size (number of letters to be shown) for the upcoming round from a list and stores the result in values.currentsetsize.

The /branch then invokes the recall trial

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]

when as many letters (counted in values.lettercount) have been shown as there were supposed to be in the given round, i.e. when the letter count is equal to the set size.

In your modfied trials/blocks, you've evidently broken this logic. I.e. you're either not setting values.currentsetsize correctly, or you're not incrementing values.lettercount correctly, or both.

I see. So can I ask you where I should set or increment these values? Do I need to make another values. item or a list?

You can see how/where they're incremented in the original script.

This is the original init trial:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]

/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

The  bolded parts is where values.currentsetsize is set. Depending on the block the trial finds itself in, the value is sampled from different lists. Again, if you've added or re-named blocks, you need to adjust and extend that logic accordingly.

values.lettercount is incremented by trial.show_letter.

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

I might be stupid, but I renamed the logic according to my re-named blocks.

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_NonActing")
    {values.currentsetsize=list.Non_ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_Acting")
    {values.currentsetsize=list.ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

I made both a Non_Acting_SetSize and Acting_SetSize list instead of the TestBothSetSize, so that shouldn't be the problem either right?

<list Non_ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

<list ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

I copied the script from the trial show_letter and adjusted the stimulusframes to incorporate my lightbulb stimuli. So the trial show_letter is now simply the show_letter_nonacting trial. 

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>


But are you actually running the show_letter_nonacting trial in the relevant block or are you running the regular show_letter trial? Again, check your /branch logic.

I think so, these are my branches:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
<trial show_letter_practice>

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Non_Acting")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No / branch}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]

There are two problems that I cannot solve in my script:

1. In the Prac_both block are 4 trials: 2 trials of setsize 2 and 2 trials of setsize 3. Three out of 4 trials have the correct sequence; show_math, solve_math, show_letter_practice, recall_letter, and letter_feedback. In one of these 4 trials, the solve_math isn't invoked. 

2. In the non_acting block: the first trial has the correct sequene of show_math, solve_math, show_letter_non_acting, recall_letter, and letter_feedback. From the second trial onwards, only the show_letter_non_acting keeps being invoked on screen. 

Which parts of the script do you need in order for you to make sense of what my problem is? I am really grateful for all the help. 
By Dave - 3/12/2020

MilanSchoenmaeckers - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!

The init trial samples the set size (number of letters to be shown) for the upcoming round from a list and stores the result in values.currentsetsize.

The /branch then invokes the recall trial

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]

when as many letters (counted in values.lettercount) have been shown as there were supposed to be in the given round, i.e. when the letter count is equal to the set size.

In your modfied trials/blocks, you've evidently broken this logic. I.e. you're either not setting values.currentsetsize correctly, or you're not incrementing values.lettercount correctly, or both.

I see. So can I ask you where I should set or increment these values? Do I need to make another values. item or a list?

You can see how/where they're incremented in the original script.

This is the original init trial:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]

/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

The  bolded parts is where values.currentsetsize is set. Depending on the block the trial finds itself in, the value is sampled from different lists. Again, if you've added or re-named blocks, you need to adjust and extend that logic accordingly.

values.lettercount is incremented by trial.show_letter.

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

I might be stupid, but I renamed the logic according to my re-named blocks.

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_NonActing")
    {values.currentsetsize=list.Non_ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_Acting")
    {values.currentsetsize=list.ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

I made both a Non_Acting_SetSize and Acting_SetSize list instead of the TestBothSetSize, so that shouldn't be the problem either right?

<list Non_ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

<list ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

I copied the script from the trial show_letter and adjusted the stimulusframes to incorporate my lightbulb stimuli. So the trial show_letter is now simply the show_letter_nonacting trial. 

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>


But are you actually running the show_letter_nonacting trial in the relevant block or are you running the regular show_letter trial? Again, check your /branch logic.

I think so, these are my branches:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
<trial show_letter_practice>

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Non_Acting")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No / branch}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]

There are two problems that I cannot solve in my script:

1. In the Prac_both block are 4 trials: 2 trials of setsize 2 and 2 trials of setsize 3. Three out of 4 trials have the correct sequence; show_math, solve_math, show_letter_practice, recall_letter, and letter_feedback. In one of these 4 trials, the solve_math isn't invoked. 

2. In the non_acting block: the first trial has the correct sequene of show_math, solve_math, show_letter_non_acting, recall_letter, and letter_feedback. From the second trial onwards, only the show_letter_non_acting keeps being invoked on screen. 

Which parts of the script do you need in order for you to make sense of what my problem is? I am really grateful for all the help. 

Just attach the whole script and include the images it needs as well. I don't feel that piecemeal code snippets are getting us anywhere.
By MilanSchoenmaeckers - 3/12/2020

Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!

The init trial samples the set size (number of letters to be shown) for the upcoming round from a list and stores the result in values.currentsetsize.

The /branch then invokes the recall trial

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]

when as many letters (counted in values.lettercount) have been shown as there were supposed to be in the given round, i.e. when the letter count is equal to the set size.

In your modfied trials/blocks, you've evidently broken this logic. I.e. you're either not setting values.currentsetsize correctly, or you're not incrementing values.lettercount correctly, or both.

I see. So can I ask you where I should set or increment these values? Do I need to make another values. item or a list?

You can see how/where they're incremented in the original script.

This is the original init trial:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]

/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

The  bolded parts is where values.currentsetsize is set. Depending on the block the trial finds itself in, the value is sampled from different lists. Again, if you've added or re-named blocks, you need to adjust and extend that logic accordingly.

values.lettercount is incremented by trial.show_letter.

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

I might be stupid, but I renamed the logic according to my re-named blocks.

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_NonActing")
    {values.currentsetsize=list.Non_ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_Acting")
    {values.currentsetsize=list.ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

I made both a Non_Acting_SetSize and Acting_SetSize list instead of the TestBothSetSize, so that shouldn't be the problem either right?

<list Non_ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

<list ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

I copied the script from the trial show_letter and adjusted the stimulusframes to incorporate my lightbulb stimuli. So the trial show_letter is now simply the show_letter_nonacting trial. 

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>


But are you actually running the show_letter_nonacting trial in the relevant block or are you running the regular show_letter trial? Again, check your /branch logic.

I think so, these are my branches:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
<trial show_letter_practice>

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Non_Acting")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No / branch}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]

There are two problems that I cannot solve in my script:

1. In the Prac_both block are 4 trials: 2 trials of setsize 2 and 2 trials of setsize 3. Three out of 4 trials have the correct sequence; show_math, solve_math, show_letter_practice, recall_letter, and letter_feedback. In one of these 4 trials, the solve_math isn't invoked. 

2. In the non_acting block: the first trial has the correct sequene of show_math, solve_math, show_letter_non_acting, recall_letter, and letter_feedback. From the second trial onwards, only the show_letter_non_acting keeps being invoked on screen. 

Which parts of the script do you need in order for you to make sense of what my problem is? I am really grateful for all the help. 

Just attach the whole script and include the images it needs as well. I don't feel that piecemeal code snippets are getting us anywhere.

<item PracMathProblem>
/ 01 = "(1*2) + 1 = ?"
/ 02 = "(1/1) - 1 = ?"
/ 03 = "(7*3) - 3 = ?"
/ 04 = "(4*3) + 4 = ?"
/ 05 = "(3/3) + 2 = ?"
/ 06 = "(2*6) - 4 = ?"
/ 07 = "(8*9) - 8 = ?"
/ 08 = "(4*5) - 5 = ?"
/ 09 = "(4*2) + 6 = ?"
/ 10 = "(4/4) + 7 = ?"
/ 11 = "(8*2) - 8 = ?"
/ 12 = "(2*9) - 9 = ?"
/ 13 = "(8/2) + 9 = ?"
/ 14 = "(3*8) - 1 = ?"
/ 15 = "(6/3) + 1 = ?"
/ 16 = "(9/3) - 2 = ?"
</item>

<item PracMathAnswer>
/ 01 = "3"
/ 02 = "2"
/ 03 = "18"
/ 04 = "16"
/ 05 = "1"
/ 06 = "6"
/ 07 = "64"
/ 08 = "11"
/ 09 = "14"
/ 10 = "12"
/ 11 = "2"
/ 12 = "9"
/ 13 = "7"
/ 14 = "23"
/ 15 = "3"
/ 16 = "7"
</item>

<values>
/ lightbulb_state = 1
</values>

<picture lightbulb_practice_letter>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

<list lightbulbstates_practice_letter>
/ items = (1,2,1,2,1,2,1,2,1,2)
</list>

<picture lightbulb_nonacting>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

<list lightbulbstates_nonacting>
/ items = (1,1,1,1,1,1,1,1,1,1,1,1,2,2,2)
</list>

<picture lightbulb_acting>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

<list lightbulbstates_acting>
/ items = (2,2,2,2,2,2,2,2,2,2,2,2,1,1,1)
</list>

<dropdown sex>
/ caption = "Sex"
/ options = ("female", "male", "other")
</dropdown>

<textbox age>
/ caption = "Age"
/ mask = positiveinteger
/ range = (7, 110)
</textbox>

<slider aim_math>
/ caption = "To what extent did you aim to get all math problems correct?"
/ labels = ("extremely aimed","very aimed","neutral","very unaimed","extremely unaimed")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider aim_recall>
/ caption = "To what extent did you aim to get all letter recall correct?"
/ labels = ("extremely aimed","very aimed","neutral","very unaimed","extremely unaimed")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider aim_light>
/ caption = "To what extent did you aim to turn all the light bulbs off?"
/ labels = ("extremely aimed","very aimed","neutral","very unaimed","extremely unaimed")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider motivation_math>
/ caption = "To what extent were you motivated to get all math problems correct?"
/ labels = ("extremely motivated","very motivated","neutral","very unmotivated","extremely unmotivated")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider motivation_recall>
/ caption = "To what extent were you motivated to get all letter recall correct?"
/ labels = ("extremely motivated","very motivated","neutral","very unmotivated","extremely unmotivated")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider motivation_light>
/ caption = "To what extent were you motivated to turn all the light bulbs off?"
/ labels = ("extremely motivated","very motivated","neutral","very unmotivated","extremely unmotivated")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider effort_math>
/ caption = "To what extent did you make an effort to get all math problems correct?"
/ labels = ("extremely effortful","very effortful","neutral","very uneffortful","extremely uneffortful")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider effort_recall>
/ caption = "To what extent did you make an effort to get all letter recall correct?"
/ labels = ("extremely effortful","very effortful","neutral","very uneffortful","extremely uneffortful")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider effort_light>
/ caption = "To what extent did you make an effort to turn all the light bulbs off?"
/ labels = ("extremely effortful","very effortful","neutral","very uneffortful","extremely uneffortful")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<surveypage demographics1>
/ caption = "Please answer the following questions"
/ fontstyle = ("Verdana", -16, true, false, false, false, 5, 0)
/ questions = [1=aim_math; 2=aim_recall; 3=aim_light]
</surveypage>

<surveypage demographics2>
/ caption = "Please answer the following questions (continued)"
/ fontstyle = ("Verdana", -16, true, false, false, false, 5, 0)
/ questions = [1=motivation_math; 2=motivation_recall; 3=motivation_light]
</surveypage>

<surveypage demographics3>
/ caption = "Please answer the following questions (continued)"
/ fontstyle = ("Verdana", -16, true, false, false, false, 5, 0)
/ questions = [1=effort_math; 2=effort_recall; 3=effort_light]
</surveypage>

<surveypage demographics4>
/ caption = "Please answer the following demographic questions"
/ fontstyle = ("Verdana", -16, true, false, false, false, 5, 0)
/ questions = [1=sex; 2=age]
</surveypage>

<survey demographic_questions>
/ pages = [1=demographics1; 2=demographics2; 3=demographics3; 4=demographics4]
/ responsefontstyle = ("Verdana", -12, false, false, false, false, 5, 0)
/ itemfontstyle = ("Verdana", -13, false, false, false, false, 5, 0)
/ itemspacing = 2%
/ showpagenumbers = false
</survey>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************

<item instructions>
/ 1 = "In this experiment you will try to memorize letters you see on the screen
while you also solve simple math problems.~r
In the next few minutes, you will have some practice to get you familiar with how the experiment works.~r
We will begin by practicing the letter part of the experiment.~r~r~r
<%expressions.buttoninstruct1%> to begin."
/ 2 = "For this practice set, a letter and lightbulb will appear on the screen one at a time.
Try to remember each letter in the order presented.~r
After 2-3 letters have been shown, you will see a screen listing 12 possible letters.
Your job is to select each letter in the order presented.
To do this, <%expressions.buttoninstruct2%>.~r
The letters you select will appear at the bottom of the screen.~r~r~r
<%expressions.buttoninstruct1%> to continue."
/ 3 = "When you have selected all the letters, and they are in the correct order,
hit the EXIT box at the bottom right of the screen.~r
If you make a mistake, hit the CLEAR box to start over.~r
If you forget one of the letters, <%expressions.buttoninstruct3%> the BLANK box to mark the spot
for the missing letter.~r
Remember, it is very important to get the letters in the same order as you see them.
If you forget one, use the BLANK box to mark the position.~r
Do you have any questions so far?~r~r~r
When you're ready, <%expressions.buttoninstruct1%> to start the letter practice."
/ 4 = "Now you will practice doing the math part of the experiment.~r~r
A math problem will appear on the screen, like this:~r
(2 * 1) + 1 = ?~r
As soon as you see the math problem, you should compute the correct answer.
In the above problem, the answer 3 is correct.~r
When you know the correct answer, you will <%expressions.buttoninstruct1%>.~r~r~r
<%expressions.buttoninstruct1%> to continue."
/ 5 = "You will see a number displayed on the next screen,
along with a box marked TRUE and a box marked FALSE.~r
If the number on the screen is the correct answer to the math problem,
<%expressions.buttoninstruct3%> on the TRUE box with the mouse.
If the number is not the correct answer, <%expressions.buttoninstruct3%> on the FALSE box.~r
For example, if you see the problem~r
(2 * 2) + 1 = ?~r
and the number on the following screen is 5
<%expressions.buttoninstruct3%> the TRUE box, because the answer is correct.~r
If you see the problem~r
(2 * 2) + 1 = ?~r
and the number on the next screen is 6
<%expressions.buttoninstruct3%> the FALSE box, because the correct answer is 5, not 6.~r
After you <%expressions.buttoninstruct3%> on one of the boxes,
the computer will tell you if you made the right choice.~r~r~r
<%expressions.buttoninstruct1%> to continue."
/ 6 = "It is VERY important that you get the math problems correct.
It is also important that you try and solve the problem as quickly as you can.~r
Do you have any questions?~r~r~r
When you're ready, <%expressions.buttoninstruct1%> to try some practice problems."
/ 7 = "Now you will practice doing both parts of the experiment at the same time.~r~r
In the next practice set, you will be given one of the math problems.
Once you make your decision about the math problem,
a letter and lightbulb will appear on the screen. Try and remember the letter.~r
In the previous section where you only solved math problems,
the computer computed your average time to solve the problems.~r
If you take longer than your average time,
the computer will automatically move you onto the next letter part,
thus skipping the True or False part and will count that problem as a math error.~r
Therefore it is VERY important to solve the problems
as quickly and as accurately as possible.~r~r~r
<%expressions.buttoninstruct1%> to continue."
/ 8 = "After the letter and lightbulb go away, another math problem will appear,
and then another letter and lightbulb.~r
At the end of each set of letters and math problems, a recall screen will appear.
Use the mouse to select the letters you just saw.
Try your best to get the letters in the correct order.~r
It is important to work QUICKLY and ACCURATELY on the math.
Make sure you know the answer to the math problem
before clicking to the next screen.
You will not be told if your answer to the math problem is correct.~r
After the recall screen, you will be given feedback about your performance
regarding both the number of letters recalled and the percent correct on
the math problems.~r
Do you have any questions?~r~r~r
<%expressions.buttoninstruct1%> to continue."
/ 9 = "During the feedback, you will see a number in red in the top right of the screen.
This indicates your percent correct for the math problems
for the entire experiment.~r
It is VERY important for you to keep this at least at 85%.
For our purposes, we can only use data where the participant was at least
85% accurate on the math.~r
Therefore, you must perform at least at 85% on the math problems
WHILE doing your best to recall as many letters as possible.~r
Do you have any questions?~r~r~r
<%expressions.buttoninstruct1%> to try some practice problems."
/ 10 = "That is the end of the practice.~r~r
The real trials will look like the practice trials you just completed.
First you will get a math problem to solve, then a letter to remember.~r
When you see the recall screen, select the letters in the order presented.
If you forget a letter, <%expressions.buttoninstruct3%> the BLANK box to mark where it should go.~r
Some of the sets will have more math problems and letters than others.~r
It is important that you do your best on both the math problems and
the letter recall parts of this experiment.~r
Remember on the math you must work as QUICKLY and ACCURATELY as possible.
Also, remember to keep your math accuracy at 85% or above.~r
Do you have any questions?~r~r~r
If not, <%expressions.buttoninstruct1%> to begin the experiment."
/ 11 = "Thank you for your participation."
</item>

<item acting_instructions>
/ 1 = "The following trials have an additional instruction in comparison to the previous trials.~r~r
When a letter is presented and the light bulb is turned on, press the SPACEBAR to turn off the light.~r~r
However, if the letter is presented with a light bulb turned off, you do NOT have to press the SPACEBAR.~r~r~r
It is important that you do your best on both the math problems and the letter recall parts of this experiment.~r
Remember on the math you must work as QUICKLY and ACCURATELY as possible.~r
Also, remember to keep your math accuracy at 85% or above.~r
Do you have any questions?~r~r~r
If not, <%expressions.buttoninstruct1%> to begin the experiment."
</item>

<item demographics_instructions>
/ 1 = "This was the end of the test phase.~r~r
I would like to ask you to finalize your participation by answering some questions.~r
That will be the final task within this study.~r~r
Again, thank you for participating.~r~r~r
<%expressions.buttoninstruct1%> to continue."
</item>

<text scorereport>
/ items = ("~tResults for Subject #<%script.subjectid%>~r~r
    OSPAN Absolute Score:~t<%values.ospan%>
    OSPAN Total Correct:~t<%values.totalcorrectletters%>~r~r
    Math Total Errors:~t<%values.mathtotalerrors%>
    Math Speed Errors:~t<%values.mathspeederrors%>
    Math Accuracy Errors:~t<%values.mathaccerrors%>~r~r")
/ size = (80%, 80%)
/ position = (52%, 50%)
/ hjustify = left
/ vjustify = center
</text>


****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************
<expressions>
/buttoninstruct1 = if (computer.touch && !computer.haskeyboard) {"tap the screen";} else {"click the mouse button";}
/buttoninstruct2 = if (computer.touch && !computer.haskeyboard) {"tap the letters you want to select";} else {"use the mouse to select each letter";}
/buttoninstruct3 = if (computer.touch && !computer.haskeyboard) {"tap";} else {"click";}
</expressions>


**************************************************************************************************************
**************************************************************************************************************
    EDITABLE LISTS: change editable lists here
**************************************************************************************************************
**************************************************************************************************************

**************************************************************************************************************
    Set Sizes for Letter Practice Phase
**************************************************************************************************************

<list PracLetterSetSize>
/ items = (2,2,3,3)
/ selectionmode = sequence
/ selectionrate = trial
</list>

**************************************************************************************************************
    Set Sizes for Letter & Math Practice Phase
**************************************************************************************************************
<list PracBothSetSize>
/ items = (2,2,2)
/ selectionmode = sequence
/ selectionrate = trial
</list>

**************************************************************************************************************
    Set Sizes for Letter & Math Test Phase
**************************************************************************************************************

<list TestBothSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

**************************************************************************************************************
**************************************************************************************************************
    DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 5.0.0.0 or higher

<defaults>
/ canvassize = (100%,100%)
/ canvasaspectratio = (4,3)
/ screencolor = white
/ txcolor = black
/ txbgcolor = transparent
/ fontstyle = ("Arial", 4.0%, true)
/ inputdevice = mouse
/ minimumversion = "5.0.0.0"
/ halign = center
/ valign = center
</defaults>

**************************************************************************************************************
**************************************************************************************************************
    DATA
**************************************************************************************************************
**************************************************************************************************************

********************
raw data
********************

<data>
/ columns = (build, computer.platform, date, time, subject, group, blockcode, blocknum, trialcode, trialnum, latency, response, correct,
    values.currentsetsize, text.letters.currentitem, values.lightbulb_state values.mathproblemcount,
    text.MathProblem.currentitem, values.mathtrueanswer, values.mathanswer,
    values.mathcorrect, values.mathaccuracy, values.mathtotalerrors, values.mathaccerrors,
    values.mathspeederrors, values.mathtimeout, values.recalledletters,
    values.totalcorrectletters, values.totalrecalledsets, values.ospan)
/ labels = true
/ separatefiles = true
</data>

********************
summary data
********************

<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform, values.completed,
    values.ospan,
    values.totalcorrectletters, values.mathtotalerrors, values.mathspeederrors,
    values.mathaccerrors)
/ separatefiles = true
</summarydata>

**************************************************************************************************************
**************************************************************************************************************
    VALUES: automatically updated
**************************************************************************************************************
**************************************************************************************************************
            
/completed:                0 = script was not completed; 1 = script was completed (all conditions run)

<values AOSPAN>
/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>


**************************************************************************************************************
**************************************************************************************************************
    EXPRESSIONS
**************************************************************************************************************
**************************************************************************************************************
<expressions AOSPAN>
/ selectionmode = if(script.currentblock=="PracLetter")    PracLetterList else TestLetterList
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    INSTRUCTIONS
**************************************************************************************************************
**************************************************************************************************************

<block InstrPracLetter>
/ trials = [1-3=instructions]
/ recorddata = false
</block>

<block InstrPracMath>
/ trials = [1-3=instructions]
/ recorddata = false
</block>

<block InstrPracBoth>
/ trials = [1-3=instructions]
/ recorddata = false
</block>

<block Instr_Non_Acting>
/ trials = [1=instructions]
/ recorddata = false
</block>

<block InstrActingBlock>
/ trials = [1=instructions_acting]
/ recorddata = false
</block>

<block InstrFinal>
/ trials = [1=instructions; 2=score_report]
/ recorddata = false
</block>

<trial instructions>
/ pretrialpause = 250
/ posttrialpause = 250
/ stimulustimes = [1=instructions]
/ validresponse = (lbuttondown)
/ responsetime = 2000
/ recorddata = false
</trial>

<text instructions>
/ items = instructions
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 2.5%, true)
/ size = (90%, 80%)
/ position = (50%, 50%)
/ select = sequence
/ resetinterval = 0
</text>

<trial instructions_acting>
/ pretrialpause = 250
/ posttrialpause = 250
/ stimulustimes = [1=instructions_acting]
/ validresponse = (lbuttondown)
/ responsetime = 2000
/ recorddata = false
</trial>

<text instructions_acting>
/ items = acting_instructions
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 2.5%, true)
/ size = (90%, 80%)
/ position = (50%, 50%)
/ resetinterval = 0
</text>

<trial instructions_demographics>
/ pretrialpause = 250
/ posttrialpause = 250
/ stimulustimes = [1=instructions_demographics]
/ validresponse = (lbuttondown)
/ responsetime = 2000
/ recorddata = false
</trial>

<text instructions_demographics>
/ items = demographics_instructions
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 2.5%, true)
/ size = (90%, 80%)
/ position = (50%, 50%)
/ resetinterval = 0
</text>

<block instructions_demographics>
/ trials = [1=instructions_demographics]
/ recorddata = false
</block>


**************************************************************************************************************
**************************************************************************************************************
    STIMULI: Letters
**************************************************************************************************************
**************************************************************************************************************

<text Letters>
/ items = ("F","P","Q","J","H","K","T","S","N","R","Y","L")
/ fontstyle = ("Arial", 5.0%, true)
/ erase = true(silver)
/ select = expressions.selectionmode
</text>

**************************************************************************************************************
    Empty Item Elements for Storing Presented and Recalled Letter Sequences
**************************************************************************************************************

<item PresentedLetters>
</item>

<item RecalledLetters>
</item>

**************************************************************************************************************
    Screen Layout Elements for the Letter Recall Grid
**************************************************************************************************************

<text F>
/ items = ("F")
/ position = (25%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text H>
/ items = ("H")
/ position = (50%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text J>
/ items = ("J")
/ position = (75%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text K>
/ items = ("K")
/ position = (25%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text L>
/ items = ("L")
/ position = (50%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text N>
/ items = ("N")
/ position = (75%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text P>
/ items = ("P")
/ position = (25%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text Q>
/ items = ("Q")
/ position = (50%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text R>
/ items = ("R")
/ position = (75%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text S>
/ items = ("S")
/ position = (25%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text T>
/ items = ("T")
/ position = (50%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text Y>
/ items = ("Y")
/ position = (75%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text _>
/ items = ("BLANK")
/ position = (50%, 72%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clear>
/ items = ("CLEAR")
/ position = (18%, 87%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text exit>
/ items = ("EXIT")
/ position = (82%, 87%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickF>
/ items = ("F")
/ position = (25%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickH>
/ items = ("H")
/ position = (50%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickJ>
/ items = ("J")
/ position = (75%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickK>
/ items = ("K")
/ position = (25%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickL>
/ items = ("L")
/ position = (50%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickN>
/ items = ("N")
/ position = (75%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickP>
/ items = ("P")
/ position = (25%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickQ>
/ items = ("Q")
/ position = (50%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickR>
/ items = ("R")
/ position = (75%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickS>
/ items = ("S")
/ position = (25%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickT>
/ items = ("T")
/ position = (50%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickY>
/ items = ("Y")
/ position = (75%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text click_>
/ items = ("BLANK")
/ position = (50%, 72%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txcolor = white
/ txbgcolor = black
/ erase = false
</text>

<text clickclear>
/ items = ("CLEAR")
/ position = (18%, 87%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txcolor = white
/ txbgcolor = black
/ erase = false
</text>

<text clickexit>
/ items = ("EXIT")
/ position = (82%, 87%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txcolor = white
/ txbgcolor = black
/ erase = false
</text>

<text recalledletters>
/ items = ("<%values.recalledletters%>")
/ position = (50%, 80%)
/ txcolor = red
/ erase = false
</text>

<text recallprompt>
/ items = ("Select the letters in the order presented. Use the blank button to fill in forgotten items.")
/ position = (50%, 5%)
/ size = (95%, 5%)
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 2.5%, true)
/ erase = false
</text>

<text LetterFeedback>
/ items = ("You recalled <%values.correctletters%> out of <%values.lettercount%> letters correctly.")
/ fontstyle = ("Arial", 3.5%, true)
/ position = (50%, 45%)
/ erase = true(white)
</text>

**************************************************************************************************************
**************************************************************************************************************
    STIMULI: Math
**************************************************************************************************************
**************************************************************************************************************

**************************************************************************************************************
    Math Problems (Practice Phase)
**************************************************************************************************************
**************************************************************************************************************

**************************************************************************************************************
**************************************************************************************************************
<text PracMathProblem>
/ items = PracMathProblem
/ position = (50%, 45%)
/ fontstyle = ("Arial", 3.5%, true)
/ erase = true(silver)
/ select = PracMathList
</text>

<text PracMathAnswer>
/ items = PracMathAnswer
/ fontstyle = ("Arial", 3.5%, true)
/ position = (50%, 30%)
/ erase = false
/ select = current(PracMathProblem)
</text>

<text PracMathFeedback>
/ items = ("You were correct on <%trial.prac_solve_math.totalcorrectcount%> of <%list.PracMathList.itemcount%> math trials.
That is <%trial.prac_solve_math.totalpercentcorrect%> percent correct.~r~r~r
Click the left mouse button to continue.")
/ fontstyle = ("Arial", 2.5%, true)
/ size = (65%, 50%)
/ position = (50%, 50%)
/ vjustify = center
</text>

**************************************************************************************************************
    Text and Layout Items used for the Math Trials
**************************************************************************************************************

<text MathProblemDisplay>
/ items = ("<%text.MathProblem.currentitem%> = ?")
/ fontstyle = ("Arial", 3.5%, true)
/ hjustify = left
/ position = (50%, 45%)
/ erase = true(silver)
</text>

<text MathProblem>
/ items = ("<%values.tmp_mathopt01%> <%values.tmp_mathsign%> <%values.tmp_mathopt02%>")
/ fontstyle = ("Arial", 3.5%, true)
/ hjustify = left
/ position = (50%, 45%)
/ erase = true(silver)
</text>

<text MathCorrect>
/ items = ("<%text.MathCorrect.selectedvalue%>")
/ select = noreplace
/ fontstyle = ("Arial", 3.5%, true)
/ position = (50%, 60%)
/ erase = true(silver)
</text>

<text MathAnswer>
/ items = ("<%values.mathanswer%>")
/ fontstyle = ("Arial", 3.5%, true)
/ position = (50%, 30%)
/ erase = true(silver)
</text>

<text MathScore>
/ items = ("<%values.mathaccuracy%>%")
/ fontstyle = ("Arial", 4.0%, true)
/ position = (85%, 15%)
/ size = (10%, 10%)
</text>

<text MathFeedback>
/ items = (
"You made <%values.mathcurrenterrors%> math error(s) on this set of trials.",
"You have made a total of 3 or more math errors during this set of trials. Please do your best on the math.")
/ select = values.matherrorswitch
/ position = (50%, 65%)
/ size = (80%, 30%)
/ fontstyle = ("Arial", 3.0%, true)
</text>

<text TRUE>
/ items = ("TRUE")
/ position = (31%, 52%)
/ size = (10%, 5%)
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 3.0%, true)
/ txbgcolor = white
/ erase = false
</text>

<text FALSE>
/ items = ("FALSE")
/ position = (69%, 52%)
/ size = (10%, 5%)
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 3.0%, true)
/ txbgcolor = white
/ erase = false
</text>

<text TestMathPrompt>
/ items = ("Click the left mouse button to continue.")
/ fontstyle = ("Arial", 2.7%, true)
/ position = (50%, 65%)
/ size = (60%, 10%)
/ erase = false
</text>

<text PracMathPrompt>
/ items = ("When you have solved the math problem,~nclick the left mouse button to continue.")
/ fontstyle = ("Arial", 2.7%, true)
/ position = (50%, 65%)
/ size = (60%, 10%)
/ erase = true(silver)
</text>

<text correcttext>
/ items = ("Correct")
/ position = (50%, 72%)
/ fontstyle = ("Arial", 3.0%, true)
/ txcolor = blue
/ size = (15%, 5%)
/ hjustify = center
/ vjustify = center
/ erase = true(silver)
</text>

<text incorrecttext>
/ items = ("Incorrect")
/ position = (50%, 72%)
/ fontstyle = ("Arial", 3.0%, true)
/ txcolor = blue
/ size = (15%, 5%)
/ hjustify = center
/ vjustify = center
/ erase = true(silver)
</text>

**************************************************************************************************************
**************************************************************************************************************
    STIMULI: General Purpose Screen Layout Items
**************************************************************************************************************
**************************************************************************************************************
<shape GrayFrame>
/ shape = rectangle
/ color = silver
/ size = (78.3%, 78%)
/ erase = false
</shape>

<shape BlackFrame>
/ shape = rectangle
/ color = black
/ size = (80%, 80%)
/ position = (50%, 50%)
/ erase = false
</shape>

<shape WhiteScreen>
/ shape = rectangle
/ color = white
/ size = (100%, 100%)
/ position = (50%, 50%)
/ erase = false
</shape>

**************************************************************************************************************
**************************************************************************************************************
    LISTS:
**************************************************************************************************************
**************************************************************************************************************

*******************************
Item Selection
*******************************
<list PracLetterList>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12)
/ selectionmode = sequence
/ selectionrate = trial
</list>

<list TestLetterList>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12)
</list>

<list PracMathList>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
</list>

*******************************
Math
*******************************

<list PracMathCorrect>
/ items = (
    "TRUE", "FALSE", "TRUE", "TRUE", "FALSE", "FALSE", "TRUE", "FALSE",
    "TRUE", "FALSE", "FALSE", "TRUE", "FALSE", "TRUE", "TRUE", "FALSE")
/ selectionmode = text.PracMathProblem.currentindex
</list>

**************************************************************************************************************
    Math Problems (Test Phase)
**************************************************************************************************************

<list MathOpt01>
/ items = (
    "(1/1)", "(2/1)", "(2/2)", "(3/1)", "(3/3)", "(4/1)", "(4/2)", "(4/4)",
    "(5/1)", "(5/5)", "(6/1)", "(6/2)", "(6/3)", "(6/6)", "(7/1)", "(7/7)",
    "(8/1)", "(8/2)", "(8/4)", "(8/8)", "(9/1)", "(9/3)", "(9/9)", "(1*2)",
    "(1*3)", "(2*2)", "(1*4)", "(1*5)", "(3*2)", "(2*3)", "(1*6)", "(1*7)",
    "(4*2)", "(2*4)", "(1*8)", "(3*3)", "(1*9)", "(5*2)", "(2*5)", "(6*2)",
    "(4*3)", "(3*4)", "(2*6)", "(7*2)", "(2*7)", "(5*3)", "(3*5)", "(8*2)")
/ selectionrate = trial
</list>

<list MathDifficulty>
/ items = (
    "1", "1", "1", "1", "1", "1", "1", "1",
    "1", "1", "1", "1", "1", "1", "1", "1",
    "1", "1", "1", "1", "1", "1", "1", "1",
    "1", "1", "1", "1", "1", "1", "1", "1",
    "1", "1", "1", "1", "1", "2", "2", "2",
    "2", "2", "2", "2", "2", "2", "2", "2")
/ selectionmode = list.MathOpt01.currentindex
</list>

<list MathOpt02>
/ items = (
    "1", "2", "3", "4", "5", "6", "7", "8", "9",
    "1", "2", "3", "4", "5", "6", "7", "8", "9")
</list>

<list MathSign>
/ items = (
    "+", "+", "+", "+", "+", "+", "+", "+", "+",
    "-", "-", "-", "-", "-", "-", "-", "-", "-")
</list>

<list MathCorrect>
/ items = (
    "TRUE", "TRUE", "TRUE", "TRUE", "TRUE",
    "FALSE", "FALSE", "FALSE", "FALSE", "FALSE")
</list>

<list MathRand>
/ items = (
    "1", "2", "3", "4", "5", "6", "7", "8", "9",
    "-1", "-2", "-3", "-4", "-5", "-6", "-7", "-8", "-9")
</list>

**************************************************************************************************************
**************************************************************************************************************
    TRIALS: Letters

**************************************************************************************************************
    Initialization Trial for the Different Study Phases
**************************************************************************************************************

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>


<trial show_letter_practice>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_practice_letter.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_practice_letter currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Non_Acting")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Acting")trial.show_letter_acting else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.TestBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Acting" && list.TestBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

<trial prac_show_math>
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathProblem, PracMathPrompt]
/ validresponse = (lbuttondown)
/ branch = [trial.prac_solve_math]
/ recorddata = true
</trial>

<trial prac_solve_math>
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathAnswer, TRUE, FALSE]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (list.PracMathCorrect.nextvalue)
/ responsemessage = (anyresponse, PracMathAnswer, 800)
/ correctmessage = true(correcttext, 800)
/ errormessage = true(incorrecttext, 800)
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]
/ recorddata = true
</trial>

<trial prac_math_feedback>
/ ontrialend = [values.stopblock=1]
/ pretrialpause = 500
/ stimulusframes = [1=WhiteScreen, PracMathFeedback]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>

<trial InitMathProblem01>
/ ontrialbegin = [values.tmp_initmath01+=1]
/ ontrialbegin = [if(values.tmp_initmath01==1)
    {values.tmp_mathopt01=list.MathOpt01.nextvalue;
    values.tmp_mathsign=list.MathSign.nextvalue;
    values.tmp_mathopt02=list.MathOpt02.nextvalue;
    values.mathcorrect=list.MathCorrect.nextvalue;
    values.tmp_mathopt02sign=concat(values.tmp_mathsign, values.tmp_mathopt02);
    values.tmp_mathopt02sign=evaluate(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1)
    {values.tmp_mathopt02sign+=3;
    values.tmp_mathopt02=abs(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1 && values.tmp_mathopt02sign>0)
    values.tmp_mathsign="+"]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem);
    values.mathtrueanswer=values.mathanswer]
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial InitMathProblem02>
/ ontrialbegin = [values.tmp_initmath02+=1]
/ ontrialbegin = [if(values.tmp_initmath02==1)values.tmp_mathrand=list.MathRand.nextvalue]
/ ontrialbegin = [if(values.tmp_initmath02>1)values.tmp_mathrand+=2]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem)+values.tmp_mathrand]
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
    values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
    {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
    {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter_nonacting]
/ recorddata = true
</trial>

**************************************************************************************************************
**************************************************************************************************************
    SCORING
**************************************************************************************************************
**************************************************************************************************************

<trial score_report>
/ stimulusframes = [1=scorereport]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>

**************************************************************************************************************
**************************************************************************************************************
    BLOCKS
**************************************************************************************************************
**************************************************************************************************************

<block PracLetter>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=white; text.MathScore.textcolor=white; values.stopblock=0]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block PracMath>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [values.mathaccuracy=0]
/ onblockend = [values.mathtimeout=(2.5*trial.prac_show_math.totalsdlatency)+trial.prac_show_math.totalmeanlatency]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=prac_show_math]
</block>

<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=instructions_acting; 2=InitSetSize]
</block>

<expt AOSPAN>
/ onexptbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ blocks = [1=InstrPracLetter; 2=PracLetter; 3=InstrPracMath; 4=PracMath;
    5=InstrPracBoth; 6=PracBoth; 7=Instr_Non_Acting; 8=Non_Acting; 9=Acting; 10=instructions_demographics;11=demographic_questions; 12=InstrFinal]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************
**************************************************************************************************************
    DEBUG: On-Screen Debugging Items
**************************************************************************************************************
**************************************************************************************************************
    These items are invisible by default.
    Enter 'debug' as subject id to enable them.

<text currentsetsize>
/ items = (    "Setsize: <%values.currentsetsize%> / Lettercount: <%values.lettercount%>")
/ fontstyle = ("Arial", 2.5%, true)
/ txcolor = blue
/ size = (50%, 5%)
/ position = (50%, 5%)
</text>

<text letterstrings>
/ items = ("~tPresented Letters:~t<%item.PresentedLetters.item.1%><%item.PresentedLetters.item.2%><%item.PresentedLetters.item.3%><%item.PresentedLetters.item.4%><%item.PresentedLetters.item.5%><%item.PresentedLetters.item.6%><%item.PresentedLetters.item.7%><%item.PresentedLetters.item.8%><%item.PresentedLetters.item.9%><%item.PresentedLetters.item.10%><%item.PresentedLetters.item.11%><%item.PresentedLetters.item.12%>
~tRecalled Letters:~t<%item.RecalledLetters.item.1%><%item.RecalledLetters.item.2%><%item.RecalledLetters.item.3%><%item.RecalledLetters.item.4%><%item.RecalledLetters.item.5%><%item.RecalledLetters.item.6%><%item.RecalledLetters.item.7%><%item.RecalledLetters.item.8%><%item.RecalledLetters.item.9%><%item.RecalledLetters.item.10%><%item.RecalledLetters.item.11%><%item.RecalledLetters.item.12%>")
/ fontstyle = ("Arial", 2.5%, true)
/ txcolor = blue
/ size = (55%, 5%)
/ position = (50%, 87%)
/ hjustify = left
/ vjustify = center
/ erase = false
</text>

<text mathdebug>
/ items = ("~tMath Problem:~t~t<% text.MathProblem.currentitem %>~r
~tTrue Answer:~t~t<% values.mathtrueanswer %>~r
~tPresented Answer:~t<% values.mathcorrect %>~r~r")
/ size = (50%, 7%)
/ halign = center
/ hjustify = center
/ position = (45%, 70%)
/ fontstyle = ("Arial", 2.5%, true)
/ txcolor = blue
/ erase = true(silver)
</text>

<text mathtimeout>
/ items = ("Timeout = <%values.mathtimeout%> ms~r
Math Problem # <%values.mathproblemcount%>")
/ fontstyle = ("Arial", 2.5%, true)
/ txcolor = blue
/ size = (50%, 5%)
/ position = (50%, 20%)
/ erase = true(silver)
</text>

<text scoredebug>
/ items = ("OSPAN Score:~t~t<% values.ospan %>
Total Number Correct:~t<% values.totalcorrectletters %>~r~r
Math Errors (Total):~t<% values.mathtotalerrors %>
Math Speed Errors:~t<% values.mathspeederrors %>
Math Accuracy Errors:~t<% values.mathaccerrors %>~r~r")
/ fontstyle = ("Arial", 2.5%, true)
/ txcolor = blue
/ size = (50%, 5%)
/ position = (50%, 75%)
/ erase = true(white)
</text>

<monkey AOSPAN>
/ latencydistribution = normal(800, 200)
/ percentcorrect = 100
</monkey>

By Dave - 3/12/2020

MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Dave - 3/9/2020
MilanSchoenmaeckers - 3/9/2020
Hi, 

As for the second problem, my letter_recall and letter_feedback parts of the script aren't running in the Non_Acting block. However, what makes it strange is that they are running in the PracBoth block:


<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.Non_ActingSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

I am really grateful for all the support.

I'm sorry, but the code you posted is not pertinent to the problem. You need to check the /branch logic that is responsible for invoking trial.letter_recall and trial.letter_feedback.

These are the /branches from each trial currently in my script:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No branch in the original script}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


Thanks again!

If the recall_letter trial isn't invoked, then these are what you need to look at:

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]

Is the condition ever met? Are you using and updating the values in the if() condition properly in that block?

And these do not make sense:

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_acting else trial.solve_math]


<trial solve_math>
/ branch = [trial.show_letter_nonacting]
/ branch = [trial.show_letter_acting]


How is the script supposed to know whether to run the nonacting or acting trial? You're not distinguishing, and only the first /branch will ever be executed.

Hi again,

I understand that I need to update when the condition is met, but I don't understand the values.

<values AOSPAN>

/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>
0 = script was not completed; 1 = script was completed (all conditions run)

Could you explain to me what this means? Both the regular script and my script use the / currentsetsize = 0 for the / branch logic. 

Thanks!

The init trial samples the set size (number of letters to be shown) for the upcoming round from a list and stores the result in values.currentsetsize.

The /branch then invokes the recall trial

/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]

when as many letters (counted in values.lettercount) have been shown as there were supposed to be in the given round, i.e. when the letter count is equal to the set size.

In your modfied trials/blocks, you've evidently broken this logic. I.e. you're either not setting values.currentsetsize correctly, or you're not incrementing values.lettercount correctly, or both.

I see. So can I ask you where I should set or increment these values? Do I need to make another values. item or a list?

You can see how/where they're incremented in the original script.

This is the original init trial:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]

/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

The  bolded parts is where values.currentsetsize is set. Depending on the block the trial finds itself in, the value is sampled from different lists. Again, if you've added or re-named blocks, you need to adjust and extend that logic accordingly.

values.lettercount is incremented by trial.show_letter.

<trial show_letter>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter else trial.InitMathProblem01]
/ recorddata = true
</trial>

I might be stupid, but I renamed the logic according to my re-named blocks.

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_NonActing")
    {values.currentsetsize=list.Non_ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_Acting")
    {values.currentsetsize=list.ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

I made both a Non_Acting_SetSize and Acting_SetSize list instead of the TestBothSetSize, so that shouldn't be the problem either right?

<list Non_ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

<list ActingSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

I copied the script from the trial show_letter and adjusted the stimulusframes to incorporate my lightbulb stimuli. So the trial show_letter is now simply the show_letter_nonacting trial. 

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="TestBoth_NonActing")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>


But are you actually running the show_letter_nonacting trial in the relevant block or are you running the regular show_letter trial? Again, check your /branch logic.

I think so, these are my branches:

<trial InitSetSize>
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
<trial show_letter_practice>

<trial show_letter_practice>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]

<trial show_letter_nonacting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Non_Acting")trial.show_letter_nonacting else trial.InitMathProblem01]

<trial show_letter_acting>
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Acting")trial.show_letter_acting else trial.InitMathProblem01]

<trial recall_letter>
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]

<trial letter_feedback>
/ branch = [trial.InitSetSize]

<trial prac_show_math>
/ branch = [trial.prac_solve_math]

<trial prac_solve_math>
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]

<trial prac_math_feedback>
{No / branch}

<trial InitMathProblem01>
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]

<trial InitMathProblem02>
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]

<trial show_math>
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]

<trial solve_math>
/ branch = [trial.show_letter_nonacting]

There are two problems that I cannot solve in my script:

1. In the Prac_both block are 4 trials: 2 trials of setsize 2 and 2 trials of setsize 3. Three out of 4 trials have the correct sequence; show_math, solve_math, show_letter_practice, recall_letter, and letter_feedback. In one of these 4 trials, the solve_math isn't invoked. 

2. In the non_acting block: the first trial has the correct sequene of show_math, solve_math, show_letter_non_acting, recall_letter, and letter_feedback. From the second trial onwards, only the show_letter_non_acting keeps being invoked on screen. 

Which parts of the script do you need in order for you to make sense of what my problem is? I am really grateful for all the help. 

Just attach the whole script and include the images it needs as well. I don't feel that piecemeal code snippets are getting us anywhere.

<item PracMathProblem>
/ 01 = "(1*2) + 1 = ?"
/ 02 = "(1/1) - 1 = ?"
/ 03 = "(7*3) - 3 = ?"
/ 04 = "(4*3) + 4 = ?"
/ 05 = "(3/3) + 2 = ?"
/ 06 = "(2*6) - 4 = ?"
/ 07 = "(8*9) - 8 = ?"
/ 08 = "(4*5) - 5 = ?"
/ 09 = "(4*2) + 6 = ?"
/ 10 = "(4/4) + 7 = ?"
/ 11 = "(8*2) - 8 = ?"
/ 12 = "(2*9) - 9 = ?"
/ 13 = "(8/2) + 9 = ?"
/ 14 = "(3*8) - 1 = ?"
/ 15 = "(6/3) + 1 = ?"
/ 16 = "(9/3) - 2 = ?"
</item>

<item PracMathAnswer>
/ 01 = "3"
/ 02 = "2"
/ 03 = "18"
/ 04 = "16"
/ 05 = "1"
/ 06 = "6"
/ 07 = "64"
/ 08 = "11"
/ 09 = "14"
/ 10 = "12"
/ 11 = "2"
/ 12 = "9"
/ 13 = "7"
/ 14 = "23"
/ 15 = "3"
/ 16 = "7"
</item>

<values>
/ lightbulb_state = 1
</values>

<picture lightbulb_practice_letter>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

<list lightbulbstates_practice_letter>
/ items = (1,2,1,2,1,2,1,2,1,2)
</list>

<picture lightbulb_nonacting>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

<list lightbulbstates_nonacting>
/ items = (1,1,1,1,1,1,1,1,1,1,1,1,2,2,2)
</list>

<picture lightbulb_acting>
/ items = ("lamp_uit.png", "lamp_aan.png")
/ position = (50, 30)
/ size = (20%, 20%)
/ select = values.lightbulb_state
</picture>

<list lightbulbstates_acting>
/ items = (2,2,2,2,2,2,2,2,2,2,2,2,1,1,1)
</list>

<dropdown sex>
/ caption = "Sex"
/ options = ("female", "male", "other")
</dropdown>

<textbox age>
/ caption = "Age"
/ mask = positiveinteger
/ range = (7, 110)
</textbox>

<slider aim_math>
/ caption = "To what extent did you aim to get all math problems correct?"
/ labels = ("extremely aimed","very aimed","neutral","very unaimed","extremely unaimed")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider aim_recall>
/ caption = "To what extent did you aim to get all letter recall correct?"
/ labels = ("extremely aimed","very aimed","neutral","very unaimed","extremely unaimed")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider aim_light>
/ caption = "To what extent did you aim to turn all the light bulbs off?"
/ labels = ("extremely aimed","very aimed","neutral","very unaimed","extremely unaimed")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider motivation_math>
/ caption = "To what extent were you motivated to get all math problems correct?"
/ labels = ("extremely motivated","very motivated","neutral","very unmotivated","extremely unmotivated")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider motivation_recall>
/ caption = "To what extent were you motivated to get all letter recall correct?"
/ labels = ("extremely motivated","very motivated","neutral","very unmotivated","extremely unmotivated")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider motivation_light>
/ caption = "To what extent were you motivated to turn all the light bulbs off?"
/ labels = ("extremely motivated","very motivated","neutral","very unmotivated","extremely unmotivated")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider effort_math>
/ caption = "To what extent did you make an effort to get all math problems correct?"
/ labels = ("extremely effortful","very effortful","neutral","very uneffortful","extremely uneffortful")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider effort_recall>
/ caption = "To what extent did you make an effort to get all letter recall correct?"
/ labels = ("extremely effortful","very effortful","neutral","very uneffortful","extremely uneffortful")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<slider effort_light>
/ caption = "To what extent did you make an effort to turn all the light bulbs off?"
/ labels = ("extremely effortful","very effortful","neutral","very uneffortful","extremely uneffortful")
/ range = (1, 5)
/ slidersize = (60%, 5%)
/ showtooltips = false
</slider>

<surveypage demographics1>
/ caption = "Please answer the following questions"
/ fontstyle = ("Verdana", -16, true, false, false, false, 5, 0)
/ questions = [1=aim_math; 2=aim_recall; 3=aim_light]
</surveypage>

<surveypage demographics2>
/ caption = "Please answer the following questions (continued)"
/ fontstyle = ("Verdana", -16, true, false, false, false, 5, 0)
/ questions = [1=motivation_math; 2=motivation_recall; 3=motivation_light]
</surveypage>

<surveypage demographics3>
/ caption = "Please answer the following questions (continued)"
/ fontstyle = ("Verdana", -16, true, false, false, false, 5, 0)
/ questions = [1=effort_math; 2=effort_recall; 3=effort_light]
</surveypage>

<surveypage demographics4>
/ caption = "Please answer the following demographic questions"
/ fontstyle = ("Verdana", -16, true, false, false, false, 5, 0)
/ questions = [1=sex; 2=age]
</surveypage>

<survey demographic_questions>
/ pages = [1=demographics1; 2=demographics2; 3=demographics3; 4=demographics4]
/ responsefontstyle = ("Verdana", -12, false, false, false, false, 5, 0)
/ itemfontstyle = ("Verdana", -13, false, false, false, false, 5, 0)
/ itemspacing = 2%
/ showpagenumbers = false
</survey>

**************************************************************************************************************
**************************************************************************************************************
    EDITABLE INSTRUCTIONS: change instructions here
**************************************************************************************************************
**************************************************************************************************************

<item instructions>
/ 1 = "In this experiment you will try to memorize letters you see on the screen
while you also solve simple math problems.~r
In the next few minutes, you will have some practice to get you familiar with how the experiment works.~r
We will begin by practicing the letter part of the experiment.~r~r~r
<%expressions.buttoninstruct1%> to begin."
/ 2 = "For this practice set, a letter and lightbulb will appear on the screen one at a time.
Try to remember each letter in the order presented.~r
After 2-3 letters have been shown, you will see a screen listing 12 possible letters.
Your job is to select each letter in the order presented.
To do this, <%expressions.buttoninstruct2%>.~r
The letters you select will appear at the bottom of the screen.~r~r~r
<%expressions.buttoninstruct1%> to continue."
/ 3 = "When you have selected all the letters, and they are in the correct order,
hit the EXIT box at the bottom right of the screen.~r
If you make a mistake, hit the CLEAR box to start over.~r
If you forget one of the letters, <%expressions.buttoninstruct3%> the BLANK box to mark the spot
for the missing letter.~r
Remember, it is very important to get the letters in the same order as you see them.
If you forget one, use the BLANK box to mark the position.~r
Do you have any questions so far?~r~r~r
When you're ready, <%expressions.buttoninstruct1%> to start the letter practice."
/ 4 = "Now you will practice doing the math part of the experiment.~r~r
A math problem will appear on the screen, like this:~r
(2 * 1) + 1 = ?~r
As soon as you see the math problem, you should compute the correct answer.
In the above problem, the answer 3 is correct.~r
When you know the correct answer, you will <%expressions.buttoninstruct1%>.~r~r~r
<%expressions.buttoninstruct1%> to continue."
/ 5 = "You will see a number displayed on the next screen,
along with a box marked TRUE and a box marked FALSE.~r
If the number on the screen is the correct answer to the math problem,
<%expressions.buttoninstruct3%> on the TRUE box with the mouse.
If the number is not the correct answer, <%expressions.buttoninstruct3%> on the FALSE box.~r
For example, if you see the problem~r
(2 * 2) + 1 = ?~r
and the number on the following screen is 5
<%expressions.buttoninstruct3%> the TRUE box, because the answer is correct.~r
If you see the problem~r
(2 * 2) + 1 = ?~r
and the number on the next screen is 6
<%expressions.buttoninstruct3%> the FALSE box, because the correct answer is 5, not 6.~r
After you <%expressions.buttoninstruct3%> on one of the boxes,
the computer will tell you if you made the right choice.~r~r~r
<%expressions.buttoninstruct1%> to continue."
/ 6 = "It is VERY important that you get the math problems correct.
It is also important that you try and solve the problem as quickly as you can.~r
Do you have any questions?~r~r~r
When you're ready, <%expressions.buttoninstruct1%> to try some practice problems."
/ 7 = "Now you will practice doing both parts of the experiment at the same time.~r~r
In the next practice set, you will be given one of the math problems.
Once you make your decision about the math problem,
a letter and lightbulb will appear on the screen. Try and remember the letter.~r
In the previous section where you only solved math problems,
the computer computed your average time to solve the problems.~r
If you take longer than your average time,
the computer will automatically move you onto the next letter part,
thus skipping the True or False part and will count that problem as a math error.~r
Therefore it is VERY important to solve the problems
as quickly and as accurately as possible.~r~r~r
<%expressions.buttoninstruct1%> to continue."
/ 8 = "After the letter and lightbulb go away, another math problem will appear,
and then another letter and lightbulb.~r
At the end of each set of letters and math problems, a recall screen will appear.
Use the mouse to select the letters you just saw.
Try your best to get the letters in the correct order.~r
It is important to work QUICKLY and ACCURATELY on the math.
Make sure you know the answer to the math problem
before clicking to the next screen.
You will not be told if your answer to the math problem is correct.~r
After the recall screen, you will be given feedback about your performance
regarding both the number of letters recalled and the percent correct on
the math problems.~r
Do you have any questions?~r~r~r
<%expressions.buttoninstruct1%> to continue."
/ 9 = "During the feedback, you will see a number in red in the top right of the screen.
This indicates your percent correct for the math problems
for the entire experiment.~r
It is VERY important for you to keep this at least at 85%.
For our purposes, we can only use data where the participant was at least
85% accurate on the math.~r
Therefore, you must perform at least at 85% on the math problems
WHILE doing your best to recall as many letters as possible.~r
Do you have any questions?~r~r~r
<%expressions.buttoninstruct1%> to try some practice problems."
/ 10 = "That is the end of the practice.~r~r
The real trials will look like the practice trials you just completed.
First you will get a math problem to solve, then a letter to remember.~r
When you see the recall screen, select the letters in the order presented.
If you forget a letter, <%expressions.buttoninstruct3%> the BLANK box to mark where it should go.~r
Some of the sets will have more math problems and letters than others.~r
It is important that you do your best on both the math problems and
the letter recall parts of this experiment.~r
Remember on the math you must work as QUICKLY and ACCURATELY as possible.
Also, remember to keep your math accuracy at 85% or above.~r
Do you have any questions?~r~r~r
If not, <%expressions.buttoninstruct1%> to begin the experiment."
/ 11 = "Thank you for your participation."
</item>

<item acting_instructions>
/ 1 = "The following trials have an additional instruction in comparison to the previous trials.~r~r
When a letter is presented and the light bulb is turned on, press the SPACEBAR to turn off the light.~r~r
However, if the letter is presented with a light bulb turned off, you do NOT have to press the SPACEBAR.~r~r~r
It is important that you do your best on both the math problems and the letter recall parts of this experiment.~r
Remember on the math you must work as QUICKLY and ACCURATELY as possible.~r
Also, remember to keep your math accuracy at 85% or above.~r
Do you have any questions?~r~r~r
If not, <%expressions.buttoninstruct1%> to begin the experiment."
</item>

<item demographics_instructions>
/ 1 = "This was the end of the test phase.~r~r
I would like to ask you to finalize your participation by answering some questions.~r
That will be the final task within this study.~r~r
Again, thank you for participating.~r~r~r
<%expressions.buttoninstruct1%> to continue."
</item>

<text scorereport>
/ items = ("~tResults for Subject #<%script.subjectid%>~r~r
    OSPAN Absolute Score:~t<%values.ospan%>
    OSPAN Total Correct:~t<%values.totalcorrectletters%>~r~r
    Math Total Errors:~t<%values.mathtotalerrors%>
    Math Speed Errors:~t<%values.mathspeederrors%>
    Math Accuracy Errors:~t<%values.mathaccerrors%>~r~r")
/ size = (80%, 80%)
/ position = (52%, 50%)
/ hjustify = left
/ vjustify = center
</text>


****************************************************************************************************
general instruction expressions: adjust the instruction text depending on device used to run script
****************************************************************************************************
<expressions>
/buttoninstruct1 = if (computer.touch && !computer.haskeyboard) {"tap the screen";} else {"click the mouse button";}
/buttoninstruct2 = if (computer.touch && !computer.haskeyboard) {"tap the letters you want to select";} else {"use the mouse to select each letter";}
/buttoninstruct3 = if (computer.touch && !computer.haskeyboard) {"tap";} else {"click";}
</expressions>


**************************************************************************************************************
**************************************************************************************************************
    EDITABLE LISTS: change editable lists here
**************************************************************************************************************
**************************************************************************************************************

**************************************************************************************************************
    Set Sizes for Letter Practice Phase
**************************************************************************************************************

<list PracLetterSetSize>
/ items = (2,2,3,3)
/ selectionmode = sequence
/ selectionrate = trial
</list>

**************************************************************************************************************
    Set Sizes for Letter & Math Practice Phase
**************************************************************************************************************
<list PracBothSetSize>
/ items = (2,2,2)
/ selectionmode = sequence
/ selectionrate = trial
</list>

**************************************************************************************************************
    Set Sizes for Letter & Math Test Phase
**************************************************************************************************************

<list TestBothSetSize>
/ items = (3,3,3,4,4,4,5,5,5,6,6,6,7,7,7)
</list>

**************************************************************************************************************
**************************************************************************************************************
    DEFAULTS
**************************************************************************************************************
**************************************************************************************************************
script requires Inquisit 5.0.0.0 or higher

<defaults>
/ canvassize = (100%,100%)
/ canvasaspectratio = (4,3)
/ screencolor = white
/ txcolor = black
/ txbgcolor = transparent
/ fontstyle = ("Arial", 4.0%, true)
/ inputdevice = mouse
/ minimumversion = "5.0.0.0"
/ halign = center
/ valign = center
</defaults>

**************************************************************************************************************
**************************************************************************************************************
    DATA
**************************************************************************************************************
**************************************************************************************************************

********************
raw data
********************

<data>
/ columns = (build, computer.platform, date, time, subject, group, blockcode, blocknum, trialcode, trialnum, latency, response, correct,
    values.currentsetsize, text.letters.currentitem, values.lightbulb_state values.mathproblemcount,
    text.MathProblem.currentitem, values.mathtrueanswer, values.mathanswer,
    values.mathcorrect, values.mathaccuracy, values.mathtotalerrors, values.mathaccerrors,
    values.mathspeederrors, values.mathtimeout, values.recalledletters,
    values.totalcorrectletters, values.totalrecalledsets, values.ospan)
/ labels = true
/ separatefiles = true
</data>

********************
summary data
********************

<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform, values.completed,
    values.ospan,
    values.totalcorrectletters, values.mathtotalerrors, values.mathspeederrors,
    values.mathaccerrors)
/ separatefiles = true
</summarydata>

**************************************************************************************************************
**************************************************************************************************************
    VALUES: automatically updated
**************************************************************************************************************
**************************************************************************************************************
            
/completed:                0 = script was not completed; 1 = script was completed (all conditions run)

<values AOSPAN>
/completed = 0
/ stopblock=0
/ learninginterval=1000
/ currentsetsize=0
/ lettercount=0
/ correctletters=0
/ totalcorrectletters=0
/ ospan=0
/ totalrecalledsets=0
/ recalledletters=""
/ recallcount=0
/ recalldelay=0
/ mathaccuracy=0
/ mathaccerrors=0
/ mathcurrenterrors=0
/ mathtotalerrors=0
/ mathspeederrors=0
/ mathtimeout=5000
/ mathproblemcount=0
/ matherrorswitch=1
/ mathcorrect=""
/ tmp_mathopt01=""
/ tmp_mathopt02=0
/ tmp_mathsign=""
/ tmp_mathopt02sign=""
/ mathtrueanswer=0
/ tmp_mathrand=0
/ mathanswer=0
/ tmp_initmath01=0
/ tmp_initmath02=0
</values>


**************************************************************************************************************
**************************************************************************************************************
    EXPRESSIONS
**************************************************************************************************************
**************************************************************************************************************
<expressions AOSPAN>
/ selectionmode = if(script.currentblock=="PracLetter")    PracLetterList else TestLetterList
</expressions>

**************************************************************************************************************
**************************************************************************************************************
    INSTRUCTIONS
**************************************************************************************************************
**************************************************************************************************************

<block InstrPracLetter>
/ trials = [1-3=instructions]
/ recorddata = false
</block>

<block InstrPracMath>
/ trials = [1-3=instructions]
/ recorddata = false
</block>

<block InstrPracBoth>
/ trials = [1-3=instructions]
/ recorddata = false
</block>

<block Instr_Non_Acting>
/ trials = [1=instructions]
/ recorddata = false
</block>

<block InstrActingBlock>
/ trials = [1=instructions_acting]
/ recorddata = false
</block>

<block InstrFinal>
/ trials = [1=instructions; 2=score_report]
/ recorddata = false
</block>

<trial instructions>
/ pretrialpause = 250
/ posttrialpause = 250
/ stimulustimes = [1=instructions]
/ validresponse = (lbuttondown)
/ responsetime = 2000
/ recorddata = false
</trial>

<text instructions>
/ items = instructions
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 2.5%, true)
/ size = (90%, 80%)
/ position = (50%, 50%)
/ select = sequence
/ resetinterval = 0
</text>

<trial instructions_acting>
/ pretrialpause = 250
/ posttrialpause = 250
/ stimulustimes = [1=instructions_acting]
/ validresponse = (lbuttondown)
/ responsetime = 2000
/ recorddata = false
</trial>

<text instructions_acting>
/ items = acting_instructions
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 2.5%, true)
/ size = (90%, 80%)
/ position = (50%, 50%)
/ resetinterval = 0
</text>

<trial instructions_demographics>
/ pretrialpause = 250
/ posttrialpause = 250
/ stimulustimes = [1=instructions_demographics]
/ validresponse = (lbuttondown)
/ responsetime = 2000
/ recorddata = false
</trial>

<text instructions_demographics>
/ items = demographics_instructions
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 2.5%, true)
/ size = (90%, 80%)
/ position = (50%, 50%)
/ resetinterval = 0
</text>

<block instructions_demographics>
/ trials = [1=instructions_demographics]
/ recorddata = false
</block>


**************************************************************************************************************
**************************************************************************************************************
    STIMULI: Letters
**************************************************************************************************************
**************************************************************************************************************

<text Letters>
/ items = ("F","P","Q","J","H","K","T","S","N","R","Y","L")
/ fontstyle = ("Arial", 5.0%, true)
/ erase = true(silver)
/ select = expressions.selectionmode
</text>

**************************************************************************************************************
    Empty Item Elements for Storing Presented and Recalled Letter Sequences
**************************************************************************************************************

<item PresentedLetters>
</item>

<item RecalledLetters>
</item>

**************************************************************************************************************
    Screen Layout Elements for the Letter Recall Grid
**************************************************************************************************************

<text F>
/ items = ("F")
/ position = (25%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text H>
/ items = ("H")
/ position = (50%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text J>
/ items = ("J")
/ position = (75%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text K>
/ items = ("K")
/ position = (25%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text L>
/ items = ("L")
/ position = (50%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text N>
/ items = ("N")
/ position = (75%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text P>
/ items = ("P")
/ position = (25%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text Q>
/ items = ("Q")
/ position = (50%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text R>
/ items = ("R")
/ position = (75%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text S>
/ items = ("S")
/ position = (25%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text T>
/ items = ("T")
/ position = (50%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text Y>
/ items = ("Y")
/ position = (75%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ erase = false
</text>

<text _>
/ items = ("BLANK")
/ position = (50%, 72%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clear>
/ items = ("CLEAR")
/ position = (18%, 87%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text exit>
/ items = ("EXIT")
/ position = (82%, 87%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickF>
/ items = ("F")
/ position = (25%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickH>
/ items = ("H")
/ position = (50%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickJ>
/ items = ("J")
/ position = (75%, 18%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickK>
/ items = ("K")
/ position = (25%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickL>
/ items = ("L")
/ position = (50%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickN>
/ items = ("N")
/ position = (75%, 33%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickP>
/ items = ("P")
/ position = (25%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickQ>
/ items = ("Q")
/ position = (50%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickR>
/ items = ("R")
/ position = (75%, 48%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickS>
/ items = ("S")
/ position = (25%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickT>
/ items = ("T")
/ position = (50%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text clickY>
/ items = ("Y")
/ position = (75%, 63%)
/ size = (5%, 6%)
/ hjustify = center
/ vjustify = center
/ txbgcolor = silver
/ erase = false
</text>

<text click_>
/ items = ("BLANK")
/ position = (50%, 72%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txcolor = white
/ txbgcolor = black
/ erase = false
</text>

<text clickclear>
/ items = ("CLEAR")
/ position = (18%, 87%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txcolor = white
/ txbgcolor = black
/ erase = false
</text>

<text clickexit>
/ items = ("EXIT")
/ position = (82%, 87%)
/ size = (13%, 5%)
/ hjustify = center
/ vjustify = center
/ txcolor = white
/ txbgcolor = black
/ erase = false
</text>

<text recalledletters>
/ items = ("<%values.recalledletters%>")
/ position = (50%, 80%)
/ txcolor = red
/ erase = false
</text>

<text recallprompt>
/ items = ("Select the letters in the order presented. Use the blank button to fill in forgotten items.")
/ position = (50%, 5%)
/ size = (95%, 5%)
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 2.5%, true)
/ erase = false
</text>

<text LetterFeedback>
/ items = ("You recalled <%values.correctletters%> out of <%values.lettercount%> letters correctly.")
/ fontstyle = ("Arial", 3.5%, true)
/ position = (50%, 45%)
/ erase = true(white)
</text>

**************************************************************************************************************
**************************************************************************************************************
    STIMULI: Math
**************************************************************************************************************
**************************************************************************************************************

**************************************************************************************************************
    Math Problems (Practice Phase)
**************************************************************************************************************
**************************************************************************************************************

**************************************************************************************************************
**************************************************************************************************************
<text PracMathProblem>
/ items = PracMathProblem
/ position = (50%, 45%)
/ fontstyle = ("Arial", 3.5%, true)
/ erase = true(silver)
/ select = PracMathList
</text>

<text PracMathAnswer>
/ items = PracMathAnswer
/ fontstyle = ("Arial", 3.5%, true)
/ position = (50%, 30%)
/ erase = false
/ select = current(PracMathProblem)
</text>

<text PracMathFeedback>
/ items = ("You were correct on <%trial.prac_solve_math.totalcorrectcount%> of <%list.PracMathList.itemcount%> math trials.
That is <%trial.prac_solve_math.totalpercentcorrect%> percent correct.~r~r~r
Click the left mouse button to continue.")
/ fontstyle = ("Arial", 2.5%, true)
/ size = (65%, 50%)
/ position = (50%, 50%)
/ vjustify = center
</text>

**************************************************************************************************************
    Text and Layout Items used for the Math Trials
**************************************************************************************************************

<text MathProblemDisplay>
/ items = ("<%text.MathProblem.currentitem%> = ?")
/ fontstyle = ("Arial", 3.5%, true)
/ hjustify = left
/ position = (50%, 45%)
/ erase = true(silver)
</text>

<text MathProblem>
/ items = ("<%values.tmp_mathopt01%> <%values.tmp_mathsign%> <%values.tmp_mathopt02%>")
/ fontstyle = ("Arial", 3.5%, true)
/ hjustify = left
/ position = (50%, 45%)
/ erase = true(silver)
</text>

<text MathCorrect>
/ items = ("<%text.MathCorrect.selectedvalue%>")
/ select = noreplace
/ fontstyle = ("Arial", 3.5%, true)
/ position = (50%, 60%)
/ erase = true(silver)
</text>

<text MathAnswer>
/ items = ("<%values.mathanswer%>")
/ fontstyle = ("Arial", 3.5%, true)
/ position = (50%, 30%)
/ erase = true(silver)
</text>

<text MathScore>
/ items = ("<%values.mathaccuracy%>%")
/ fontstyle = ("Arial", 4.0%, true)
/ position = (85%, 15%)
/ size = (10%, 10%)
</text>

<text MathFeedback>
/ items = (
"You made <%values.mathcurrenterrors%> math error(s) on this set of trials.",
"You have made a total of 3 or more math errors during this set of trials. Please do your best on the math.")
/ select = values.matherrorswitch
/ position = (50%, 65%)
/ size = (80%, 30%)
/ fontstyle = ("Arial", 3.0%, true)
</text>

<text TRUE>
/ items = ("TRUE")
/ position = (31%, 52%)
/ size = (10%, 5%)
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 3.0%, true)
/ txbgcolor = white
/ erase = false
</text>

<text FALSE>
/ items = ("FALSE")
/ position = (69%, 52%)
/ size = (10%, 5%)
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 3.0%, true)
/ txbgcolor = white
/ erase = false
</text>

<text TestMathPrompt>
/ items = ("Click the left mouse button to continue.")
/ fontstyle = ("Arial", 2.7%, true)
/ position = (50%, 65%)
/ size = (60%, 10%)
/ erase = false
</text>

<text PracMathPrompt>
/ items = ("When you have solved the math problem,~nclick the left mouse button to continue.")
/ fontstyle = ("Arial", 2.7%, true)
/ position = (50%, 65%)
/ size = (60%, 10%)
/ erase = true(silver)
</text>

<text correcttext>
/ items = ("Correct")
/ position = (50%, 72%)
/ fontstyle = ("Arial", 3.0%, true)
/ txcolor = blue
/ size = (15%, 5%)
/ hjustify = center
/ vjustify = center
/ erase = true(silver)
</text>

<text incorrecttext>
/ items = ("Incorrect")
/ position = (50%, 72%)
/ fontstyle = ("Arial", 3.0%, true)
/ txcolor = blue
/ size = (15%, 5%)
/ hjustify = center
/ vjustify = center
/ erase = true(silver)
</text>

**************************************************************************************************************
**************************************************************************************************************
    STIMULI: General Purpose Screen Layout Items
**************************************************************************************************************
**************************************************************************************************************
<shape GrayFrame>
/ shape = rectangle
/ color = silver
/ size = (78.3%, 78%)
/ erase = false
</shape>

<shape BlackFrame>
/ shape = rectangle
/ color = black
/ size = (80%, 80%)
/ position = (50%, 50%)
/ erase = false
</shape>

<shape WhiteScreen>
/ shape = rectangle
/ color = white
/ size = (100%, 100%)
/ position = (50%, 50%)
/ erase = false
</shape>

**************************************************************************************************************
**************************************************************************************************************
    LISTS:
**************************************************************************************************************
**************************************************************************************************************

*******************************
Item Selection
*******************************
<list PracLetterList>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12)
/ selectionmode = sequence
/ selectionrate = trial
</list>

<list TestLetterList>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12)
</list>

<list PracMathList>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
</list>

*******************************
Math
*******************************

<list PracMathCorrect>
/ items = (
    "TRUE", "FALSE", "TRUE", "TRUE", "FALSE", "FALSE", "TRUE", "FALSE",
    "TRUE", "FALSE", "FALSE", "TRUE", "FALSE", "TRUE", "TRUE", "FALSE")
/ selectionmode = text.PracMathProblem.currentindex
</list>

**************************************************************************************************************
    Math Problems (Test Phase)
**************************************************************************************************************

<list MathOpt01>
/ items = (
    "(1/1)", "(2/1)", "(2/2)", "(3/1)", "(3/3)", "(4/1)", "(4/2)", "(4/4)",
    "(5/1)", "(5/5)", "(6/1)", "(6/2)", "(6/3)", "(6/6)", "(7/1)", "(7/7)",
    "(8/1)", "(8/2)", "(8/4)", "(8/8)", "(9/1)", "(9/3)", "(9/9)", "(1*2)",
    "(1*3)", "(2*2)", "(1*4)", "(1*5)", "(3*2)", "(2*3)", "(1*6)", "(1*7)",
    "(4*2)", "(2*4)", "(1*8)", "(3*3)", "(1*9)", "(5*2)", "(2*5)", "(6*2)",
    "(4*3)", "(3*4)", "(2*6)", "(7*2)", "(2*7)", "(5*3)", "(3*5)", "(8*2)")
/ selectionrate = trial
</list>

<list MathDifficulty>
/ items = (
    "1", "1", "1", "1", "1", "1", "1", "1",
    "1", "1", "1", "1", "1", "1", "1", "1",
    "1", "1", "1", "1", "1", "1", "1", "1",
    "1", "1", "1", "1", "1", "1", "1", "1",
    "1", "1", "1", "1", "1", "2", "2", "2",
    "2", "2", "2", "2", "2", "2", "2", "2")
/ selectionmode = list.MathOpt01.currentindex
</list>

<list MathOpt02>
/ items = (
    "1", "2", "3", "4", "5", "6", "7", "8", "9",
    "1", "2", "3", "4", "5", "6", "7", "8", "9")
</list>

<list MathSign>
/ items = (
    "+", "+", "+", "+", "+", "+", "+", "+", "+",
    "-", "-", "-", "-", "-", "-", "-", "-", "-")
</list>

<list MathCorrect>
/ items = (
    "TRUE", "TRUE", "TRUE", "TRUE", "TRUE",
    "FALSE", "FALSE", "FALSE", "FALSE", "FALSE")
</list>

<list MathRand>
/ items = (
    "1", "2", "3", "4", "5", "6", "7", "8", "9",
    "-1", "-2", "-3", "-4", "-5", "-6", "-7", "-8", "-9")
</list>

**************************************************************************************************************
**************************************************************************************************************
    TRIALS: Letters

**************************************************************************************************************
    Initialization Trial for the Different Study Phases
**************************************************************************************************************

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
    values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
    {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
    {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
    {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>


<trial show_letter_practice>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_practice_letter.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_practice_letter currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_nonacting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_nonacting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_nonacting, currentsetsize]
/ trialduration = values.learninginterval
/ validresponse = (noresponse)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Non_Acting")trial.show_letter_nonacting else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial show_letter_acting>
/ ontrialbegin = [values.lettercount+=1]
/ ontrialbegin = [values.lightbulb_state = list.lightbulbstates_acting.nextvalue]
/ ontrialend= [item.PresentedLetters.item=text.Letters.currentitem]
/ pretrialpause = 200
/ stimulusframes = [1=BlackFrame, GrayFrame, Letters, lightbulb_acting, currentsetsize]
/ trialduration = values.learninginterval
/ inputdevice = keyboard
/ validresponse = (57)
/ branch = [if(values.lettercount==values.currentsetsize)trial.recall_letter]
/ branch = [if(script.currentblock=="Acting")trial.show_letter_acting else trial.InitMathProblem01]
/ recorddata = true
</trial>

<trial recall_letter>
/ ontrialbegin = [values.recallcount+=1]
/ ontrialbegin = [if(values.recallcount==1)values.recalldelay=500 else values.recalldelay=0]
/ pretrialpause = values.recalldelay
/ stimulusframes = [1=WhiteScreen, F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit, recalledletters, recallprompt, letterstrings]
/ validresponse = (F, H, J, K, L, N, P, Q, R, S, T, Y, _, clear, exit)
/ monkeyresponse = ("F", "H", "J", "K", "exit")
/ ontrialend = [if(trial.recall_letter.response!="exit" && trial.recall_letter.response!="clear")
    {item.RecalledLetters.item=trial.recall_letter.response; values.recalledletters=concat(values.recalledletters, trial.recall_letter.response)}]
/ ontrialend = [if(trial.recall_letter.response=="clear")
    {clear(item.RecalledLetters); values.recalledletters=""}]
/ responsemessage = (F, clickF, 150)
/ responsemessage = (H, clickH, 150)
/ responsemessage = (J, clickJ, 150)
/ responsemessage = (K, clickK, 150)
/ responsemessage = (L, clickL, 150)
/ responsemessage = (N, clickN, 150)
/ responsemessage = (P, clickP, 150)
/ responsemessage = (Q, clickQ, 150)
/ responsemessage = (R, clickR, 150)
/ responsemessage = (S, clickS, 150)
/ responsemessage = (T, clickT, 150)
/ responsemessage = (Y, clickY, 150)
/ responsemessage = (clear, clickclear, 150)
/ responsemessage = (exit, clickexit, 150)
/ responsemessage = (_, click_, 150)
/ branch = [if(trial.recall_letter.response=="exit")trial.letter_feedback else trial.recall_letter]
/ recorddata = true
</trial>

<trial letter_feedback>
/ pretrialpause = 500
/ ontrialbegin = [values.correctletters=0]
/ ontrialbegin = [if(values.mathcurrenterrors>=3)values.matherrorswitch=2 else values.matherrorswitch=1]
/ ontrialbegin = [
    if(item.RecalledLetters.item.1 != "" && item.PresentedLetters.item.1==item.RecalledLetters.item.1)values.correctletters+=1;
    if(item.RecalledLetters.item.2 != "" && item.PresentedLetters.item.2==item.RecalledLetters.item.2)values.correctletters+=1;
    if(item.RecalledLetters.item.3 != "" && item.PresentedLetters.item.3==item.RecalledLetters.item.3)values.correctletters+=1;
    if(item.RecalledLetters.item.4 != "" && item.PresentedLetters.item.4==item.RecalledLetters.item.4)values.correctletters+=1;
    if(item.RecalledLetters.item.5 != "" && item.PresentedLetters.item.5==item.RecalledLetters.item.5)values.correctletters+=1;
    if(item.RecalledLetters.item.6 != "" && item.PresentedLetters.item.6==item.RecalledLetters.item.6)values.correctletters+=1;
    if(item.RecalledLetters.item.7 != "" && item.PresentedLetters.item.7==item.RecalledLetters.item.7)values.correctletters+=1;
    if(item.RecalledLetters.item.8 != "" && item.PresentedLetters.item.8==item.RecalledLetters.item.8)values.correctletters+=1;
    if(item.RecalledLetters.item.9 != "" && item.PresentedLetters.item.9==item.RecalledLetters.item.9)values.correctletters+=1;
    if(item.RecalledLetters.item.10 != "" && item.PresentedLetters.item.10==item.RecalledLetters.item.10)values.correctletters+=1;
    if(item.RecalledLetters.item.11 != "" && item.PresentedLetters.item.11==item.RecalledLetters.item.11)values.correctletters+=1;
    if(item.RecalledLetters.item.12 != "" && item.PresentedLetters.item.12==item.RecalledLetters.item.12)values.correctletters+=1]
/ ontrialbegin = [if(values.correctletters==values.currentsetsize)
    {values.ospan=values.ospan+values.correctletters; values.totalrecalledsets+=1}]
/ ontrialbegin = [values.totalcorrectletters=values.totalcorrectletters+values.correctletters]
/ ontrialend = [values.mathcurrenterrors=0]
/ ontrialend = [if(script.currentblock=="PracLetter" && list.PracLetterSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="PracBoth" && list.PracBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Non_Acting" && list.TestBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ ontrialend = [if(script.currentblock=="Acting" && list.TestBothSetSize.unselectedcount==0)
    {values.stopblock=1}]
/ stimulusframes = [1=WhiteScreen, LetterFeedback, MathFeedback, MathScore, scoredebug]
/ validresponse = (noresponse)
/ trialduration = 2000
/ branch = [trial.InitSetSize]
/ recorddata = true
</trial>

<trial prac_show_math>
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathProblem, PracMathPrompt]
/ validresponse = (lbuttondown)
/ branch = [trial.prac_solve_math]
/ recorddata = true
</trial>

<trial prac_solve_math>
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, PracMathAnswer, TRUE, FALSE]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (list.PracMathCorrect.nextvalue)
/ responsemessage = (anyresponse, PracMathAnswer, 800)
/ correctmessage = true(correcttext, 800)
/ errormessage = true(incorrecttext, 800)
/ branch = [if(trial.prac_show_math.trialcount >= list.PracMathList.itemcount)
    trial.prac_math_feedback else trial.prac_show_math]
/ recorddata = true
</trial>

<trial prac_math_feedback>
/ ontrialend = [values.stopblock=1]
/ pretrialpause = 500
/ stimulusframes = [1=WhiteScreen, PracMathFeedback]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>

<trial InitMathProblem01>
/ ontrialbegin = [values.tmp_initmath01+=1]
/ ontrialbegin = [if(values.tmp_initmath01==1)
    {values.tmp_mathopt01=list.MathOpt01.nextvalue;
    values.tmp_mathsign=list.MathSign.nextvalue;
    values.tmp_mathopt02=list.MathOpt02.nextvalue;
    values.mathcorrect=list.MathCorrect.nextvalue;
    values.tmp_mathopt02sign=concat(values.tmp_mathsign, values.tmp_mathopt02);
    values.tmp_mathopt02sign=evaluate(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1)
    {values.tmp_mathopt02sign+=3;
    values.tmp_mathopt02=abs(values.tmp_mathopt02sign)}]
/ ontrialbegin = [if(values.tmp_initmath01>1 && values.tmp_mathopt02sign>0)
    values.tmp_mathsign="+"]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem);
    values.mathtrueanswer=values.mathanswer]
/ branch = [if(values.mathanswer<0)trial.InitMathProblem01]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="TRUE")trial.show_math]
/ branch = [if(values.mathanswer>=0 && values.mathcorrect=="FALSE")trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial InitMathProblem02>
/ ontrialbegin = [values.tmp_initmath02+=1]
/ ontrialbegin = [if(values.tmp_initmath02==1)values.tmp_mathrand=list.MathRand.nextvalue]
/ ontrialbegin = [if(values.tmp_initmath02>1)values.tmp_mathrand+=2]
/ ontrialend = [values.mathanswer=evaluate(text.MathProblem.currentitem)+values.tmp_mathrand]
/ branch = [if(values.mathanswer>=0 && values.mathanswer!=values.mathtrueanswer)trial.show_math else trial.InitMathProblem02]
/ trialduration = 0
/ validresponse = (noresponse)
/ recorddata = false
</trial>

<trial show_math>
/ ontrialbegin = [values.tmp_initmath01=0; values.tmp_initmath02=0;
    values.mathproblemcount+=1]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathProblemDisplay, TestMathPrompt, mathtimeout]
/ validresponse = (lbuttondown)
/ timeout = values.mathtimeout
/ ontrialend = [if(trial.show_math.response!="lbuttondown")
    {values.mathcurrenterrors+=1; values.mathspeederrors+=1; values.mathtotalerrors+=1}]
/ branch = [if(trial.show_math.response!="lbuttondown")trial.show_letter_nonacting else trial.solve_math]
/ recorddata = true
</trial>

<trial solve_math>
/ ontrialend = [if(trial.solve_math.correct==0)
    {values.mathcurrenterrors+=1; values.mathaccerrors+=1; values.mathtotalerrors+=1}]
/ ontrialend = [values.mathaccuracy=round(((values.mathproblemcount-values.mathtotalerrors)/values.mathproblemcount)*100)]
/ pretrialpause = 500
/ stimulusframes = [1=BlackFrame, GrayFrame, MathAnswer, TRUE, FALSE, mathdebug]
/ validresponse = (TRUE, FALSE)
/ correctresponse = (values.mathcorrect)
/ branch = [trial.show_letter_nonacting]
/ recorddata = true
</trial>

**************************************************************************************************************
**************************************************************************************************************
    SCORING
**************************************************************************************************************
**************************************************************************************************************

<trial score_report>
/ stimulusframes = [1=scorereport]
/ validresponse = (lbuttondown)
/ recorddata = false
</trial>

**************************************************************************************************************
**************************************************************************************************************
    BLOCKS
**************************************************************************************************************
**************************************************************************************************************

<block PracLetter>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=white; text.MathScore.textcolor=white; values.stopblock=0]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=InitSetSize]
</block>

<block PracMath>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [values.mathaccuracy=0]
/ onblockend = [values.mathtimeout=(2.5*trial.prac_show_math.totalsdlatency)+trial.prac_show_math.totalmeanlatency]
/ onblockend = [values.stopblock=0]
/ stop = [values.stopblock==1]
/ trials = [1=prac_show_math]
</block>

<block PracBoth>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

<block Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=instructions_acting; 2=InitSetSize]
</block>

<expt AOSPAN>
/ onexptbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ blocks = [1=InstrPracLetter; 2=PracLetter; 3=InstrPracMath; 4=PracMath;
    5=InstrPracBoth; 6=PracBoth; 7=Instr_Non_Acting; 8=Non_Acting; 9=Acting; 10=instructions_demographics;11=demographic_questions; 12=InstrFinal]
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************
**************************************************************************************************************
    DEBUG: On-Screen Debugging Items
**************************************************************************************************************
**************************************************************************************************************
    These items are invisible by default.
    Enter 'debug' as subject id to enable them.

<text currentsetsize>
/ items = (    "Setsize: <%values.currentsetsize%> / Lettercount: <%values.lettercount%>")
/ fontstyle = ("Arial", 2.5%, true)
/ txcolor = blue
/ size = (50%, 5%)
/ position = (50%, 5%)
</text>

<text letterstrings>
/ items = ("~tPresented Letters:~t<%item.PresentedLetters.item.1%><%item.PresentedLetters.item.2%><%item.PresentedLetters.item.3%><%item.PresentedLetters.item.4%><%item.PresentedLetters.item.5%><%item.PresentedLetters.item.6%><%item.PresentedLetters.item.7%><%item.PresentedLetters.item.8%><%item.PresentedLetters.item.9%><%item.PresentedLetters.item.10%><%item.PresentedLetters.item.11%><%item.PresentedLetters.item.12%>
~tRecalled Letters:~t<%item.RecalledLetters.item.1%><%item.RecalledLetters.item.2%><%item.RecalledLetters.item.3%><%item.RecalledLetters.item.4%><%item.RecalledLetters.item.5%><%item.RecalledLetters.item.6%><%item.RecalledLetters.item.7%><%item.RecalledLetters.item.8%><%item.RecalledLetters.item.9%><%item.RecalledLetters.item.10%><%item.RecalledLetters.item.11%><%item.RecalledLetters.item.12%>")
/ fontstyle = ("Arial", 2.5%, true)
/ txcolor = blue
/ size = (55%, 5%)
/ position = (50%, 87%)
/ hjustify = left
/ vjustify = center
/ erase = false
</text>

<text mathdebug>
/ items = ("~tMath Problem:~t~t<% text.MathProblem.currentitem %>~r
~tTrue Answer:~t~t<% values.mathtrueanswer %>~r
~tPresented Answer:~t<% values.mathcorrect %>~r~r")
/ size = (50%, 7%)
/ halign = center
/ hjustify = center
/ position = (45%, 70%)
/ fontstyle = ("Arial", 2.5%, true)
/ txcolor = blue
/ erase = true(silver)
</text>

<text mathtimeout>
/ items = ("Timeout = <%values.mathtimeout%> ms~r
Math Problem # <%values.mathproblemcount%>")
/ fontstyle = ("Arial", 2.5%, true)
/ txcolor = blue
/ size = (50%, 5%)
/ position = (50%, 20%)
/ erase = true(silver)
</text>

<text scoredebug>
/ items = ("OSPAN Score:~t~t<% values.ospan %>
Total Number Correct:~t<% values.totalcorrectletters %>~r~r
Math Errors (Total):~t<% values.mathtotalerrors %>
Math Speed Errors:~t<% values.mathspeederrors %>
Math Accuracy Errors:~t<% values.mathaccerrors %>~r~r")
/ fontstyle = ("Arial", 2.5%, true)
/ txcolor = blue
/ size = (50%, 5%)
/ position = (50%, 75%)
/ erase = true(white)
</text>

<monkey AOSPAN>
/ latencydistribution = normal(800, 200)
/ percentcorrect = 100
</monkey>


Please attach the script file instead of pasting the code into a post's body. Thank you.
By Dave - 3/12/2020

You wrote:

"1. In the Prac_both block are 4 trials: 2 trials of setsize 2 and 2 trials of setsize 3. Three out of 4 trials have the correct sequence; show_math, solve_math, show_letter_practice, recall_letter, and letter_feedback. In one of these 4 trials, the solve_math isn't invoked. "

There aren't 2 trials of setsize 2 and 2 trials of setsize 3 for the prac_both block in the code you pasted. The list controlling the set sizes for that block has 3 times the set size 2.

<list PracBothSetSize>
/ items = (2,2,2)
/ selectionmode = sequence
/ selectionrate = trial
</list>

You further stated ( https://www.millisecond.com/forums/FindPost28514.aspx ) that you had integrated the logic for the additional blocks in your init trial. The init trial in the code you posted contains no such extended logic:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
  values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
  {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
  {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
  {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

Similarly, the two additional <list> elements you mention in https://www.millisecond.com/forums/FindPost28514.aspx are nowhere to be found in the code you posted.

So, can I please get the actual, correct script from you? Obviously you are working with something else than what you ended up posting. Thank you.
By MilanSchoenmaeckers - 3/12/2020

Dave - 3/12/2020
You wrote:

"1. In the Prac_both block are 4 trials: 2 trials of setsize 2 and 2 trials of setsize 3. Three out of 4 trials have the correct sequence; show_math, solve_math, show_letter_practice, recall_letter, and letter_feedback. In one of these 4 trials, the solve_math isn't invoked. "

There aren't 2 trials of setsize 2 and 2 trials of setsize 3 for the prac_both block in the code you pasted. The list controlling the set sizes for that block has 3 times the set size 2.

<list PracBothSetSize>
/ items = (2,2,2)
/ selectionmode = sequence
/ selectionrate = trial
</list>

You further stated ( https://www.millisecond.com/forums/FindPost28514.aspx ) that you had integrated the logic for the additional blocks in your init trial. The init trial in the code you posted contains no such extended logic:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
  values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
  {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
  {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
  {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

Similarly, the two additional <list> elements you mention in https://www.millisecond.com/forums/FindPost28514.aspx are nowhere to be found in the code you posted.

So, can I please get the actual, correct script from you? Obviously you are working with something else than what you ended up posting. Thank you.
My apologies! After your comments previously today, I tried to solve my problem by making an InitSetSize_NonActing and InitSetSize_Acting. However, it didn't work and I forgot to update this in my previous comment. 

Attached is the file that I'm currently working in.
By Dave - 3/12/2020

MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
You wrote:

"1. In the Prac_both block are 4 trials: 2 trials of setsize 2 and 2 trials of setsize 3. Three out of 4 trials have the correct sequence; show_math, solve_math, show_letter_practice, recall_letter, and letter_feedback. In one of these 4 trials, the solve_math isn't invoked. "

There aren't 2 trials of setsize 2 and 2 trials of setsize 3 for the prac_both block in the code you pasted. The list controlling the set sizes for that block has 3 times the set size 2.

<list PracBothSetSize>
/ items = (2,2,2)
/ selectionmode = sequence
/ selectionrate = trial
</list>

You further stated ( https://www.millisecond.com/forums/FindPost28514.aspx ) that you had integrated the logic for the additional blocks in your init trial. The init trial in the code you posted contains no such extended logic:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
  values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
  {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
  {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
  {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

Similarly, the two additional <list> elements you mention in https://www.millisecond.com/forums/FindPost28514.aspx are nowhere to be found in the code you posted.

So, can I please get the actual, correct script from you? Obviously you are working with something else than what you ended up posting. Thank you.
My apologies! After your comments previously today, I tried to solve my problem by making an InitSetSize_NonActing and InitSetSize_Acting. However, it didn't work and I forgot to update this in my previous comment. 

Attached is the file that I'm currently working in.

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
  values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
  {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
  {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_NonActing")
  {values.currentsetsize=list.Non_ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_Acting")
  {values.currentsetsize=list.ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

That's not what those blocks are actually called in your script. They're called "Non_Acting"

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

and "Acting"

<block Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=instructions_acting; 2=InitSetSize]
</block>

For the rest, review the attached revision closely, please.
By MilanSchoenmaeckers - 3/13/2020

Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
You wrote:

"1. In the Prac_both block are 4 trials: 2 trials of setsize 2 and 2 trials of setsize 3. Three out of 4 trials have the correct sequence; show_math, solve_math, show_letter_practice, recall_letter, and letter_feedback. In one of these 4 trials, the solve_math isn't invoked. "

There aren't 2 trials of setsize 2 and 2 trials of setsize 3 for the prac_both block in the code you pasted. The list controlling the set sizes for that block has 3 times the set size 2.

<list PracBothSetSize>
/ items = (2,2,2)
/ selectionmode = sequence
/ selectionrate = trial
</list>

You further stated ( https://www.millisecond.com/forums/FindPost28514.aspx ) that you had integrated the logic for the additional blocks in your init trial. The init trial in the code you posted contains no such extended logic:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
  values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
  {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
  {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
  {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

Similarly, the two additional <list> elements you mention in https://www.millisecond.com/forums/FindPost28514.aspx are nowhere to be found in the code you posted.

So, can I please get the actual, correct script from you? Obviously you are working with something else than what you ended up posting. Thank you.
My apologies! After your comments previously today, I tried to solve my problem by making an InitSetSize_NonActing and InitSetSize_Acting. However, it didn't work and I forgot to update this in my previous comment. 

Attached is the file that I'm currently working in.

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
  values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
  {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
  {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_NonActing")
  {values.currentsetsize=list.Non_ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_Acting")
  {values.currentsetsize=list.ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

That's not what those blocks are actually called in your script. They're called "Non_Acting"

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

and "Acting"

<block Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=instructions_acting; 2=InitSetSize]
</block>

For the rest, review the attached revision closely, please.

Thank you for your time and patience working on this revision.

After reviewing, it seems that there is one remaining issue. In the prac_both, nonacting_block, and acting_block, a trial should look (depending on the set size) look like this: a math problem is shown, followed by the solution, and next the letter with a light bulb, followed by the recall screen after the amount of letters for the set have been shown, and the feedback on this recall. However, some trials do not invoke the answer to the math problem. How should I solve this issue?

All other blocks and stimuli work perfectly fine. 
By Dave - 3/13/2020

MilanSchoenmaeckers - 3/13/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
You wrote:

"1. In the Prac_both block are 4 trials: 2 trials of setsize 2 and 2 trials of setsize 3. Three out of 4 trials have the correct sequence; show_math, solve_math, show_letter_practice, recall_letter, and letter_feedback. In one of these 4 trials, the solve_math isn't invoked. "

There aren't 2 trials of setsize 2 and 2 trials of setsize 3 for the prac_both block in the code you pasted. The list controlling the set sizes for that block has 3 times the set size 2.

<list PracBothSetSize>
/ items = (2,2,2)
/ selectionmode = sequence
/ selectionrate = trial
</list>

You further stated ( https://www.millisecond.com/forums/FindPost28514.aspx ) that you had integrated the logic for the additional blocks in your init trial. The init trial in the code you posted contains no such extended logic:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
  values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
  {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
  {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
  {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

Similarly, the two additional <list> elements you mention in https://www.millisecond.com/forums/FindPost28514.aspx are nowhere to be found in the code you posted.

So, can I please get the actual, correct script from you? Obviously you are working with something else than what you ended up posting. Thank you.
My apologies! After your comments previously today, I tried to solve my problem by making an InitSetSize_NonActing and InitSetSize_Acting. However, it didn't work and I forgot to update this in my previous comment. 

Attached is the file that I'm currently working in.

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
  values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
  {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
  {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_NonActing")
  {values.currentsetsize=list.Non_ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_Acting")
  {values.currentsetsize=list.ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

That's not what those blocks are actually called in your script. They're called "Non_Acting"

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

and "Acting"

<block Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=instructions_acting; 2=InitSetSize]
</block>

For the rest, review the attached revision closely, please.

Thank you for your time and patience working on this revision.

After reviewing, it seems that there is one remaining issue. In the prac_both, nonacting_block, and acting_block, a trial should look (depending on the set size) look like this: a math problem is shown, followed by the solution, and next the letter with a light bulb, followed by the recall screen after the amount of letters for the set have been shown, and the feedback on this recall. However, some trials do not invoke the answer to the math problem. How should I solve this issue?

All other blocks and stimuli work perfectly fine. 

> However, some trials do not invoke the answer to the math problem.

You're misunderstanding the task. There is a performance-based timeout for the math problems. Only if you respond to the math problem screen *before the timeout runs out* will you get the answer screen.
By MilanSchoenmaeckers - 3/13/2020

Dave - 3/13/2020
MilanSchoenmaeckers - 3/13/2020
Dave - 3/12/2020
MilanSchoenmaeckers - 3/12/2020
Dave - 3/12/2020
You wrote:

"1. In the Prac_both block are 4 trials: 2 trials of setsize 2 and 2 trials of setsize 3. Three out of 4 trials have the correct sequence; show_math, solve_math, show_letter_practice, recall_letter, and letter_feedback. In one of these 4 trials, the solve_math isn't invoked. "

There aren't 2 trials of setsize 2 and 2 trials of setsize 3 for the prac_both block in the code you pasted. The list controlling the set sizes for that block has 3 times the set size 2.

<list PracBothSetSize>
/ items = (2,2,2)
/ selectionmode = sequence
/ selectionrate = trial
</list>

You further stated ( https://www.millisecond.com/forums/FindPost28514.aspx ) that you had integrated the logic for the additional blocks in your init trial. The init trial in the code you posted contains no such extended logic:

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
  values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
  {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
  {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth")
  {values.currentsetsize=list.TestBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

Similarly, the two additional <list> elements you mention in https://www.millisecond.com/forums/FindPost28514.aspx are nowhere to be found in the code you posted.

So, can I please get the actual, correct script from you? Obviously you are working with something else than what you ended up posting. Thank you.
My apologies! After your comments previously today, I tried to solve my problem by making an InitSetSize_NonActing and InitSetSize_Acting. However, it didn't work and I forgot to update this in my previous comment. 

Attached is the file that I'm currently working in.

<trial InitSetSize>
/ ontrialbegin = [values.currentsetsize=0; values.lettercount=0; values.correctletters=0;
  values.recallcount=0; values.recalledletters=""]
/ ontrialbegin = [if(script.currentblock=="PracLetter")
  {values.currentsetsize=list.PracLetterSetSize.nextvalue}]
/ ontrialbegin = [if(script.currentblock=="PracBoth")
  {values.currentsetsize=list.PracBothSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_NonActing")
  {values.currentsetsize=list.Non_ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialbegin = [if(script.currentblock=="TestBoth_Acting")
  {values.currentsetsize=list.ActingSetSize.nextvalue; reset(list.TestLetterList)}]
/ ontrialend = [clear(item.PresentedLetters); clear(item.RecalledLetters)]
/ branch = [if(script.currentblock=="PracLetter")trial.show_letter_practice else trial.InitMathProblem01]
/ validresponse = (noresponse)
/ trialduration = 0
/ recorddata = false
</trial>

That's not what those blocks are actually called in your script. They're called "Non_Acting"

<block Non_Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ onblockend = [values.stopblock=0]
/ trials = [1=InitSetSize]
</block>

and "Acting"

<block Acting>
/ onblockbegin = [if(script.subjectid!="debug")
    {text.currentsetsize.textcolor=white; text.letterstrings.textcolor=white;
    text.mathdebug.textcolor=silver; text.mathtimeout.textcolor=silver;
    text.scoredebug.textcolor=white}]
/ onblockbegin = [text.MathFeedback.textcolor=black; text.MathScore.textcolor=red]
/ onblockbegin = [values.mathcurrenterrors=0; values.mathaccuracy=0; values.mathaccerrors=0;
    values.mathtotalerrors=0; values.mathspeederrors=0; values.mathproblemcount=0;
    values.lettercount=0; values.correctletters=0; values.currentsetsize=0;
    values.recallcount=0; values.recalledletters=""; values.totalrecalledsets=0;
    values.totalcorrectletters=0; values.ospan=0]
/ stop = [values.stopblock==1]
/ trials = [1=instructions_acting; 2=InitSetSize]
</block>

For the rest, review the attached revision closely, please.

Thank you for your time and patience working on this revision.

After reviewing, it seems that there is one remaining issue. In the prac_both, nonacting_block, and acting_block, a trial should look (depending on the set size) look like this: a math problem is shown, followed by the solution, and next the letter with a light bulb, followed by the recall screen after the amount of letters for the set have been shown, and the feedback on this recall. However, some trials do not invoke the answer to the math problem. How should I solve this issue?

All other blocks and stimuli work perfectly fine. 

> However, some trials do not invoke the answer to the math problem.

You're misunderstanding the task. There is a performance-based timeout for the math problems. Only if you respond to the math problem screen *before the timeout runs out* will you get the answer screen.

Ofcourse! How stupid of my.I completely overlooked that it is performance-based with a timeout. Thank you for all your help with modifying the script for my master's thesis.