Random EEG triggers


Author
Message
Francis&m
Francis&m
Associate Member (87 reputation)Associate Member (87 reputation)Associate Member (87 reputation)Associate Member (87 reputation)Associate Member (87 reputation)Associate Member (87 reputation)Associate Member (87 reputation)Associate Member (87 reputation)Associate Member (87 reputation)
Group: Forum Members
Posts: 8, Visits: 119
Hi,
I'm creating an experiment where participants are watching one video at a time and after each video they answer a question by pressing a key.
I'm recording EEG data during the task.
My trial order looks like this: fixation, video, question + answer, fixation, video, etc.

Since I need to show different videos in a specific order, I created a unique trial where the video is selected based on my order and also I created a conditional statement to send a specific trigger depending on the condition to which each video belongs.

The script is working fine except for the triggers in the video trials, as they go crazy after a while (not from the beginning) by sending triggers I didn't define and also sending multiple triggers for a single video. Fixation triggers also create similar problems.

Triggers are working fine for the question trial ("taskMF") and the key response.
I have no clue of what is going wrong, can someone please help me?
Sorry for my bad coding style.

Thank you very much,
Francesca




**************************************************************************************************************
**************************************************************************************************************
 BLOCKS
**************************************************************************************************************
**************************************************************************************************************

<block InstructBlock>
/ trials = [1= instruct;]
</block>

<block Pausa1>
/ trials = [1= pausa; 2 = start]
</block>

<block Pausa2>
/ trials = [1= pausa; 2 = start]
</block>

<block Endexp>
/ trials = [1= endexp;]
</block>


<block ExpBlock1>
/ stop = [values.count_sequence == parameters.trialnumber]
/ onblockbegin = [
    values.count_sequence = 0;
    values.countblocks += 1;
    values.practice = 0;
    values.blockk = 1]
/ trials = [1 = fixation]
</block>

<block ExpBlock2>
/ stop = [values.count_sequence == parameters.trialnumber]
/ onblockbegin = [
    values.count_sequence = 0;
    values.countblocks += 1;
    values.practice = 0;
    values.blockk = 2]
/ trials = [1 = fixation]
</block>

<block ExpBlock3>
/ stop = [values.count_sequence == parameters.trialnumber]
/ onblockbegin = [
    values.count_sequence = 0;
    values.countblocks += 1;
    values.practice = 0;
    values.blockk = 3]
/ trials = [1 = fixation]
</block>
    

**************************************************************************************************************
**************************************************************************************************************
 PORT
**************************************************************************************************************
**************************************************************************************************************

<port fix_onset>
/ port = COM6
/ subport = data
/ items = ("00000101") //5
</port>


<port C2_onset>
/ port = COM6
/ subport = data
/ items = ("00000001") //1
</port>

<port C3_onset>
/ port = COM6
/ subport = data
/ items = ("00000010") // 2
</port>

<port I0_onset>
/ port = COM6
/ subport = data
/ items = ("00000011") // 3
</port>

<port I3_onset>
/ port = COM6
/ subport = data
/ items = ("00000100") // 4
</port>

<port correctmark>
/ port = COM6
/ subport = data
/ items = ("01011000") // 88
</port>

<port errormark>
/ port = COM6
/ subport = data
/ items = ("01100011") // 99
</port>



<port blockstart>
/ port = COM6
/ subport = data
/ items = ("00001000", "00001001", "00001010", "00001011") // 8, 9, 10, 11
/ select = sequence
</port>

<port blockend>
/ port = COM6
/ subport = data
/ items = ("00001100") // 12
</port>

<port questFM>
/ port = COM6
/ subport = data
/ items = ("00101100") // 44
</port>

<port reset>
/ port = COM6
/ subport = data
/ items = ("00000000")
</port>


**************************************************************************************************************
**************************************************************************************************************
 TEXT
**************************************************************************************************************
**************************************************************************************************************

<text fixation>
/ items = ("+")
/ position = (50%, 50%)
/ fontstyle = ("MS Shell Dlg 2", 4.38%, false, false, false, false, 5, 1)
/ color = black
/ txbgcolor = lightgray

</text>

<text blank>
/ items = (" ")
/ position = (50%, 50%)
/ fontstyle = ("MS Shell Dlg 2", 4.38%, false, false, false, false, 5, 1)
/ color = white
/ txbgcolor = black
</text>

**************************************************************************************************************
**************************************************************************************************************
 VALUES & LISTS
**************************************************************************************************************
**************************************************************************************************************
<parameters>

/ trialnumber = 96
/ practicetrials = 16

</parameters>

<values>
/ condition = 0
/ countblocks = 0
/ practice = 0
/ count_sequence = 0
/ actor = 0
/ stimulusname = 0
/ accuracy = 0
/ conditionlabel = 0
/ fix_duration = 0
/ blockk = 0
/ code = 0
</values>

<list jittered_fix>
/ items = (1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500)
/ replace = true
/ itemprobabilities = uniform
/ selectionrate = trial
</list>


<list stimuliNames_1>
/ items = (1,2,3,4,5,6,7,8,9,
10,11,12,13,14,15,16,17,18,19,
20,21,22,23,24,25,26,27,28,29,
30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
70,71,72,73,74,75,76,77,78,79,
80,81,82,83,84,85,86,87,88,89,
90,91,92,93,94,95,96
)
/ poolsize = 96
/ select = sequence
/ resetinterval = 0

</list>

<list stimuliNames_2>
/ items = (96,95,94,93,92,91,
90,89,88,87,86,85,84,83,82,81,
80,79,78,77,76,75,74,73,72,71,
70,69,68,67,66,65,64,63,62,61,
60,59,58,57,56,55,54,53,52,51,
50,49,48,47,46,45,44,43,42,41,
40,39,38,37,36,35,34,33,32,31,
30,29,28,27,26,25,24,23,22,21,
20,19,18,17,16,15,14,13,12,11,
10,9,8,7,6,5,4,3,2,1
)
/ poolsize = 96
/ select = sequence
/ resetinterval = 0

</list>

<list stimuliNames_3>
/ items = (11,
12,3,13,14,15,16,17,18,19,1,2,4,5,6,7,
8,9,10,24,25,26,27,28,
29,30,20,21,22,23,45,46,
47,48,49,50,33,31,32,63,
34,35,36,37,38,39,40,41,
42,43,44,74,75,76,51,52,
53,54,55,56,57,58,95,60,
61,62,64,65,66,67,68,69,
70,71,72,73,77,78,79,80,
81,82,83,84,85,86,87,88,
89,90,91,92,59,93,94,96
)
/ poolsize = 96
/ select = sequence
/ resetinterval = 0

</list>

**************************************************************************************************************
**************************************************************************************************************
 TRIALS
**************************************************************************************************************
**************************************************************************************************************

<trial instruct>
/ stimulusframes = [1=instructions]
/ validresponse = (" ")
</trial>

<trial start>
/ stimulusframes = [1=start , blockstart ] // ****UNCOMMENT****
/ validresponse = (" ")
</trial>



<trial pausa>
/ stimulusframes = [1=pausa , blockend] // ****UNCOMMENT****
/ validresponse = (" ")
</trial>


<trial endexp>
/ stimulusframes = [1=endexp]
/ validresponse = (" ")
</trial>

----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------

<trial taskMF>
/ stimulusframes = [1= taskMF, questFM; 2 = reset]
/ validresponse = ("x","m")
/ branch = [return trial.end]
/ iscorrectresponse = [trial.taskMF.responsetext == values.actor]
/ correctmessage = true(correctmark,0)   // ****UNCOMMENT****
/ errormessage = true(errormark,0) // ****UNCOMMENT****
/ timeout = 2000
</trial>

<trial fixation>
/ ontrialbegin = [values.actor = 0]
/ ontrialbegin = [ values.fix_duration = list.jittered_fix.nextvalue]
/ ontrialbegin = [ if (values.blockk==1) {values.code = list.stimuliNames_1.nextvalue}
else if ( values.blockk ==2) {values.code = list.stimuliNames_2.nextvalue}
else if ( values.blockk ==3) {values.code = list.stimuliNames_3.nextvalue}]
/ stimulusframes = [1 = fixation , fix_onset; 2 = reset] // ****UNCOMMENT****
/ response = noresponse
/ trialduration = values.fix_duration
/ errormessage = false
/ recorddata = true
/ branch = [ if (values.blockk == 1) {    return trial.trial_video1}
else if (values.blockk == 2) {    return trial.trial_video2}
else if (values.blockk == 3) {    return trial.trial_video3}]
/ ontrialend = [
    if ( list.stimuliNames_1.currentvalue == 6
|| list.stimuliNames_1.currentvalue== 12
|| list.stimuliNames_1.currentvalue== 13
|| list.stimuliNames_1.currentvalue== 22
|| list.stimuliNames_1.currentvalue== 26
|| list.stimuliNames_1.currentvalue== 31
|| list.stimuliNames_1.currentvalue== 33
|| list.stimuliNames_1.currentvalue== 34
|| list.stimuliNames_1.currentvalue== 39
|| list.stimuliNames_1.currentvalue== 44
|| list.stimuliNames_1.currentvalue== 47
|| list.stimuliNames_1.currentvalue== 49
|| list.stimuliNames_1.currentvalue== 51
|| list.stimuliNames_1.currentvalue== 53
|| list.stimuliNames_1.currentvalue== 61
|| list.stimuliNames_1.currentvalue== 64
|| list.stimuliNames_1.currentvalue== 66
|| list.stimuliNames_1.currentvalue== 67
|| list.stimuliNames_1.currentvalue== 72
|| list.stimuliNames_1.currentvalue== 77
|| list.stimuliNames_1.currentvalue== 82
|| list.stimuliNames_1.currentvalue== 83
|| list.stimuliNames_1.currentvalue== 87
|| list.stimuliNames_1.currentvalue== 92) { values.condition = 1;    }
else if ( list.stimuliNames_1.currentvalue== 1
|| list.stimuliNames_1.currentvalue== 3
|| list.stimuliNames_1.currentvalue== 8
|| list.stimuliNames_1.currentvalue== 9
|| list.stimuliNames_1.currentvalue== 16
|| list.stimuliNames_1.currentvalue== 18
|| list.stimuliNames_1.currentvalue== 21
|| list.stimuliNames_1.currentvalue== 23
|| list.stimuliNames_1.currentvalue== 24
|| list.stimuliNames_1.currentvalue== 27
|| list.stimuliNames_1.currentvalue== 30
|| list.stimuliNames_1.currentvalue== 35
|| list.stimuliNames_1.currentvalue== 37
|| list.stimuliNames_1.currentvalue== 40
|| list.stimuliNames_1.currentvalue== 43
|| list.stimuliNames_1.currentvalue== 55
|| list.stimuliNames_1.currentvalue== 57
|| list.stimuliNames_1.currentvalue== 59
|| list.stimuliNames_1.currentvalue== 60
|| list.stimuliNames_1.currentvalue== 69
|| list.stimuliNames_1.currentvalue== 71
|| list.stimuliNames_1.currentvalue== 75
|| list.stimuliNames_1.currentvalue== 78
|| list.stimuliNames_1.currentvalue== 85 ) { values.condition = 2;    }

else if ( list.stimuliNames_1.currentvalue== 4
|| list.stimuliNames_1.currentvalue== 5
|| list.stimuliNames_1.currentvalue== 7
|| list.stimuliNames_1.currentvalue== 10
|| list.stimuliNames_1.currentvalue== 11
|| list.stimuliNames_1.currentvalue== 14
|| list.stimuliNames_1.currentvalue== 15
|| list.stimuliNames_1.currentvalue== 17
|| list.stimuliNames_1.currentvalue== 25
|| list.stimuliNames_1.currentvalue== 28
|| list.stimuliNames_1.currentvalue== 36
|| list.stimuliNames_1.currentvalue== 42
|| list.stimuliNames_1.currentvalue== 48
|| list.stimuliNames_1.currentvalue== 63
|| list.stimuliNames_1.currentvalue== 65
|| list.stimuliNames_1.currentvalue== 74
|| list.stimuliNames_1.currentvalue== 76
|| list.stimuliNames_1.currentvalue== 81
|| list.stimuliNames_1.currentvalue== 84
|| list.stimuliNames_1.currentvalue== 86
|| list.stimuliNames_1.currentvalue== 89
|| list.stimuliNames_1.currentvalue== 91
|| list.stimuliNames_1.currentvalue== 94
|| list.stimuliNames_1.currentvalue== 95) { values.condition = 3;    }
else if ( list.stimuliNames_1.currentvalue== 2
|| list.stimuliNames_1.currentvalue== 19
|| list.stimuliNames_1.currentvalue== 20
|| list.stimuliNames_1.currentvalue== 29
|| list.stimuliNames_1.currentvalue== 32
|| list.stimuliNames_1.currentvalue== 38
|| list.stimuliNames_1.currentvalue== 41
|| list.stimuliNames_1.currentvalue== 45
|| list.stimuliNames_1.currentvalue== 46
|| list.stimuliNames_1.currentvalue== 50
|| list.stimuliNames_1.currentvalue== 52
|| list.stimuliNames_1.currentvalue== 54
|| list.stimuliNames_1.currentvalue== 56
|| list.stimuliNames_1.currentvalue== 58
|| list.stimuliNames_1.currentvalue== 62
|| list.stimuliNames_1.currentvalue== 68
|| list.stimuliNames_1.currentvalue== 70
|| list.stimuliNames_1.currentvalue== 73
|| list.stimuliNames_1.currentvalue== 79
|| list.stimuliNames_1.currentvalue== 80
|| list.stimuliNames_1.currentvalue== 88
|| list.stimuliNames_1.currentvalue== 90
|| list.stimuliNames_1.currentvalue== 93
|| list.stimuliNames_1.currentvalue== 96) { values.condition = 4;    }
]
</trial>


<trial trial_video1>
/ ontrialbegin = [
    if ( list.stimuliNames_1.currentvalue== 6
|| list.stimuliNames_1.currentvalue== 12
|| list.stimuliNames_1.currentvalue== 13
|| list.stimuliNames_1.currentvalue== 22
|| list.stimuliNames_1.currentvalue== 26
|| list.stimuliNames_1.currentvalue== 31
|| list.stimuliNames_1.currentvalue== 33
|| list.stimuliNames_1.currentvalue== 34
|| list.stimuliNames_1.currentvalue== 39
|| list.stimuliNames_1.currentvalue== 44
|| list.stimuliNames_1.currentvalue== 47
|| list.stimuliNames_1.currentvalue== 49
|| list.stimuliNames_1.currentvalue== 51
|| list.stimuliNames_1.currentvalue== 53
|| list.stimuliNames_1.currentvalue== 61
|| list.stimuliNames_1.currentvalue== 64
|| list.stimuliNames_1.currentvalue== 66
|| list.stimuliNames_1.currentvalue== 67
|| list.stimuliNames_1.currentvalue== 72
|| list.stimuliNames_1.currentvalue== 77
|| list.stimuliNames_1.currentvalue== 82
|| list.stimuliNames_1.currentvalue== 83
|| list.stimuliNames_1.currentvalue== 87
|| list.stimuliNames_1.currentvalue== 92) {trial.trial_video1.insertstimulusframe(port.C2_onset, 1)}

else if ( list.stimuliNames_1.currentvalue== 1
|| list.stimuliNames_1.currentvalue== 3
|| list.stimuliNames_1.currentvalue== 8
|| list.stimuliNames_1.currentvalue== 9
|| list.stimuliNames_1.currentvalue== 16
|| list.stimuliNames_1.currentvalue== 18
|| list.stimuliNames_1.currentvalue== 21
|| list.stimuliNames_1.currentvalue== 23
|| list.stimuliNames_1.currentvalue== 24
|| list.stimuliNames_1.currentvalue== 27
|| list.stimuliNames_1.currentvalue== 30
|| list.stimuliNames_1.currentvalue== 35
|| list.stimuliNames_1.currentvalue== 37
|| list.stimuliNames_1.currentvalue== 40
|| list.stimuliNames_1.currentvalue== 43
|| list.stimuliNames_1.currentvalue== 55
|| list.stimuliNames_1.currentvalue== 57
|| list.stimuliNames_1.currentvalue== 59
|| list.stimuliNames_1.currentvalue== 60
|| list.stimuliNames_1.currentvalue== 69
|| list.stimuliNames_1.currentvalue== 71
|| list.stimuliNames_1.currentvalue== 75
|| list.stimuliNames_1.currentvalue== 78
|| list.stimuliNames_1.currentvalue== 85 ) {trial.trial_video1.insertstimulusframe(port.C3_onset, 1)}

else if ( list.stimuliNames_1.currentvalue== 4
|| list.stimuliNames_1.currentvalue== 5
|| list.stimuliNames_1.currentvalue== 7
|| list.stimuliNames_1.currentvalue== 10
|| list.stimuliNames_1.currentvalue== 11
|| list.stimuliNames_1.currentvalue== 14
|| list.stimuliNames_1.currentvalue== 15
|| list.stimuliNames_1.currentvalue== 17
|| list.stimuliNames_1.currentvalue== 25
|| list.stimuliNames_1.currentvalue== 28
|| list.stimuliNames_1.currentvalue== 36
|| list.stimuliNames_1.currentvalue== 42
|| list.stimuliNames_1.currentvalue== 48
|| list.stimuliNames_1.currentvalue== 63
|| list.stimuliNames_1.currentvalue== 65
|| list.stimuliNames_1.currentvalue== 74
|| list.stimuliNames_1.currentvalue== 76
|| list.stimuliNames_1.currentvalue== 81
|| list.stimuliNames_1.currentvalue== 84
|| list.stimuliNames_1.currentvalue== 86
|| list.stimuliNames_1.currentvalue== 89
|| list.stimuliNames_1.currentvalue== 91
|| list.stimuliNames_1.currentvalue== 94
|| list.stimuliNames_1.currentvalue== 95) {trial.trial_video1.insertstimulusframe(port.I0_onset, 1)}

else if ( list.stimuliNames_1.currentvalue== 2
|| list.stimuliNames_1.currentvalue== 19
|| list.stimuliNames_1.currentvalue== 20
|| list.stimuliNames_1.currentvalue== 29
|| list.stimuliNames_1.currentvalue== 32
|| list.stimuliNames_1.currentvalue== 38
|| list.stimuliNames_1.currentvalue== 41
|| list.stimuliNames_1.currentvalue== 45
|| list.stimuliNames_1.currentvalue== 46
|| list.stimuliNames_1.currentvalue== 50
|| list.stimuliNames_1.currentvalue== 52
|| list.stimuliNames_1.currentvalue== 54
|| list.stimuliNames_1.currentvalue== 56
|| list.stimuliNames_1.currentvalue== 58
|| list.stimuliNames_1.currentvalue== 62
|| list.stimuliNames_1.currentvalue== 68
|| list.stimuliNames_1.currentvalue== 70
|| list.stimuliNames_1.currentvalue== 73
|| list.stimuliNames_1.currentvalue== 79
|| list.stimuliNames_1.currentvalue== 80
|| list.stimuliNames_1.currentvalue== 88
|| list.stimuliNames_1.currentvalue== 90
|| list.stimuliNames_1.currentvalue== 93
|| list.stimuliNames_1.currentvalue== 96) {trial.trial_video1.insertstimulusframe(port.I3_onset, 1)};


]

/ ontrialbegin = [trial.trial_video1.insertstimulusframe(port.reset, 2)  ]

/ stimulusframes = [ 1 = video.videolist_1 ]
/ trialduration = 2500
/ recorddata = true
/ branch = [    return trial.taskMF ]

/ontrialend = [
values.code = list.stimuliNames_1.currentvalue;
if (
video.videolist_1.currentitem == "f2AppC2Offe.mp4"||
video.videolist_1.currentitem == "f2AppC3Offe.mp4"||
video.videolist_1.currentitem == "f2AppI0Move.mp4"||
video.videolist_1.currentitem == "f2AppI3Move.mp4"||
video.videolist_1.currentitem == "f2BooC2Show.mp4"||
video.videolist_1.currentitem == "f2BooC3Show.mp4"||
video.videolist_1.currentitem == "f2BooI0Watc.mp4"||
video.videolist_1.currentitem == "f2BooI3Watc.mp4"||
video.videolist_1.currentitem == "f2CloC2Show.mp4"||
video.videolist_1.currentitem == "f2CloC3Show.mp4"||
video.videolist_1.currentitem == "f2CloI0Watc.mp4"||
video.videolist_1.currentitem == "f2CloI3Watc.mp4"||
video.videolist_1.currentitem == "f2CupC2Offe.mp4"||
video.videolist_1.currentitem == "f2CupC3Offe.mp4"||
video.videolist_1.currentitem == "f2CupI0Move.mp4"||
video.videolist_1.currentitem == "f2CupI3Move.mp4"||
video.videolist_1.currentitem == "f2KeyC2Offe.mp4"||
video.videolist_1.currentitem == "f2KeyC3Offe.mp4"||
video.videolist_1.currentitem == "f2KeyI0Move.mp4"||
video.videolist_1.currentitem == "f2KeyI3Move.mp4"||
video.videolist_1.currentitem == "f2PhoC2Show.mp4"||
video.videolist_1.currentitem == "f2PhoC3Show.mp4"||
video.videolist_1.currentitem == "f2PhoI0Watc.mp4"||
video.videolist_1.currentitem == "f2PhoI3Watc.mp4"||
video.videolist_1.currentitem == "f1AppC2Offe.mp4"||
video.videolist_1.currentitem == "f1AppC3Offe.mp4"||
video.videolist_1.currentitem == "f1AppI0Move.mp4"||
video.videolist_1.currentitem == "f1AppI3Move.mp4"||
video.videolist_1.currentitem == "f1BooC2Show.mp4"||
video.videolist_1.currentitem == "f1BooC3Show.mp4"||
video.videolist_1.currentitem == "f1BooI0Watc.mp4"||
video.videolist_1.currentitem == "f1BooI3Watc.mp4"||
video.videolist_1.currentitem == "f1CloC2Show.mp4"||
video.videolist_1.currentitem == "f1CloC3Show.mp4"||
video.videolist_1.currentitem == "f1CloI0Watc.mp4"||
video.videolist_1.currentitem == "f1CloI3Watc.mp4"||
video.videolist_1.currentitem == "f1CupC2Offe.mp4"||
video.videolist_1.currentitem == "f1CupC3Offe.mp4"||
video.videolist_1.currentitem == "f1CupI0Move.mp4"||
video.videolist_1.currentitem == "f1CupI3Move.mp4"||
video.videolist_1.currentitem == "f1KeyC2Offe.mp4"||
video.videolist_1.currentitem == "f1KeyC3Offe.mp4"||
video.videolist_1.currentitem == "f1KeyI0Move.mp4"||
video.videolist_1.currentitem == "f1KeyI3Move.mp4"||
video.videolist_1.currentitem == "f1PhoC2Show.mp4"||
video.videolist_1.currentitem == "f1PhoC3Show.mp4"||
video.videolist_1.currentitem == "f1PhoI0Watc.mp4"||
video.videolist_1.currentitem == "f1PhoI3Watc.mp4")
{values.actor = "x"} else if (
video.videolist_1.currentitem == "m1AppC2Offe.mp4"||
video.videolist_1.currentitem == "m1AppC3Offe.mp4"||
video.videolist_1.currentitem == "m1AppI0Move.mp4"||
video.videolist_1.currentitem == "m1AppI3Move.mp4"||
video.videolist_1.currentitem == "m1BooC2Show.mp4"||
video.videolist_1.currentitem == "m1BooC3Show.mp4"||
video.videolist_1.currentitem == "m1BooI0Watc.mp4"||
video.videolist_1.currentitem == "m1BooI3Watc.mp4"||
video.videolist_1.currentitem == "m1CloC2Show.mp4"||
video.videolist_1.currentitem == "m1CloC3Show.mp4"||
video.videolist_1.currentitem == "m1CloI0Watc.mp4"||
video.videolist_1.currentitem == "m1CloI3Watc.mp4"||
video.videolist_1.currentitem == "m1CupC2Offe.mp4"||
video.videolist_1.currentitem == "m1CupC3Offe.mp4"||
video.videolist_1.currentitem == "m1CupI0Move.mp4"||
video.videolist_1.currentitem == "m1CupI3Move.mp4"||
video.videolist_1.currentitem == "m1KeyC2Offe.mp4"||
video.videolist_1.currentitem == "m1KeyC3Offe.mp4"||
video.videolist_1.currentitem == "m1KeyI0Move.mp4"||
video.videolist_1.currentitem == "m1KeyI3Move.mp4"||
video.videolist_1.currentitem == "m1PhoC2Show.mp4"||
video.videolist_1.currentitem == "m1PhoC3Show.mp4"||
video.videolist_1.currentitem == "m1PhoI0Watc.mp4"||
video.videolist_1.currentitem == "m1PhoI3Watc.mp4"||
video.videolist_1.currentitem == "m2AppC2Offe.mp4"||
video.videolist_1.currentitem == "m2AppC3Offe.mp4"||
video.videolist_1.currentitem == "m2AppI0Move.mp4"||
video.videolist_1.currentitem == "m2AppI3Move.mp4"||
video.videolist_1.currentitem == "m2BooC2Show.mp4"||
video.videolist_1.currentitem == "m2BooC3Show.mp4"||
video.videolist_1.currentitem == "m2BooI0Watc.mp4"||
video.videolist_1.currentitem == "m2BooI3Watc.mp4"||
video.videolist_1.currentitem == "m2CIoI0Watc.mp4"||
video.videolist_1.currentitem == "m2CloC2Show.mp4"||
video.videolist_1.currentitem == "m2CloC3Show.mp4"||
video.videolist_1.currentitem == "m2CloI3Watc.mp4"||
video.videolist_1.currentitem == "m2CupC2Offe.mp4"||
video.videolist_1.currentitem == "m2CupC3Offe.mp4"||
video.videolist_1.currentitem == "m2CupI0Move.mp4"||
video.videolist_1.currentitem == "m2CupI3Move.mp4"||
video.videolist_1.currentitem == "m2KeyC2Offe.mp4"||
video.videolist_1.currentitem == "m2KeyC3Offe.mp4"||
video.videolist_1.currentitem == "m2KeyI0Move.mp4"||
video.videolist_1.currentitem == "m2KeyI3Move.mp4"||
video.videolist_1.currentitem == "m2PhoC2Show.mp4"||
video.videolist_1.currentitem == "m2PhoC3Show.mp4"||
video.videolist_1.currentitem == "m2PhoI0Watc.mp4"||
video.videolist_1.currentitem == "m2PhoI3Watc.mp4")
{values.actor = "m"}
]
</trial>

<trial end>
/ ontrialbegin = [    values.count_sequence += 1;
       values.accuracy = 0;
                    values.actor = 0;
                    values.condition = 0;
                    values.conditionlabel = 0;
                    values.fix_duration = 0;
                    ]
/ trialduration = 0
/ stimulusframes = [1 = reset]
/ branch = [return trial.fixation;]
/ errormessage = false
/ recorddata = false
</trial>
**************************************************************************************************************
**************************************************************************************************************
 STIMULI
**************************************************************************************************************
**************************************************************************************************************

--------------
items
--------------


<video videolist_1>
/ size = (100%, 100%)
/ select = sequence
/items= (
"m2CupC3Offe.mp4",
"f1CupI3Move.mp4",
"m1KeyC3Offe.mp4",
"f2KeyI0Move.mp4",
"f1PhoI0Watc.mp4",
"m2KeyC2Offe.mp4",
"f1AppI0Move.mp4",
"m2PhoC3Show.mp4",
"f2CupC3Offe.mp4",
"f1KeyI0Move.mp4",
"m2BooI0Watc.mp4",
"f1AppC2Offe.mp4",
"m2PhoC2Show.mp4",
"f2BooI0Watc.mp4",
"f1CupI0Move.mp4",
"m1AppC3Offe.mp4",
"f2CloI0Watc.mp4",
"m1BooC3Show.mp4",
"f2AppI3Move.mp4",
"m2CloI3Watc.mp4",
"f1KeyC3Offe.mp4",
"m1AppC2Offe.mp4",
"f1AppC3Offe.mp4",
"m1CloC3Show.mp4",
"m2AppI0Move.mp4",
"f2KeyC2Offe.mp4",
"m1PhoC3Show.mp4",
"f1CloI0Watc.mp4",
"m2BooI3Watc.mp4",
"f2PhoC3Show.mp4",
"m2CupC2Offe.mp4",
"m1AppI3Move.mp4",
"f2AppC2Offe.mp4",
"m1BooC2Show.mp4",
"f2CloC3Show.mp4",
"m1AppI0Move.mp4",
"m2BooC3Show.mp4",
"f2PhoI3Watc.mp4",
"f1KeyC2Offe.mp4",
"m2AppC3Offe.mp4",
"f2CloI3Watc.mp4",
"m1BooI0Watc.mp4",
"f1PhoC3Show.mp4",
"m2CloC2Show.mp4",
"f2KeyI3Move.mp4",
"m2AppI3Move.mp4",
"m1CupC2Offe.mp4",
"f2PhoI0Watc.mp4",
"f1CloC2Show.mp4",
"m2KeyI3Move.mp4",
"f2BooC2Show.mp4",
"m1CupI3Move.mp4",
"m2AppC2Offe.mp4",
"f1KeyI3Move.mp4",
"m2CloC3Show.mp4",
"f2BooI3Watc.mp4",
"m2KeyC3Offe.mp4",
"f1PhoI3Watc.mp4",
"m1CupC3Offe.mp4",
"f1BooC3Show.mp4",
"f2CloC2Show.mp4",
"m1BooI3Watc.mp4",
"f2AppI0Move.mp4",
"f1PhoC2Show.mp4",
"m2CIoI0Watc.mp4",
"f2PhoC2Show.mp4",
"f1CupC2Offe.mp4",
"m1KeyI3Move.mp4",
"f2AppC3Offe.mp4",
"m2PhoI3Watc.mp4",
"f2BooC3Show.mp4",
"m1KeyC2Offe.mp4",
"f1BooI3Watc.mp4",
"m1CupI0Move.mp4",
"f1CloC3Show.mp4",
"m2CupI0Move.mp4",
"m1PhoC2Show.mp4",
"f1CupC3Offe.mp4",
"m1CloI3Watc.mp4",
"f1AppI3Move.mp4",
"m2CIoI0Watc.mp4",
"f2CupC2Offe.mp4",
"m1CloC2Show.mp4",
"m2CupI0Move.mp4",
"f2KeyC3Offe.mp4",
"m1CloI0Watc.mp4",
"f1BooC2Show.mp4",
"f2CupI3Move.mp4",
"m1KeyI0Move.mp4",
"m2CupI3Move.mp4",
"f1BooI0Watc.mp4",
"m2BooC2Show.mp4",
"m1PhoI3Watc.mp4",
"f2CupI0Move.mp4",
"m2PhoI0Watc.mp4",
"f1CloI3Watc.mp4"
)
</video>


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 100K
Francis&m - 4/13/2023
Hi,
I'm creating an experiment where participants are watching one video at a time and after each video they answer a question by pressing a key.
I'm recording EEG data during the task.
My trial order looks like this: fixation, video, question + answer, fixation, video, etc.

Since I need to show different videos in a specific order, I created a unique trial where the video is selected based on my order and also I created a conditional statement to send a specific trigger depending on the condition to which each video belongs.

The script is working fine except for the triggers in the video trials, as they go crazy after a while (not from the beginning) by sending triggers I didn't define and also sending multiple triggers for a single video. Fixation triggers also create similar problems.

Triggers are working fine for the question trial ("taskMF") and the key response.
I have no clue of what is going wrong, can someone please help me?
Sorry for my bad coding style.

Thank you very much,
Francesca




**************************************************************************************************************
**************************************************************************************************************
 BLOCKS
**************************************************************************************************************
**************************************************************************************************************

<block InstructBlock>
/ trials = [1= instruct;]
</block>

<block Pausa1>
/ trials = [1= pausa; 2 = start]
</block>

<block Pausa2>
/ trials = [1= pausa; 2 = start]
</block>

<block Endexp>
/ trials = [1= endexp;]
</block>


<block ExpBlock1>
/ stop = [values.count_sequence == parameters.trialnumber]
/ onblockbegin = [
    values.count_sequence = 0;
    values.countblocks += 1;
    values.practice = 0;
    values.blockk = 1]
/ trials = [1 = fixation]
</block>

<block ExpBlock2>
/ stop = [values.count_sequence == parameters.trialnumber]
/ onblockbegin = [
    values.count_sequence = 0;
    values.countblocks += 1;
    values.practice = 0;
    values.blockk = 2]
/ trials = [1 = fixation]
</block>

<block ExpBlock3>
/ stop = [values.count_sequence == parameters.trialnumber]
/ onblockbegin = [
    values.count_sequence = 0;
    values.countblocks += 1;
    values.practice = 0;
    values.blockk = 3]
/ trials = [1 = fixation]
</block>
    

**************************************************************************************************************
**************************************************************************************************************
 PORT
**************************************************************************************************************
**************************************************************************************************************

<port fix_onset>
/ port = COM6
/ subport = data
/ items = ("00000101") //5
</port>


<port C2_onset>
/ port = COM6
/ subport = data
/ items = ("00000001") //1
</port>

<port C3_onset>
/ port = COM6
/ subport = data
/ items = ("00000010") // 2
</port>

<port I0_onset>
/ port = COM6
/ subport = data
/ items = ("00000011") // 3
</port>

<port I3_onset>
/ port = COM6
/ subport = data
/ items = ("00000100") // 4
</port>

<port correctmark>
/ port = COM6
/ subport = data
/ items = ("01011000") // 88
</port>

<port errormark>
/ port = COM6
/ subport = data
/ items = ("01100011") // 99
</port>



<port blockstart>
/ port = COM6
/ subport = data
/ items = ("00001000", "00001001", "00001010", "00001011") // 8, 9, 10, 11
/ select = sequence
</port>

<port blockend>
/ port = COM6
/ subport = data
/ items = ("00001100") // 12
</port>

<port questFM>
/ port = COM6
/ subport = data
/ items = ("00101100") // 44
</port>

<port reset>
/ port = COM6
/ subport = data
/ items = ("00000000")
</port>


**************************************************************************************************************
**************************************************************************************************************
 TEXT
**************************************************************************************************************
**************************************************************************************************************

<text fixation>
/ items = ("+")
/ position = (50%, 50%)
/ fontstyle = ("MS Shell Dlg 2", 4.38%, false, false, false, false, 5, 1)
/ color = black
/ txbgcolor = lightgray

</text>

<text blank>
/ items = (" ")
/ position = (50%, 50%)
/ fontstyle = ("MS Shell Dlg 2", 4.38%, false, false, false, false, 5, 1)
/ color = white
/ txbgcolor = black
</text>

**************************************************************************************************************
**************************************************************************************************************
 VALUES & LISTS
**************************************************************************************************************
**************************************************************************************************************
<parameters>

/ trialnumber = 96
/ practicetrials = 16

</parameters>

<values>
/ condition = 0
/ countblocks = 0
/ practice = 0
/ count_sequence = 0
/ actor = 0
/ stimulusname = 0
/ accuracy = 0
/ conditionlabel = 0
/ fix_duration = 0
/ blockk = 0
/ code = 0
</values>

<list jittered_fix>
/ items = (1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500)
/ replace = true
/ itemprobabilities = uniform
/ selectionrate = trial
</list>


<list stimuliNames_1>
/ items = (1,2,3,4,5,6,7,8,9,
10,11,12,13,14,15,16,17,18,19,
20,21,22,23,24,25,26,27,28,29,
30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,
50,51,52,53,54,55,56,57,58,59,
60,61,62,63,64,65,66,67,68,69,
70,71,72,73,74,75,76,77,78,79,
80,81,82,83,84,85,86,87,88,89,
90,91,92,93,94,95,96
)
/ poolsize = 96
/ select = sequence
/ resetinterval = 0

</list>

<list stimuliNames_2>
/ items = (96,95,94,93,92,91,
90,89,88,87,86,85,84,83,82,81,
80,79,78,77,76,75,74,73,72,71,
70,69,68,67,66,65,64,63,62,61,
60,59,58,57,56,55,54,53,52,51,
50,49,48,47,46,45,44,43,42,41,
40,39,38,37,36,35,34,33,32,31,
30,29,28,27,26,25,24,23,22,21,
20,19,18,17,16,15,14,13,12,11,
10,9,8,7,6,5,4,3,2,1
)
/ poolsize = 96
/ select = sequence
/ resetinterval = 0

</list>

<list stimuliNames_3>
/ items = (11,
12,3,13,14,15,16,17,18,19,1,2,4,5,6,7,
8,9,10,24,25,26,27,28,
29,30,20,21,22,23,45,46,
47,48,49,50,33,31,32,63,
34,35,36,37,38,39,40,41,
42,43,44,74,75,76,51,52,
53,54,55,56,57,58,95,60,
61,62,64,65,66,67,68,69,
70,71,72,73,77,78,79,80,
81,82,83,84,85,86,87,88,
89,90,91,92,59,93,94,96
)
/ poolsize = 96
/ select = sequence
/ resetinterval = 0

</list>

**************************************************************************************************************
**************************************************************************************************************
 TRIALS
**************************************************************************************************************
**************************************************************************************************************

<trial instruct>
/ stimulusframes = [1=instructions]
/ validresponse = (" ")
</trial>

<trial start>
/ stimulusframes = [1=start , blockstart ] // ****UNCOMMENT****
/ validresponse = (" ")
</trial>



<trial pausa>
/ stimulusframes = [1=pausa , blockend] // ****UNCOMMENT****
/ validresponse = (" ")
</trial>


<trial endexp>
/ stimulusframes = [1=endexp]
/ validresponse = (" ")
</trial>

----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------

<trial taskMF>
/ stimulusframes = [1= taskMF, questFM; 2 = reset]
/ validresponse = ("x","m")
/ branch = [return trial.end]
/ iscorrectresponse = [trial.taskMF.responsetext == values.actor]
/ correctmessage = true(correctmark,0)   // ****UNCOMMENT****
/ errormessage = true(errormark,0) // ****UNCOMMENT****
/ timeout = 2000
</trial>

<trial fixation>
/ ontrialbegin = [values.actor = 0]
/ ontrialbegin = [ values.fix_duration = list.jittered_fix.nextvalue]
/ ontrialbegin = [ if (values.blockk==1) {values.code = list.stimuliNames_1.nextvalue}
else if ( values.blockk ==2) {values.code = list.stimuliNames_2.nextvalue}
else if ( values.blockk ==3) {values.code = list.stimuliNames_3.nextvalue}]
/ stimulusframes = [1 = fixation , fix_onset; 2 = reset] // ****UNCOMMENT****
/ response = noresponse
/ trialduration = values.fix_duration
/ errormessage = false
/ recorddata = true
/ branch = [ if (values.blockk == 1) {    return trial.trial_video1}
else if (values.blockk == 2) {    return trial.trial_video2}
else if (values.blockk == 3) {    return trial.trial_video3}]
/ ontrialend = [
    if ( list.stimuliNames_1.currentvalue == 6
|| list.stimuliNames_1.currentvalue== 12
|| list.stimuliNames_1.currentvalue== 13
|| list.stimuliNames_1.currentvalue== 22
|| list.stimuliNames_1.currentvalue== 26
|| list.stimuliNames_1.currentvalue== 31
|| list.stimuliNames_1.currentvalue== 33
|| list.stimuliNames_1.currentvalue== 34
|| list.stimuliNames_1.currentvalue== 39
|| list.stimuliNames_1.currentvalue== 44
|| list.stimuliNames_1.currentvalue== 47
|| list.stimuliNames_1.currentvalue== 49
|| list.stimuliNames_1.currentvalue== 51
|| list.stimuliNames_1.currentvalue== 53
|| list.stimuliNames_1.currentvalue== 61
|| list.stimuliNames_1.currentvalue== 64
|| list.stimuliNames_1.currentvalue== 66
|| list.stimuliNames_1.currentvalue== 67
|| list.stimuliNames_1.currentvalue== 72
|| list.stimuliNames_1.currentvalue== 77
|| list.stimuliNames_1.currentvalue== 82
|| list.stimuliNames_1.currentvalue== 83
|| list.stimuliNames_1.currentvalue== 87
|| list.stimuliNames_1.currentvalue== 92) { values.condition = 1;    }
else if ( list.stimuliNames_1.currentvalue== 1
|| list.stimuliNames_1.currentvalue== 3
|| list.stimuliNames_1.currentvalue== 8
|| list.stimuliNames_1.currentvalue== 9
|| list.stimuliNames_1.currentvalue== 16
|| list.stimuliNames_1.currentvalue== 18
|| list.stimuliNames_1.currentvalue== 21
|| list.stimuliNames_1.currentvalue== 23
|| list.stimuliNames_1.currentvalue== 24
|| list.stimuliNames_1.currentvalue== 27
|| list.stimuliNames_1.currentvalue== 30
|| list.stimuliNames_1.currentvalue== 35
|| list.stimuliNames_1.currentvalue== 37
|| list.stimuliNames_1.currentvalue== 40
|| list.stimuliNames_1.currentvalue== 43
|| list.stimuliNames_1.currentvalue== 55
|| list.stimuliNames_1.currentvalue== 57
|| list.stimuliNames_1.currentvalue== 59
|| list.stimuliNames_1.currentvalue== 60
|| list.stimuliNames_1.currentvalue== 69
|| list.stimuliNames_1.currentvalue== 71
|| list.stimuliNames_1.currentvalue== 75
|| list.stimuliNames_1.currentvalue== 78
|| list.stimuliNames_1.currentvalue== 85 ) { values.condition = 2;    }

else if ( list.stimuliNames_1.currentvalue== 4
|| list.stimuliNames_1.currentvalue== 5
|| list.stimuliNames_1.currentvalue== 7
|| list.stimuliNames_1.currentvalue== 10
|| list.stimuliNames_1.currentvalue== 11
|| list.stimuliNames_1.currentvalue== 14
|| list.stimuliNames_1.currentvalue== 15
|| list.stimuliNames_1.currentvalue== 17
|| list.stimuliNames_1.currentvalue== 25
|| list.stimuliNames_1.currentvalue== 28
|| list.stimuliNames_1.currentvalue== 36
|| list.stimuliNames_1.currentvalue== 42
|| list.stimuliNames_1.currentvalue== 48
|| list.stimuliNames_1.currentvalue== 63
|| list.stimuliNames_1.currentvalue== 65
|| list.stimuliNames_1.currentvalue== 74
|| list.stimuliNames_1.currentvalue== 76
|| list.stimuliNames_1.currentvalue== 81
|| list.stimuliNames_1.currentvalue== 84
|| list.stimuliNames_1.currentvalue== 86
|| list.stimuliNames_1.currentvalue== 89
|| list.stimuliNames_1.currentvalue== 91
|| list.stimuliNames_1.currentvalue== 94
|| list.stimuliNames_1.currentvalue== 95) { values.condition = 3;    }
else if ( list.stimuliNames_1.currentvalue== 2
|| list.stimuliNames_1.currentvalue== 19
|| list.stimuliNames_1.currentvalue== 20
|| list.stimuliNames_1.currentvalue== 29
|| list.stimuliNames_1.currentvalue== 32
|| list.stimuliNames_1.currentvalue== 38
|| list.stimuliNames_1.currentvalue== 41
|| list.stimuliNames_1.currentvalue== 45
|| list.stimuliNames_1.currentvalue== 46
|| list.stimuliNames_1.currentvalue== 50
|| list.stimuliNames_1.currentvalue== 52
|| list.stimuliNames_1.currentvalue== 54
|| list.stimuliNames_1.currentvalue== 56
|| list.stimuliNames_1.currentvalue== 58
|| list.stimuliNames_1.currentvalue== 62
|| list.stimuliNames_1.currentvalue== 68
|| list.stimuliNames_1.currentvalue== 70
|| list.stimuliNames_1.currentvalue== 73
|| list.stimuliNames_1.currentvalue== 79
|| list.stimuliNames_1.currentvalue== 80
|| list.stimuliNames_1.currentvalue== 88
|| list.stimuliNames_1.currentvalue== 90
|| list.stimuliNames_1.currentvalue== 93
|| list.stimuliNames_1.currentvalue== 96) { values.condition = 4;    }
]
</trial>


<trial trial_video1>
/ ontrialbegin = [
    if ( list.stimuliNames_1.currentvalue== 6
|| list.stimuliNames_1.currentvalue== 12
|| list.stimuliNames_1.currentvalue== 13
|| list.stimuliNames_1.currentvalue== 22
|| list.stimuliNames_1.currentvalue== 26
|| list.stimuliNames_1.currentvalue== 31
|| list.stimuliNames_1.currentvalue== 33
|| list.stimuliNames_1.currentvalue== 34
|| list.stimuliNames_1.currentvalue== 39
|| list.stimuliNames_1.currentvalue== 44
|| list.stimuliNames_1.currentvalue== 47
|| list.stimuliNames_1.currentvalue== 49
|| list.stimuliNames_1.currentvalue== 51
|| list.stimuliNames_1.currentvalue== 53
|| list.stimuliNames_1.currentvalue== 61
|| list.stimuliNames_1.currentvalue== 64
|| list.stimuliNames_1.currentvalue== 66
|| list.stimuliNames_1.currentvalue== 67
|| list.stimuliNames_1.currentvalue== 72
|| list.stimuliNames_1.currentvalue== 77
|| list.stimuliNames_1.currentvalue== 82
|| list.stimuliNames_1.currentvalue== 83
|| list.stimuliNames_1.currentvalue== 87
|| list.stimuliNames_1.currentvalue== 92) {trial.trial_video1.insertstimulusframe(port.C2_onset, 1)}

else if ( list.stimuliNames_1.currentvalue== 1
|| list.stimuliNames_1.currentvalue== 3
|| list.stimuliNames_1.currentvalue== 8
|| list.stimuliNames_1.currentvalue== 9
|| list.stimuliNames_1.currentvalue== 16
|| list.stimuliNames_1.currentvalue== 18
|| list.stimuliNames_1.currentvalue== 21
|| list.stimuliNames_1.currentvalue== 23
|| list.stimuliNames_1.currentvalue== 24
|| list.stimuliNames_1.currentvalue== 27
|| list.stimuliNames_1.currentvalue== 30
|| list.stimuliNames_1.currentvalue== 35
|| list.stimuliNames_1.currentvalue== 37
|| list.stimuliNames_1.currentvalue== 40
|| list.stimuliNames_1.currentvalue== 43
|| list.stimuliNames_1.currentvalue== 55
|| list.stimuliNames_1.currentvalue== 57
|| list.stimuliNames_1.currentvalue== 59
|| list.stimuliNames_1.currentvalue== 60
|| list.stimuliNames_1.currentvalue== 69
|| list.stimuliNames_1.currentvalue== 71
|| list.stimuliNames_1.currentvalue== 75
|| list.stimuliNames_1.currentvalue== 78
|| list.stimuliNames_1.currentvalue== 85 ) {trial.trial_video1.insertstimulusframe(port.C3_onset, 1)}

else if ( list.stimuliNames_1.currentvalue== 4
|| list.stimuliNames_1.currentvalue== 5
|| list.stimuliNames_1.currentvalue== 7
|| list.stimuliNames_1.currentvalue== 10
|| list.stimuliNames_1.currentvalue== 11
|| list.stimuliNames_1.currentvalue== 14
|| list.stimuliNames_1.currentvalue== 15
|| list.stimuliNames_1.currentvalue== 17
|| list.stimuliNames_1.currentvalue== 25
|| list.stimuliNames_1.currentvalue== 28
|| list.stimuliNames_1.currentvalue== 36
|| list.stimuliNames_1.currentvalue== 42
|| list.stimuliNames_1.currentvalue== 48
|| list.stimuliNames_1.currentvalue== 63
|| list.stimuliNames_1.currentvalue== 65
|| list.stimuliNames_1.currentvalue== 74
|| list.stimuliNames_1.currentvalue== 76
|| list.stimuliNames_1.currentvalue== 81
|| list.stimuliNames_1.currentvalue== 84
|| list.stimuliNames_1.currentvalue== 86
|| list.stimuliNames_1.currentvalue== 89
|| list.stimuliNames_1.currentvalue== 91
|| list.stimuliNames_1.currentvalue== 94
|| list.stimuliNames_1.currentvalue== 95) {trial.trial_video1.insertstimulusframe(port.I0_onset, 1)}

else if ( list.stimuliNames_1.currentvalue== 2
|| list.stimuliNames_1.currentvalue== 19
|| list.stimuliNames_1.currentvalue== 20
|| list.stimuliNames_1.currentvalue== 29
|| list.stimuliNames_1.currentvalue== 32
|| list.stimuliNames_1.currentvalue== 38
|| list.stimuliNames_1.currentvalue== 41
|| list.stimuliNames_1.currentvalue== 45
|| list.stimuliNames_1.currentvalue== 46
|| list.stimuliNames_1.currentvalue== 50
|| list.stimuliNames_1.currentvalue== 52
|| list.stimuliNames_1.currentvalue== 54
|| list.stimuliNames_1.currentvalue== 56
|| list.stimuliNames_1.currentvalue== 58
|| list.stimuliNames_1.currentvalue== 62
|| list.stimuliNames_1.currentvalue== 68
|| list.stimuliNames_1.currentvalue== 70
|| list.stimuliNames_1.currentvalue== 73
|| list.stimuliNames_1.currentvalue== 79
|| list.stimuliNames_1.currentvalue== 80
|| list.stimuliNames_1.currentvalue== 88
|| list.stimuliNames_1.currentvalue== 90
|| list.stimuliNames_1.currentvalue== 93
|| list.stimuliNames_1.currentvalue== 96) {trial.trial_video1.insertstimulusframe(port.I3_onset, 1)};


]

/ ontrialbegin = [trial.trial_video1.insertstimulusframe(port.reset, 2)  ]

/ stimulusframes = [ 1 = video.videolist_1 ]
/ trialduration = 2500
/ recorddata = true
/ branch = [    return trial.taskMF ]

/ontrialend = [
values.code = list.stimuliNames_1.currentvalue;
if (
video.videolist_1.currentitem == "f2AppC2Offe.mp4"||
video.videolist_1.currentitem == "f2AppC3Offe.mp4"||
video.videolist_1.currentitem == "f2AppI0Move.mp4"||
video.videolist_1.currentitem == "f2AppI3Move.mp4"||
video.videolist_1.currentitem == "f2BooC2Show.mp4"||
video.videolist_1.currentitem == "f2BooC3Show.mp4"||
video.videolist_1.currentitem == "f2BooI0Watc.mp4"||
video.videolist_1.currentitem == "f2BooI3Watc.mp4"||
video.videolist_1.currentitem == "f2CloC2Show.mp4"||
video.videolist_1.currentitem == "f2CloC3Show.mp4"||
video.videolist_1.currentitem == "f2CloI0Watc.mp4"||
video.videolist_1.currentitem == "f2CloI3Watc.mp4"||
video.videolist_1.currentitem == "f2CupC2Offe.mp4"||
video.videolist_1.currentitem == "f2CupC3Offe.mp4"||
video.videolist_1.currentitem == "f2CupI0Move.mp4"||
video.videolist_1.currentitem == "f2CupI3Move.mp4"||
video.videolist_1.currentitem == "f2KeyC2Offe.mp4"||
video.videolist_1.currentitem == "f2KeyC3Offe.mp4"||
video.videolist_1.currentitem == "f2KeyI0Move.mp4"||
video.videolist_1.currentitem == "f2KeyI3Move.mp4"||
video.videolist_1.currentitem == "f2PhoC2Show.mp4"||
video.videolist_1.currentitem == "f2PhoC3Show.mp4"||
video.videolist_1.currentitem == "f2PhoI0Watc.mp4"||
video.videolist_1.currentitem == "f2PhoI3Watc.mp4"||
video.videolist_1.currentitem == "f1AppC2Offe.mp4"||
video.videolist_1.currentitem == "f1AppC3Offe.mp4"||
video.videolist_1.currentitem == "f1AppI0Move.mp4"||
video.videolist_1.currentitem == "f1AppI3Move.mp4"||
video.videolist_1.currentitem == "f1BooC2Show.mp4"||
video.videolist_1.currentitem == "f1BooC3Show.mp4"||
video.videolist_1.currentitem == "f1BooI0Watc.mp4"||
video.videolist_1.currentitem == "f1BooI3Watc.mp4"||
video.videolist_1.currentitem == "f1CloC2Show.mp4"||
video.videolist_1.currentitem == "f1CloC3Show.mp4"||
video.videolist_1.currentitem == "f1CloI0Watc.mp4"||
video.videolist_1.currentitem == "f1CloI3Watc.mp4"||
video.videolist_1.currentitem == "f1CupC2Offe.mp4"||
video.videolist_1.currentitem == "f1CupC3Offe.mp4"||
video.videolist_1.currentitem == "f1CupI0Move.mp4"||
video.videolist_1.currentitem == "f1CupI3Move.mp4"||
video.videolist_1.currentitem == "f1KeyC2Offe.mp4"||
video.videolist_1.currentitem == "f1KeyC3Offe.mp4"||
video.videolist_1.currentitem == "f1KeyI0Move.mp4"||
video.videolist_1.currentitem == "f1KeyI3Move.mp4"||
video.videolist_1.currentitem == "f1PhoC2Show.mp4"||
video.videolist_1.currentitem == "f1PhoC3Show.mp4"||
video.videolist_1.currentitem == "f1PhoI0Watc.mp4"||
video.videolist_1.currentitem == "f1PhoI3Watc.mp4")
{values.actor = "x"} else if (
video.videolist_1.currentitem == "m1AppC2Offe.mp4"||
video.videolist_1.currentitem == "m1AppC3Offe.mp4"||
video.videolist_1.currentitem == "m1AppI0Move.mp4"||
video.videolist_1.currentitem == "m1AppI3Move.mp4"||
video.videolist_1.currentitem == "m1BooC2Show.mp4"||
video.videolist_1.currentitem == "m1BooC3Show.mp4"||
video.videolist_1.currentitem == "m1BooI0Watc.mp4"||
video.videolist_1.currentitem == "m1BooI3Watc.mp4"||
video.videolist_1.currentitem == "m1CloC2Show.mp4"||
video.videolist_1.currentitem == "m1CloC3Show.mp4"||
video.videolist_1.currentitem == "m1CloI0Watc.mp4"||
video.videolist_1.currentitem == "m1CloI3Watc.mp4"||
video.videolist_1.currentitem == "m1CupC2Offe.mp4"||
video.videolist_1.currentitem == "m1CupC3Offe.mp4"||
video.videolist_1.currentitem == "m1CupI0Move.mp4"||
video.videolist_1.currentitem == "m1CupI3Move.mp4"||
video.videolist_1.currentitem == "m1KeyC2Offe.mp4"||
video.videolist_1.currentitem == "m1KeyC3Offe.mp4"||
video.videolist_1.currentitem == "m1KeyI0Move.mp4"||
video.videolist_1.currentitem == "m1KeyI3Move.mp4"||
video.videolist_1.currentitem == "m1PhoC2Show.mp4"||
video.videolist_1.currentitem == "m1PhoC3Show.mp4"||
video.videolist_1.currentitem == "m1PhoI0Watc.mp4"||
video.videolist_1.currentitem == "m1PhoI3Watc.mp4"||
video.videolist_1.currentitem == "m2AppC2Offe.mp4"||
video.videolist_1.currentitem == "m2AppC3Offe.mp4"||
video.videolist_1.currentitem == "m2AppI0Move.mp4"||
video.videolist_1.currentitem == "m2AppI3Move.mp4"||
video.videolist_1.currentitem == "m2BooC2Show.mp4"||
video.videolist_1.currentitem == "m2BooC3Show.mp4"||
video.videolist_1.currentitem == "m2BooI0Watc.mp4"||
video.videolist_1.currentitem == "m2BooI3Watc.mp4"||
video.videolist_1.currentitem == "m2CIoI0Watc.mp4"||
video.videolist_1.currentitem == "m2CloC2Show.mp4"||
video.videolist_1.currentitem == "m2CloC3Show.mp4"||
video.videolist_1.currentitem == "m2CloI3Watc.mp4"||
video.videolist_1.currentitem == "m2CupC2Offe.mp4"||
video.videolist_1.currentitem == "m2CupC3Offe.mp4"||
video.videolist_1.currentitem == "m2CupI0Move.mp4"||
video.videolist_1.currentitem == "m2CupI3Move.mp4"||
video.videolist_1.currentitem == "m2KeyC2Offe.mp4"||
video.videolist_1.currentitem == "m2KeyC3Offe.mp4"||
video.videolist_1.currentitem == "m2KeyI0Move.mp4"||
video.videolist_1.currentitem == "m2KeyI3Move.mp4"||
video.videolist_1.currentitem == "m2PhoC2Show.mp4"||
video.videolist_1.currentitem == "m2PhoC3Show.mp4"||
video.videolist_1.currentitem == "m2PhoI0Watc.mp4"||
video.videolist_1.currentitem == "m2PhoI3Watc.mp4")
{values.actor = "m"}
]
</trial>

<trial end>
/ ontrialbegin = [    values.count_sequence += 1;
       values.accuracy = 0;
                    values.actor = 0;
                    values.condition = 0;
                    values.conditionlabel = 0;
                    values.fix_duration = 0;
                    ]
/ trialduration = 0
/ stimulusframes = [1 = reset]
/ branch = [return trial.fixation;]
/ errormessage = false
/ recorddata = false
</trial>
**************************************************************************************************************
**************************************************************************************************************
 STIMULI
**************************************************************************************************************
**************************************************************************************************************

--------------
items
--------------


<video videolist_1>
/ size = (100%, 100%)
/ select = sequence
/items= (
"m2CupC3Offe.mp4",
"f1CupI3Move.mp4",
"m1KeyC3Offe.mp4",
"f2KeyI0Move.mp4",
"f1PhoI0Watc.mp4",
"m2KeyC2Offe.mp4",
"f1AppI0Move.mp4",
"m2PhoC3Show.mp4",
"f2CupC3Offe.mp4",
"f1KeyI0Move.mp4",
"m2BooI0Watc.mp4",
"f1AppC2Offe.mp4",
"m2PhoC2Show.mp4",
"f2BooI0Watc.mp4",
"f1CupI0Move.mp4",
"m1AppC3Offe.mp4",
"f2CloI0Watc.mp4",
"m1BooC3Show.mp4",
"f2AppI3Move.mp4",
"m2CloI3Watc.mp4",
"f1KeyC3Offe.mp4",
"m1AppC2Offe.mp4",
"f1AppC3Offe.mp4",
"m1CloC3Show.mp4",
"m2AppI0Move.mp4",
"f2KeyC2Offe.mp4",
"m1PhoC3Show.mp4",
"f1CloI0Watc.mp4",
"m2BooI3Watc.mp4",
"f2PhoC3Show.mp4",
"m2CupC2Offe.mp4",
"m1AppI3Move.mp4",
"f2AppC2Offe.mp4",
"m1BooC2Show.mp4",
"f2CloC3Show.mp4",
"m1AppI0Move.mp4",
"m2BooC3Show.mp4",
"f2PhoI3Watc.mp4",
"f1KeyC2Offe.mp4",
"m2AppC3Offe.mp4",
"f2CloI3Watc.mp4",
"m1BooI0Watc.mp4",
"f1PhoC3Show.mp4",
"m2CloC2Show.mp4",
"f2KeyI3Move.mp4",
"m2AppI3Move.mp4",
"m1CupC2Offe.mp4",
"f2PhoI0Watc.mp4",
"f1CloC2Show.mp4",
"m2KeyI3Move.mp4",
"f2BooC2Show.mp4",
"m1CupI3Move.mp4",
"m2AppC2Offe.mp4",
"f1KeyI3Move.mp4",
"m2CloC3Show.mp4",
"f2BooI3Watc.mp4",
"m2KeyC3Offe.mp4",
"f1PhoI3Watc.mp4",
"m1CupC3Offe.mp4",
"f1BooC3Show.mp4",
"f2CloC2Show.mp4",
"m1BooI3Watc.mp4",
"f2AppI0Move.mp4",
"f1PhoC2Show.mp4",
"m2CIoI0Watc.mp4",
"f2PhoC2Show.mp4",
"f1CupC2Offe.mp4",
"m1KeyI3Move.mp4",
"f2AppC3Offe.mp4",
"m2PhoI3Watc.mp4",
"f2BooC3Show.mp4",
"m1KeyC2Offe.mp4",
"f1BooI3Watc.mp4",
"m1CupI0Move.mp4",
"f1CloC3Show.mp4",
"m2CupI0Move.mp4",
"m1PhoC2Show.mp4",
"f1CupC3Offe.mp4",
"m1CloI3Watc.mp4",
"f1AppI3Move.mp4",
"m2CIoI0Watc.mp4",
"f2CupC2Offe.mp4",
"m1CloC2Show.mp4",
"m2CupI0Move.mp4",
"f2KeyC3Offe.mp4",
"m1CloI0Watc.mp4",
"f1BooC2Show.mp4",
"f2CupI3Move.mp4",
"m1KeyI0Move.mp4",
"m2CupI3Move.mp4",
"f1BooI0Watc.mp4",
"m2BooC2Show.mp4",
"m1PhoI3Watc.mp4",
"f2CupI0Move.mp4",
"m2PhoI0Watc.mp4",
"f1CloI3Watc.mp4"
)
</video>


When you insert stimuli into a trial's stimulus presentation sequence those insertions persist across instances of this trial, unless you explicitly reset that trial's stimulus presentation sequence to its original state by calling the resetstimulusframes() function.

https://www.millisecond.com/support/docs/current/html/language/functions/resetstimulusframes.htm

That is, if you insert stimulus A in the trial's 1st instance, and stimulus B in the trial's second instance, then the 2nd instance will display both stimulus A and B.

That is what is happening here with your triggers. Your trial isn't just presenting a single specific trigger, it's presenting multiple overlapping ones.

Observe what happens in the below examples with visual stimuli. The same is true for any other type of stimulus, including <port>.

<block myblock>
/ trials = [1-3 = mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [
    trial.mytrial.insertstimulusframe(list.stimuli.nextvalue, 1);
]
/ stimulusframes = [1=clearscreen]

/ validresponse = (57)
</trial>

<text a>
/ items = ("A")
/ position = (50%, 45%)
</text>

<text b>
/ items = ("B")
/ position = (50%, 50%)
</text>

<text c>
/ items = ("C")
/ position = (50%, 55%)
</text>

<list stimuli>
/ items = (text.a, text.b, text.c)
/ selectionmode = sequence
</list>


vs.

<block myblock>
/ trials = [1-3 = mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [
    trial.mytrial.resetstimulusframes();
    trial.mytrial.insertstimulusframe(list.stimuli.nextvalue, 1);
]
/ stimulusframes = [1=clearscreen]

/ validresponse = (57)
</trial>

<text a>
/ items = ("A")
/ position = (50%, 45%)
</text>

<text b>
/ items = ("B")
/ position = (50%, 50%)
</text>

<text c>
/ items = ("C")
/ position = (50%, 55%)
</text>

<list stimuli>
/ items = (text.a, text.b, text.c)
/ selectionmode = sequence
</list>



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search