Millisecond Forums

Rapid stimulus presentation fails in trials after early responses

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

By AKrishna - 4/7/2019

Hello all,

I was working on a task in which participants must select a stimulus by pressing a key when it is highlighted by an on-screen frame and I noticed some odd behavior that I cannot seem to get rid of. The original code is a little complicated and annoying for other users to read, but I isolated the problem to some test code.

If I run the attached code on my workstation, the expected behavior is that the "Tester" trial repeats 100 times, showing a green frame that flickers from side to side of the screen. I should be able to press Space at any time during the trial to jump to the next one (which, of course, consists of more flickering). This seems to work as long as I don't respond, but if I do respond, some portions of the frame seem to "stick" in place in the subsequent trial instead of being covered up as they should be by the blocker stimulus.

Using the trial Tester2, I have reached the conclusion that this only happens when the response occurs before the final stimulus is presented. If I use Tester2 and wait until the frame stops moving to respond, there are no such graphical errors. I can't be quite sure of this though, as I haven't had time to test it extensively.

I tried some things to get rid of the problem, but nothing worked. For completeness, the following did NOT help:
- adding a pretrialpause
- adding a posttrialpause

I also checked a data file including a lot of stimulustime items and nothing seems odd there - all the trials produce identical stimulustimes rows.

I also tried a workaround in which I make each flicker a new trial and use /branch to repeat the trial until a response is logged or the timeout hits, but that led to a lot of responses not being logged (presumably if the space bar is hit during trial cleanup or preparation, which happens often when you have trials cycling with a duration of 50-75ms). I haven't yet tried that workaround while adding /beginresponsetime = -1, nor have I yet looked into using stimulusframes rather than stimulustimes, but I would of course prefer not to have to adjust these points if I don't have to.

Does anyone have any idea what might be going on here?




Example code:
<values>
/ BorderLeftPosition = 12.5
/ BorderRightPosition = 27.5
/ BorderTopPosition = 20
/ BorderBottomPosition = 20
</values>

<shape BorderLeftA>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (values.BorderLeftPosition,30)
</shape>

<shape BorderRightA>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (values.BorderRightPosition,30)
</shape>

<shape BorderTopA>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (values.BorderTopPosition,15)
</shape>

<shape BorderBottomA>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (values.BorderBottomPosition,45)
</shape>

<shape BorderLeftB>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (100-values.BorderLeftPosition,30)
</shape>

<shape BorderRightB>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (100-values.BorderRightPosition,30)
</shape>

<shape BorderTopB>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (100-values.BorderTopPosition,15)
</shape>

<shape BorderBottomB>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (100-values.BorderBottomPosition,45)
</shape>


<shape BorderLeftABlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (values.BorderLeftPosition,30)
</shape>

<shape BorderRightABlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (values.BorderRightPosition,30)
</shape>

<shape BorderTopABlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (values.BorderTopPosition,15)
</shape>

<shape BorderBottomABlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (values.BorderBottomPosition,45)
</shape>

<shape BorderLeftBBlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (100-values.BorderLeftPosition,30)
</shape>

<shape BorderRightBBlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (100-values.BorderRightPosition,30)
</shape>

<shape BorderTopBBlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (100-values.BorderTopPosition,15)
</shape>

<shape BorderBottomBBlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (100-values.BorderBottomPosition,45)
</shape>

<block Tester>
/ trials = [1-100 = Tester]
</block>


<trial Tester>
/ timeout = 2000
/ validresponse = (" ")
/ stimulustimes = [0 = BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
75 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
150 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
225 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
300 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
375 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
450 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
525 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
600 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
675 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
750 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
825 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
900 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
975 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1050 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1125 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1200 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1275 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1350 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1425 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1500 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1575 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1650 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1725 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1800 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1875 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1950 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA]
/ beginresponsetime = -1
</trial>



<trial Tester2>
/ timeout = 3000
/ validresponse = (" ")
/ stimulustimes = [0 = BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
400 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
800 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1200 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1600 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA]
/ beginresponsetime = -1
</trial>


By Dave - 4/7/2019

AKrishna - Monday, April 8, 2019
Hello all,

I was working on a task in which participants must select a stimulus by pressing a key when it is highlighted by an on-screen frame and I noticed some odd behavior that I cannot seem to get rid of. The original code is a little complicated and annoying for other users to read, but I isolated the problem to some test code.

If I run the attached code on my workstation, the expected behavior is that the "Tester" trial repeats 100 times, showing a green frame that flickers from side to side of the screen. I should be able to press Space at any time during the trial to jump to the next one (which, of course, consists of more flickering). This seems to work as long as I don't respond, but if I do respond, some portions of the frame seem to "stick" in place in the subsequent trial instead of being covered up as they should be by the blocker stimulus.

Using the trial Tester2, I have reached the conclusion that this only happens when the response occurs before the final stimulus is presented. If I use Tester2 and wait until the frame stops moving to respond, there are no such graphical errors. I can't be quite sure of this though, as I haven't had time to test it extensively.

I tried some things to get rid of the problem, but nothing worked. For completeness, the following did NOT help:
- adding a pretrialpause
- adding a posttrialpause

I also checked a data file including a lot of stimulustime items and nothing seems odd there - all the trials produce identical stimulustimes rows.

I also tried a workaround in which I make each flicker a new trial and use /branch to repeat the trial until a response is logged or the timeout hits, but that led to a lot of responses not being logged (presumably if the space bar is hit during trial cleanup or preparation, which happens often when you have trials cycling with a duration of 50-75ms). I haven't yet tried that workaround while adding /beginresponsetime = -1, nor have I yet looked into using stimulusframes rather than stimulustimes, but I would of course prefer not to have to adjust these points if I don't have to.

Does anyone have any idea what might be going on here?




Example code:
<values>
/ BorderLeftPosition = 12.5
/ BorderRightPosition = 27.5
/ BorderTopPosition = 20
/ BorderBottomPosition = 20
</values>

<shape BorderLeftA>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (values.BorderLeftPosition,30)
</shape>

<shape BorderRightA>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (values.BorderRightPosition,30)
</shape>

<shape BorderTopA>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (values.BorderTopPosition,15)
</shape>

<shape BorderBottomA>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (values.BorderBottomPosition,45)
</shape>

<shape BorderLeftB>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (100-values.BorderLeftPosition,30)
</shape>

<shape BorderRightB>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (100-values.BorderRightPosition,30)
</shape>

<shape BorderTopB>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (100-values.BorderTopPosition,15)
</shape>

<shape BorderBottomB>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (100-values.BorderBottomPosition,45)
</shape>


<shape BorderLeftABlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (values.BorderLeftPosition,30)
</shape>

<shape BorderRightABlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (values.BorderRightPosition,30)
</shape>

<shape BorderTopABlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (values.BorderTopPosition,15)
</shape>

<shape BorderBottomABlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (values.BorderBottomPosition,45)
</shape>

<shape BorderLeftBBlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (100-values.BorderLeftPosition,30)
</shape>

<shape BorderRightBBlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (100-values.BorderRightPosition,30)
</shape>

<shape BorderTopBBlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (100-values.BorderTopPosition,15)
</shape>

<shape BorderBottomBBlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (100-values.BorderBottomPosition,45)
</shape>

<block Tester>
/ trials = [1-100 = Tester]
</block>


<trial Tester>
/ timeout = 2000
/ validresponse = (" ")
/ stimulustimes = [0 = BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
75 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
150 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
225 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
300 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
375 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
450 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
525 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
600 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
675 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
750 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
825 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
900 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
975 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1050 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1125 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1200 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1275 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1350 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1425 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1500 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1575 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1650 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1725 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1800 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1875 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1950 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA]
/ beginresponsetime = -1
</trial>



<trial Tester2>
/ timeout = 3000
/ validresponse = (" ")
/ stimulustimes = [0 = BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
400 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
800 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1200 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1600 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA]
/ beginresponsetime = -1
</trial>



Try explicitly forcing a reset of the stimulus presentation sequence either /ontrialbegin or /ontrialend (either way should work in this case):

<trial Tester>
/ ontrialend = [
trial.Tester.resetstimulusframes();
]

/ timeout = 2000
/ validresponse = (" ")
/ stimulustimes = [0 = BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
75 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
150 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
225 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
300 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
375 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
450 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
525 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
600 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
675 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
750 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
825 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
900 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
975 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1050 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1125 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1200 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1275 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1350 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1425 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1500 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1575 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1650 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1725 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1800 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA;
1875 = BorderLeftABlocker, BorderBottomABlocker, BorderRightABlocker, BorderTopABlocker, BorderLeftB, BorderBottomB, BorderRightB, BorderTopB;
1950 = BorderLeftBBlocker, BorderBottomBBlocker, BorderRightBBlocker, BorderTopBBlocker, BorderLeftA, BorderBottomA, BorderRightA, BorderTopA]
/ beginresponsetime = -1
</trial>
By AKrishna - 4/7/2019

Excellent, that works! Unfortunately, it doesn't solve my problem in my main script. I have programmed my script to allow various flicker intervals to be flexible, so the script dynamically populates the trials during an earlier block. Using resetstimulusframes would get rid of that, correct? Is there any way to work around that or should I just port my "trial population" script to before each flicker trial? After all, I'm presenting other stimuli after participants respond, so the small intervals that processing these command would require are no bother.



To illustrate, here's a simplified version of what I'm working on with the extraneous stuff removed:


<expt Test>
/ blocks = [1 = Population; 2 = TestPhase]
</expt>

<block Population>
/ trials = [1 = PopulateSlowFlickerTrials]
</block>

### This trial iterates adding in blocker and flicker stimuli for each interval of "TestPhaseSlowFlickerInterval" ms until the total timeout is reached, then it goes to a trial that does the same for the fast flicker trials

<trial PopulateSlowFlickerTrials>
/ trialduration = 0
/ ontrialbegin = [values.TimeoutCounter += values.TestPhaseSlowFlickerInterval]
/ branch = [if (values.TimeoutCounter < values.TestPhaseTimeout && mod(values.TimeoutCounter/values.TestPhaseSlowFlickerInterval,2) == 1)
{trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderBottomABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderTopABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderRightABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderLeftABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderBottomB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderTopB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderRightB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderLeftB, values.TimeoutCounter);
trial.PopulateSlowFlickerTrials}
else if (values.TimeoutCounter < values.TestPhaseTimeout && mod(values.TimeoutCounter/values.TestPhaseSlowFlickerInterval,2) == 0)
{trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderBottomBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderTopBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderRightBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderLeftBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderBottomA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderTopA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderRightA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderLeftA, values.TimeoutCounter);
trial.PopulateSlowFlickerTrials}]
/ branch = [values.TimeoutCounter = 0; trial.PopulateFastFlickerTrials]
/ recorddata = false
</trial>

<trial PopulateFastFlickerTrials>
/ trialduration = 0
/ ontrialbegin = [values.TimeoutCounter += values.TestPhaseFastFlickerInterval]
/ branch = [if (values.TimeoutCounter < values.TestPhaseTimeout && mod(values.TimeoutCounter/values.TestPhaseFastFlickerInterval,2) == 1)
{trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderBottomABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderTopABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderRightABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderLeftABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderBottomB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderTopB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderRightB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderLeftB, values.TimeoutCounter);
trial.PopulateFastFlickerTrials}
else if (values.TimeoutCounter < values.TestPhaseTimeout && mod(values.TimeoutCounter/values.TestPhaseFastFlickerInterval,2) == 0)
{trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderBottomBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderTopBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderRightBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderLeftBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderBottomA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderTopA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderRightA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderLeftA, values.TimeoutCounter);
trial.PopulateFastFlickerTrials}]
/ recorddata = false
</trial>


### This block reads from a dynamic list that is populated using the values entered in the <values> element

<block TestPhase>
/ onblockbegin = [values.TrialCounter = 0]
/ trials = [1 = list.TestPhaseTrials]
</block>

<list TestPhaseTrials>
/ items = (trial.TestPhaseTrialFlickerFast, trial.TestPhaseTrialFlickerSlow)
/ itemprobabilities = (values.TestTrialsTotalPerBlock/values.TestTrialsTotalPerBlock-values.CatchTrialsPerTestBlock/values.TestTrialsTotalPerBlock, values.CatchTrialsPerTestBlock/values.TestTrialsTotalPerBlock)
/ poolsize = values.TestTrialsTotalPerBlock/2
</list>

### Here's a flicker trial, one of those that is populated above. Adding a resetstimulusframes here would destroy my work from above.

<trial TestPhaseTrialFlickerFast>
/ stimulustimes = [0 = BorderBottomA, BorderLeftA, BorderRightA, BorderTopA, PlayerA, PlayerB]
/ timeout = values.TestPhaseTimeout + values.TestPhaseFlickerPreTrialPause
/ validresponse = (" ")
/ branch = [if (trial.TestPhaseTrialFlickerFast.response == 0) {values.LastTestTrial = "Fast"; trial.TestPhaseTooSlow}]
/ branch = [trial.TestPhaseTrial]
/ recorddata = false
/ beginresponsetime = -1
</trial>


<shape BorderLeftA>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (values.BorderLeftPosition,30)
</shape>

<shape BorderRightA>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (values.BorderRightPosition,30)
</shape>

<shape BorderTopA>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (values.BorderTopPosition,15)
</shape>

<shape BorderBottomA>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (values.BorderBottomPosition,45)
</shape>

<shape BorderLeftB>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (100-values.BorderLeftPosition,30)
</shape>

<shape BorderRightB>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (100-values.BorderRightPosition,30)
</shape>

<shape BorderTopB>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (100-values.BorderTopPosition,15)
</shape>

<shape BorderBottomB>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (100-values.BorderBottomPosition,45)
</shape>


<shape BorderLeftABlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (values.BorderLeftPosition,30)
</shape>

<shape BorderRightABlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (values.BorderRightPosition,30)
</shape>

<shape BorderTopABlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (values.BorderTopPosition,15)
</shape>

<shape BorderBottomABlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (values.BorderBottomPosition,45)
</shape>

<shape BorderLeftBBlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (100-values.BorderLeftPosition,30)
</shape>

<shape BorderRightBBlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (100-values.BorderRightPosition,30)
</shape>

<shape BorderTopBBlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (100-values.BorderTopPosition,15)
</shape>

<shape BorderBottomBBlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (100-values.BorderBottomPosition,45)
</shape>

### Here's a flicker trial, one of those that is populated above. Adding a resetstimulusframes here would destroy my work from above.

<trial TestPhaseTrialFlickerSlow>
/ stimulustimes = [0 = BorderBottomA, BorderLeftA, BorderRightA, BorderTopA, PlayerA, PlayerB]
/ timeout = values.TestPhaseTimeout + values.TestPhaseFlickerPreTrialPause
/ validresponse = (" ")
/ branch = [if (trial.TestPhaseTrialFlickerSlow.response == 0) {values.LastTestTrial = "Slow"; trial.TestPhaseTooSlow}]
/ branch = [trial.TestPhaseCatchTrial]
/ recorddata = false
/ beginresponsetime = -1
</trial>


<trial TestPhaseTrial>
/ ontrialbegin = [values.TrialCounter += 1; values.TimeoutCounter = 0]
/ ontrialbegin = [if (list.TestPhaseOutcomes.nextvalue == values.AggressivePlayer) values.SelectedPlayer = "Aggressive Target"
else if (list.TestPhaseOutcomes.currentvalue == values.NonaggressivePlayer) values.SelectedPlayer = "Nonaggressive Target"]
/ ontrialbegin = [trial.TestPhaseTrial.removestimulustime(0)]
/ ontrialbegin = [if (list.TestPhaseOutcomes.currentvalue == "Player A") {trial.TestPhaseTrial.insertstimulustime(shape.BorderBottomA, 0);
trial.TestPhaseTrial.insertstimulustime(shape.BorderTopA, 0); trial.TestPhaseTrial.insertstimulustime(shape.BorderLeftA, 0);
trial.TestPhaseTrial.insertstimulustime(shape.BorderRightA, 0); trial.TestPhaseTrial.insertstimulustime(picture.PlayerA, 0);
trial.TestPhaseTrial.insertstimulustime(picture.PlayerB, 0)}
else if (list.TestPhaseOutcomes.currentvalue == "Player B") {trial.TestPhaseTrial.insertstimulustime(shape.BorderBottomB, 0);
trial.TestPhaseTrial.insertstimulustime(shape.BorderTopB, 0); trial.TestPhaseTrial.insertstimulustime(shape.BorderLeftB, 0);
trial.TestPhaseTrial.insertstimulustime(shape.BorderRightB, 0); trial.TestPhaseTrial.insertstimulustime(picture.PlayerA, 0);
trial.TestPhaseTrial.insertstimulustime(picture.PlayerB, 0)}]
/ timeout = values.ToneFeedbackLength
</trial>

<list TestPhaseOutcomes>
/ items = ("Player A", "Player B")
/ poolsize = values.TestTrialsTotalPerBlock - values.CatchTrialsPerTestBlock
/ itemprobabilities = (.5,.5)
/ selectionrate = trial
</list>

<trial TestPhaseCatchTrial>
/ ontrialbegin = [values.TrialCounter += 1; values.TimeoutCounter = 0]
/ ontrialbegin = [trial.TestPhaseCatchTrial.removestimulustime(0)]
/ ontrialbegin = [if (mod(floor(trial.TestPhaseTrialFlickerSlow.latency/values.TestPhaseSlowFlickerInterval),2) == 0) {trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderBottomA, 0);
trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderTopA, 0); trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderLeftA, 0);
trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderRightA, 0); trial.TestPhaseCatchTrial.insertstimulustime(picture.PlayerA, 0);
trial.TestPhaseCatchTrial.insertstimulustime(picture.PlayerB, 0)}
else {trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderBottomB, 0);
trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderTopB, 0); trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderLeftB, 0);
trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderRightB, 0); trial.TestPhaseCatchTrial.insertstimulustime(picture.PlayerA, 0);
trial.TestPhaseCatchTrial.insertstimulustime(picture.PlayerB, 0)}]
/ ontrialbegin = [if (mod(floor(trial.TestPhaseTrialFlickerSlow.latency/values.TestPhaseSlowFlickerInterval),2) == 0 && values.AggressivePlayer == "Player A") values.SelectedPlayer = "Aggressive Target"
else if (mod(floor(trial.TestPhaseTrialFlickerSlow.latency/values.TestPhaseSlowFlickerInterval),2) == 0 && values.AggressivePlayer == "Player B") values.SelectedPlayer = "Nonaggressive Target"
else if (mod(floor(trial.TestPhaseTrialFlickerSlow.latency/values.TestPhaseSlowFlickerInterval),2) == 1 && values.AggressivePlayer == "Player A") values.SelectedPlayer = "Nonaggressive Target"
else if (mod(floor(trial.TestPhaseTrialFlickerSlow.latency/values.TestPhaseSlowFlickerInterval),2) == 1 && values.AggressivePlayer == "Player B") values.SelectedPlayer = "Aggressive Target"]
/ timeout = values.ToneFeedbackLength
</trial>


<trial TestPhaseTooSlow>
/ stimulustimes = [0 = FasterPlease]
/ timeout = values.TestPhaseErrorFeedbackDuration
/ recorddata = false
/ branch = [if (values.LastTestTrial == "Slow") trial.TestPhaseTrialFlickerSlow
else if (values.LastTestTrial == "Fast") trial.TestPhaseTrialFlickerFast]
</trial>

<text FasterPlease>
/ items = ("Bitte treffe schneller deine Entscheidung!!!")
/ fontstyle = ("Verdana", 2%, true)
/ size = (90%,10%)
/ vjustify = center
/ txcolor = red
</text>

By AKrishna - 4/7/2019


As happens so often, simply doing it was faster than asking. I solved the problem by populating the flicker trial with stimuli in a duration 0 looped population trial directly before the actual flicker trial. Hey presto, no more "sticky" stimuli!

Thanks a lot for your timely help, Dave! :)
By Dave - 4/7/2019

AKrishna - Monday, April 8, 2019
Excellent, that works! Unfortunately, it doesn't solve my problem in my main script. I have programmed my script to allow various flicker intervals to be flexible, so the script dynamically populates the trials during an earlier block. Using resetstimulusframes would get rid of that, correct? Is there any way to work around that or should I just port my "trial population" script to before each flicker trial? After all, I'm presenting other stimuli after participants respond, so the small intervals that processing these command would require are no bother.



To illustrate, here's a simplified version of what I'm working on with the extraneous stuff removed:


<expt Test>
/ blocks = [1 = Population; 2 = TestPhase]
</expt>

<block Population>
/ trials = [1 = PopulateSlowFlickerTrials]
</block>

### This trial iterates adding in blocker and flicker stimuli for each interval of "TestPhaseSlowFlickerInterval" ms until the total timeout is reached, then it goes to a trial that does the same for the fast flicker trials

<trial PopulateSlowFlickerTrials>
/ trialduration = 0
/ ontrialbegin = [values.TimeoutCounter += values.TestPhaseSlowFlickerInterval]
/ branch = [if (values.TimeoutCounter < values.TestPhaseTimeout && mod(values.TimeoutCounter/values.TestPhaseSlowFlickerInterval,2) == 1)
{trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderBottomABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderTopABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderRightABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderLeftABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderBottomB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderTopB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderRightB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderLeftB, values.TimeoutCounter);
trial.PopulateSlowFlickerTrials}
else if (values.TimeoutCounter < values.TestPhaseTimeout && mod(values.TimeoutCounter/values.TestPhaseSlowFlickerInterval,2) == 0)
{trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderBottomBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderTopBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderRightBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderLeftBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderBottomA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderTopA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderRightA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerSlow.insertstimulustime(shape.BorderLeftA, values.TimeoutCounter);
trial.PopulateSlowFlickerTrials}]
/ branch = [values.TimeoutCounter = 0; trial.PopulateFastFlickerTrials]
/ recorddata = false
</trial>

<trial PopulateFastFlickerTrials>
/ trialduration = 0
/ ontrialbegin = [values.TimeoutCounter += values.TestPhaseFastFlickerInterval]
/ branch = [if (values.TimeoutCounter < values.TestPhaseTimeout && mod(values.TimeoutCounter/values.TestPhaseFastFlickerInterval,2) == 1)
{trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderBottomABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderTopABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderRightABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderLeftABlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderBottomB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderTopB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderRightB, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderLeftB, values.TimeoutCounter);
trial.PopulateFastFlickerTrials}
else if (values.TimeoutCounter < values.TestPhaseTimeout && mod(values.TimeoutCounter/values.TestPhaseFastFlickerInterval,2) == 0)
{trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderBottomBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderTopBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderRightBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderLeftBBlocker, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderBottomA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderTopA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderRightA, values.TimeoutCounter);
trial.TestPhaseTrialFlickerFast.insertstimulustime(shape.BorderLeftA, values.TimeoutCounter);
trial.PopulateFastFlickerTrials}]
/ recorddata = false
</trial>


### This block reads from a dynamic list that is populated using the values entered in the <values> element

<block TestPhase>
/ onblockbegin = [values.TrialCounter = 0]
/ trials = [1 = list.TestPhaseTrials]
</block>

<list TestPhaseTrials>
/ items = (trial.TestPhaseTrialFlickerFast, trial.TestPhaseTrialFlickerSlow)
/ itemprobabilities = (values.TestTrialsTotalPerBlock/values.TestTrialsTotalPerBlock-values.CatchTrialsPerTestBlock/values.TestTrialsTotalPerBlock, values.CatchTrialsPerTestBlock/values.TestTrialsTotalPerBlock)
/ poolsize = values.TestTrialsTotalPerBlock/2
</list>

### Here's a flicker trial, one of those that is populated above. Adding a resetstimulusframes here would destroy my work from above.

<trial TestPhaseTrialFlickerFast>
/ stimulustimes = [0 = BorderBottomA, BorderLeftA, BorderRightA, BorderTopA, PlayerA, PlayerB]
/ timeout = values.TestPhaseTimeout + values.TestPhaseFlickerPreTrialPause
/ validresponse = (" ")
/ branch = [if (trial.TestPhaseTrialFlickerFast.response == 0) {values.LastTestTrial = "Fast"; trial.TestPhaseTooSlow}]
/ branch = [trial.TestPhaseTrial]
/ recorddata = false
/ beginresponsetime = -1
</trial>


<shape BorderLeftA>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (values.BorderLeftPosition,30)
</shape>

<shape BorderRightA>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (values.BorderRightPosition,30)
</shape>

<shape BorderTopA>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (values.BorderTopPosition,15)
</shape>

<shape BorderBottomA>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (values.BorderBottomPosition,45)
</shape>

<shape BorderLeftB>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (100-values.BorderLeftPosition,30)
</shape>

<shape BorderRightB>
/ shape = rectangle
/ color = green
/ size = (.5%,15%)
/ position = (100-values.BorderRightPosition,30)
</shape>

<shape BorderTopB>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (100-values.BorderTopPosition,15)
</shape>

<shape BorderBottomB>
/ shape = rectangle
/ color = green
/ size = (15%,.5%)
/ position = (100-values.BorderBottomPosition,45)
</shape>


<shape BorderLeftABlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (values.BorderLeftPosition,30)
</shape>

<shape BorderRightABlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (values.BorderRightPosition,30)
</shape>

<shape BorderTopABlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (values.BorderTopPosition,15)
</shape>

<shape BorderBottomABlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (values.BorderBottomPosition,45)
</shape>

<shape BorderLeftBBlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (100-values.BorderLeftPosition,30)
</shape>

<shape BorderRightBBlocker>
/ shape = rectangle
/ color = white
/ size = (.5%,15%)
/ position = (100-values.BorderRightPosition,30)
</shape>

<shape BorderTopBBlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (100-values.BorderTopPosition,15)
</shape>

<shape BorderBottomBBlocker>
/ shape = rectangle
/ color = white
/ size = (15%,.5%)
/ position = (100-values.BorderBottomPosition,45)
</shape>

### Here's a flicker trial, one of those that is populated above. Adding a resetstimulusframes here would destroy my work from above.

<trial TestPhaseTrialFlickerSlow>
/ stimulustimes = [0 = BorderBottomA, BorderLeftA, BorderRightA, BorderTopA, PlayerA, PlayerB]
/ timeout = values.TestPhaseTimeout + values.TestPhaseFlickerPreTrialPause
/ validresponse = (" ")
/ branch = [if (trial.TestPhaseTrialFlickerSlow.response == 0) {values.LastTestTrial = "Slow"; trial.TestPhaseTooSlow}]
/ branch = [trial.TestPhaseCatchTrial]
/ recorddata = false
/ beginresponsetime = -1
</trial>


<trial TestPhaseTrial>
/ ontrialbegin = [values.TrialCounter += 1; values.TimeoutCounter = 0]
/ ontrialbegin = [if (list.TestPhaseOutcomes.nextvalue == values.AggressivePlayer) values.SelectedPlayer = "Aggressive Target"
else if (list.TestPhaseOutcomes.currentvalue == values.NonaggressivePlayer) values.SelectedPlayer = "Nonaggressive Target"]
/ ontrialbegin = [trial.TestPhaseTrial.removestimulustime(0)]
/ ontrialbegin = [if (list.TestPhaseOutcomes.currentvalue == "Player A") {trial.TestPhaseTrial.insertstimulustime(shape.BorderBottomA, 0);
trial.TestPhaseTrial.insertstimulustime(shape.BorderTopA, 0); trial.TestPhaseTrial.insertstimulustime(shape.BorderLeftA, 0);
trial.TestPhaseTrial.insertstimulustime(shape.BorderRightA, 0); trial.TestPhaseTrial.insertstimulustime(picture.PlayerA, 0);
trial.TestPhaseTrial.insertstimulustime(picture.PlayerB, 0)}
else if (list.TestPhaseOutcomes.currentvalue == "Player B") {trial.TestPhaseTrial.insertstimulustime(shape.BorderBottomB, 0);
trial.TestPhaseTrial.insertstimulustime(shape.BorderTopB, 0); trial.TestPhaseTrial.insertstimulustime(shape.BorderLeftB, 0);
trial.TestPhaseTrial.insertstimulustime(shape.BorderRightB, 0); trial.TestPhaseTrial.insertstimulustime(picture.PlayerA, 0);
trial.TestPhaseTrial.insertstimulustime(picture.PlayerB, 0)}]
/ timeout = values.ToneFeedbackLength
</trial>

<list TestPhaseOutcomes>
/ items = ("Player A", "Player B")
/ poolsize = values.TestTrialsTotalPerBlock - values.CatchTrialsPerTestBlock
/ itemprobabilities = (.5,.5)
/ selectionrate = trial
</list>

<trial TestPhaseCatchTrial>
/ ontrialbegin = [values.TrialCounter += 1; values.TimeoutCounter = 0]
/ ontrialbegin = [trial.TestPhaseCatchTrial.removestimulustime(0)]
/ ontrialbegin = [if (mod(floor(trial.TestPhaseTrialFlickerSlow.latency/values.TestPhaseSlowFlickerInterval),2) == 0) {trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderBottomA, 0);
trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderTopA, 0); trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderLeftA, 0);
trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderRightA, 0); trial.TestPhaseCatchTrial.insertstimulustime(picture.PlayerA, 0);
trial.TestPhaseCatchTrial.insertstimulustime(picture.PlayerB, 0)}
else {trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderBottomB, 0);
trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderTopB, 0); trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderLeftB, 0);
trial.TestPhaseCatchTrial.insertstimulustime(shape.BorderRightB, 0); trial.TestPhaseCatchTrial.insertstimulustime(picture.PlayerA, 0);
trial.TestPhaseCatchTrial.insertstimulustime(picture.PlayerB, 0)}]
/ ontrialbegin = [if (mod(floor(trial.TestPhaseTrialFlickerSlow.latency/values.TestPhaseSlowFlickerInterval),2) == 0 && values.AggressivePlayer == "Player A") values.SelectedPlayer = "Aggressive Target"
else if (mod(floor(trial.TestPhaseTrialFlickerSlow.latency/values.TestPhaseSlowFlickerInterval),2) == 0 && values.AggressivePlayer == "Player B") values.SelectedPlayer = "Nonaggressive Target"
else if (mod(floor(trial.TestPhaseTrialFlickerSlow.latency/values.TestPhaseSlowFlickerInterval),2) == 1 && values.AggressivePlayer == "Player A") values.SelectedPlayer = "Nonaggressive Target"
else if (mod(floor(trial.TestPhaseTrialFlickerSlow.latency/values.TestPhaseSlowFlickerInterval),2) == 1 && values.AggressivePlayer == "Player B") values.SelectedPlayer = "Aggressive Target"]
/ timeout = values.ToneFeedbackLength
</trial>


<trial TestPhaseTooSlow>
/ stimulustimes = [0 = FasterPlease]
/ timeout = values.TestPhaseErrorFeedbackDuration
/ recorddata = false
/ branch = [if (values.LastTestTrial == "Slow") trial.TestPhaseTrialFlickerSlow
else if (values.LastTestTrial == "Fast") trial.TestPhaseTrialFlickerFast]
</trial>

<text FasterPlease>
/ items = ("Bitte treffe schneller deine Entscheidung!!!")
/ fontstyle = ("Verdana", 2%, true)
/ size = (90%,10%)
/ vjustify = center
/ txcolor = red
</text>


As far as I can see, yes, the solution would be to perform the setup of the stimulus presentation sequence /ontrialbegin in each flicker trial.