Millisecond Forums

Creating flickering images

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

By sharondan - 8/11/2020

Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?
By Dave - 8/11/2020

sharondan - 8/11/2020
Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?

It would be really helpful if your example code contained any and all actual values and definitions it needs to run. Anyway, what you'll want to do is define a proper /size for the <text> element, not just a font size. Fonts are weird, different glyphs in a given font have vastly different heights and widths, which I suspect is where the seeming discrepancy comes from.
By Dave - 8/11/2020

Dave - 8/11/2020
sharondan - 8/11/2020
Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?

It would be really helpful if your example code contained any and all actual values and definitions it needs to run. Anyway, what you'll want to do is define a proper /size for the <text> element, not just a font size. Fonts are weird, different glyphs in a given font have vastly different heights and widths, which I suspect is where the seeming discrepancy comes from.

As an aside, if I wanted to use text shapes / symbol glyphs to achieve blinking while ensuring the masking stimulus matches the glyph size, I'd set things up like this:

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = white
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=shape; 40=erasehape; 80=shape; 120=erasehape; 160=shape; 200=erasehape; 240 = shape; 280=erasehape; 320=shape; 360=erasehape; 400=shape; 440=erasehape]
/ validresponse = (57)
</trial>

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


By sharondan - 8/12/2020

Dave - 8/12/2020
Dave - 8/11/2020
sharondan - 8/11/2020
Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?

It would be really helpful if your example code contained any and all actual values and definitions it needs to run. Anyway, what you'll want to do is define a proper /size for the <text> element, not just a font size. Fonts are weird, different glyphs in a given font have vastly different heights and widths, which I suspect is where the seeming discrepancy comes from.

As an aside, if I wanted to use text shapes / symbol glyphs to achieve blinking while ensuring the masking stimulus matches the glyph size, I'd set things up like this:

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = white
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=shape; 40=erasehape; 80=shape; 120=erasehape; 160=shape; 200=erasehape; 240 = shape; 280=erasehape; 320=shape; 360=erasehape; 400=shape; 440=erasehape]
/ validresponse = (57)
</trial>

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



Thanks Dave,
It was very helpful!
It seems that those text shapes are presented differently on Mac (looks good) and on Windows (not the same size outlined in black this can be seen from the editor). I'd presume that I would need to change the stimuli to pictures to solve it.
Thanks
Sharon

By Dave - 8/12/2020

sharondan - 8/12/2020
Dave - 8/12/2020
Dave - 8/11/2020
sharondan - 8/11/2020
Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?

It would be really helpful if your example code contained any and all actual values and definitions it needs to run. Anyway, what you'll want to do is define a proper /size for the <text> element, not just a font size. Fonts are weird, different glyphs in a given font have vastly different heights and widths, which I suspect is where the seeming discrepancy comes from.

As an aside, if I wanted to use text shapes / symbol glyphs to achieve blinking while ensuring the masking stimulus matches the glyph size, I'd set things up like this:

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = white
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=shape; 40=erasehape; 80=shape; 120=erasehape; 160=shape; 200=erasehape; 240 = shape; 280=erasehape; 320=shape; 360=erasehape; 400=shape; 440=erasehape]
/ validresponse = (57)
</trial>

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



Thanks Dave,
It was very helpful!
It seems that those text shapes are presented differently on Mac (looks good) and on Windows (not the same size outlined in black this can be seen from the editor). I'd presume that I would need to change the stimuli to pictures to solve it.
Thanks
Sharon


Not seeing this under Windows. Here's the code

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = red
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=clearscreen, shape, erasehape;]
/ validresponse = (57)
/ screencapture = true
</trial>

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

and here's the screen captures of the shapes overlayed (red on top of blue); the blue shape is not visible.
By sharondan - 8/12/2020

Dave - 8/12/2020
sharondan - 8/12/2020
Dave - 8/12/2020
Dave - 8/11/2020
sharondan - 8/11/2020
Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?

It would be really helpful if your example code contained any and all actual values and definitions it needs to run. Anyway, what you'll want to do is define a proper /size for the <text> element, not just a font size. Fonts are weird, different glyphs in a given font have vastly different heights and widths, which I suspect is where the seeming discrepancy comes from.

As an aside, if I wanted to use text shapes / symbol glyphs to achieve blinking while ensuring the masking stimulus matches the glyph size, I'd set things up like this:

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = white
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=shape; 40=erasehape; 80=shape; 120=erasehape; 160=shape; 200=erasehape; 240 = shape; 280=erasehape; 320=shape; 360=erasehape; 400=shape; 440=erasehape]
/ validresponse = (57)
</trial>

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



Thanks Dave,
It was very helpful!
It seems that those text shapes are presented differently on Mac (looks good) and on Windows (not the same size outlined in black this can be seen from the editor). I'd presume that I would need to change the stimuli to pictures to solve it.
Thanks
Sharon


Not seeing this under Windows. Here's the code

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = red
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=clearscreen, shape, erasehape;]
/ validresponse = (57)
/ screencapture = true
</trial>

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

and here's the screen captures of the shapes overlayed (red on top of blue); the blue shape is not visible.

Thanks Dave,
The shapes are not the same size on the screen (triangle and circle for instance). In your example, you used  / 1 = "●"  while I've chosen a different stimulus "⚫" - where the behaviour on Mac and Win is different (I'd say it is OS different and not Inquisit). Please note that any kind of 3 different filled shapes will do the job as long as they are presented on the screen in the same size.
Attached please find my code, I'm still working on it so apologies for the mess. The file to run is FD_Exp (search on your name will point out the issues).
Thanks,
Sharon.

By Dave - 8/12/2020

sharondan - 8/12/2020
Dave - 8/12/2020
sharondan - 8/12/2020
Dave - 8/12/2020
Dave - 8/11/2020
sharondan - 8/11/2020
Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?

It would be really helpful if your example code contained any and all actual values and definitions it needs to run. Anyway, what you'll want to do is define a proper /size for the <text> element, not just a font size. Fonts are weird, different glyphs in a given font have vastly different heights and widths, which I suspect is where the seeming discrepancy comes from.

As an aside, if I wanted to use text shapes / symbol glyphs to achieve blinking while ensuring the masking stimulus matches the glyph size, I'd set things up like this:

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = white
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=shape; 40=erasehape; 80=shape; 120=erasehape; 160=shape; 200=erasehape; 240 = shape; 280=erasehape; 320=shape; 360=erasehape; 400=shape; 440=erasehape]
/ validresponse = (57)
</trial>

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



Thanks Dave,
It was very helpful!
It seems that those text shapes are presented differently on Mac (looks good) and on Windows (not the same size outlined in black this can be seen from the editor). I'd presume that I would need to change the stimuli to pictures to solve it.
Thanks
Sharon


Not seeing this under Windows. Here's the code

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = red
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=clearscreen, shape, erasehape;]
/ validresponse = (57)
/ screencapture = true
</trial>

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

and here's the screen captures of the shapes overlayed (red on top of blue); the blue shape is not visible.

Thanks Dave,
The shapes are not the same size on the screen (triangle and circle for instance). In your example, you used  / 1 = "●"  while I've chosen a different stimulus "⚫" - where the behaviour on Mac and Win is different (I'd say it is OS different and not Inquisit). Please note that any kind of 3 different filled shapes will do the job as long as they are presented on the screen in the same size.
Attached please find my code, I'm still working on it so apologies for the mess. The file to run is FD_Exp (search on your name will point out the issues).
Thanks,
Sharon.


Problem is with the specific characters you've chosen, here and here:



Those aren't typical font glyphs, they're Unicode emoji characters

"Black Medium Square"
https://emojipedia.org/black-medium-square/

and

"Medium Black Circle"
https://emojipedia.org/black-circle/

Platforms / OSes are sort of free to choose and vary in how they render those emoji, so this is caused by platform differences, not Inquisit.

You won't find three shape characters or glyphs that have exaclty the same size, so maybe you should work with <shape> elements to begin with or indeed go for <picture> items.

By sharondan - 8/12/2020

Dave - 8/13/2020
sharondan - 8/12/2020
Dave - 8/12/2020
sharondan - 8/12/2020
Dave - 8/12/2020
Dave - 8/11/2020
sharondan - 8/11/2020
Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?

It would be really helpful if your example code contained any and all actual values and definitions it needs to run. Anyway, what you'll want to do is define a proper /size for the <text> element, not just a font size. Fonts are weird, different glyphs in a given font have vastly different heights and widths, which I suspect is where the seeming discrepancy comes from.

As an aside, if I wanted to use text shapes / symbol glyphs to achieve blinking while ensuring the masking stimulus matches the glyph size, I'd set things up like this:

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = white
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=shape; 40=erasehape; 80=shape; 120=erasehape; 160=shape; 200=erasehape; 240 = shape; 280=erasehape; 320=shape; 360=erasehape; 400=shape; 440=erasehape]
/ validresponse = (57)
</trial>

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



Thanks Dave,
It was very helpful!
It seems that those text shapes are presented differently on Mac (looks good) and on Windows (not the same size outlined in black this can be seen from the editor). I'd presume that I would need to change the stimuli to pictures to solve it.
Thanks
Sharon


Not seeing this under Windows. Here's the code

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = red
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=clearscreen, shape, erasehape;]
/ validresponse = (57)
/ screencapture = true
</trial>

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

and here's the screen captures of the shapes overlayed (red on top of blue); the blue shape is not visible.

Thanks Dave,
The shapes are not the same size on the screen (triangle and circle for instance). In your example, you used  / 1 = "●"  while I've chosen a different stimulus "⚫" - where the behaviour on Mac and Win is different (I'd say it is OS different and not Inquisit). Please note that any kind of 3 different filled shapes will do the job as long as they are presented on the screen in the same size.
Attached please find my code, I'm still working on it so apologies for the mess. The file to run is FD_Exp (search on your name will point out the issues).
Thanks,
Sharon.


Problem is with the specific characters you've chosen, here and here:



Those aren't typical font glyphs, they're Unicode emoji characters

"Black Medium Square"
https://emojipedia.org/black-medium-square/

and

"Medium Black Circle"
https://emojipedia.org/black-circle/

Platforms / OSes are sort of free to choose and vary in how they render those emoji, so this is caused by platform differences, not Inquisit.

You won't find three shape characters or glyphs that have exaclty the same size, so maybe you should work with <shape> elements to begin with or indeed go for <picture> items.


Thanks Dave,

Since I can not change shapes dynamically, my only option is pictures.

Thanks again,
Much appreciated!
By sharondan - 8/25/2020

Dave - 8/12/2020
Dave - 8/11/2020
sharondan - 8/11/2020
Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?

It would be really helpful if your example code contained any and all actual values and definitions it needs to run. Anyway, what you'll want to do is define a proper /size for the <text> element, not just a font size. Fonts are weird, different glyphs in a given font have vastly different heights and widths, which I suspect is where the seeming discrepancy comes from.

As an aside, if I wanted to use text shapes / symbol glyphs to achieve blinking while ensuring the masking stimulus matches the glyph size, I'd set things up like this:

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = white
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=shape; 40=erasehape; 80=shape; 120=erasehape; 160=shape; 200=erasehape; 240 = shape; 280=erasehape; 320=shape; 360=erasehape; 400=shape; 440=erasehape]
/ validresponse = (57)
</trial>

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



Hi Dave,
Thanks for your answer.
I need to change the flickering rate according to participant performance.
I've seen from your previous answers that stimulustimes cannot be changed dynamically, on the other hand, insertstimulustime waits until the time elapses, so I'm bounded by the lowest freq rate.
Is there a way to solve it (dynamically changing the frames without waiting for its executions) ?
By Dave - 8/25/2020

sharondan - 8/25/2020
Dave - 8/12/2020
Dave - 8/11/2020
sharondan - 8/11/2020
Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?

It would be really helpful if your example code contained any and all actual values and definitions it needs to run. Anyway, what you'll want to do is define a proper /size for the <text> element, not just a font size. Fonts are weird, different glyphs in a given font have vastly different heights and widths, which I suspect is where the seeming discrepancy comes from.

As an aside, if I wanted to use text shapes / symbol glyphs to achieve blinking while ensuring the masking stimulus matches the glyph size, I'd set things up like this:

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = white
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=shape; 40=erasehape; 80=shape; 120=erasehape; 160=shape; 200=erasehape; 240 = shape; 280=erasehape; 320=shape; 360=erasehape; 400=shape; 440=erasehape]
/ validresponse = (57)
</trial>

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



Hi Dave,
Thanks for your answer.
I need to change the flickering rate according to participant performance.
I've seen from your previous answers that stimulustimes cannot be changed dynamically, on the other hand, insertstimulustime waits until the time elapses, so I'm bounded by the lowest freq rate.
Is there a way to solve it (dynamically changing the frames without waiting for its executions) ?

> I've seen from your previous answers that stimulustimes cannot be changed dynamically, on the other hand, insertstimulustime waits until the time elapses

The insertstimulustimes() function is there to dynamically alter a trial's stimulustimes. I don't understand what you mean by "insertstimulustime waits until the time elapses."

It is a fact that a trial's stimulus presentation sequence cannot be altered while the trial is already running and presenting stimuli. That goes for /stimulustimes as well as using inserstimulustime().

Since your overall description is cryptic, that is all I can say for now.




By sharondan - 8/26/2020

Dave - 8/25/2020
sharondan - 8/25/2020
Dave - 8/12/2020
Dave - 8/11/2020
sharondan - 8/11/2020
Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?

It would be really helpful if your example code contained any and all actual values and definitions it needs to run. Anyway, what you'll want to do is define a proper /size for the <text> element, not just a font size. Fonts are weird, different glyphs in a given font have vastly different heights and widths, which I suspect is where the seeming discrepancy comes from.

As an aside, if I wanted to use text shapes / symbol glyphs to achieve blinking while ensuring the masking stimulus matches the glyph size, I'd set things up like this:

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = white
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=shape; 40=erasehape; 80=shape; 120=erasehape; 160=shape; 200=erasehape; 240 = shape; 280=erasehape; 320=shape; 360=erasehape; 400=shape; 440=erasehape]
/ validresponse = (57)
</trial>

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



Hi Dave,
Thanks for your answer.
I need to change the flickering rate according to participant performance.
I've seen from your previous answers that stimulustimes cannot be changed dynamically, on the other hand, insertstimulustime waits until the time elapses, so I'm bounded by the lowest freq rate.
Is there a way to solve it (dynamically changing the frames without waiting for its executions) ?

> I've seen from your previous answers that stimulustimes cannot be changed dynamically, on the other hand, insertstimulustime waits until the time elapses

The insertstimulustimes() function is there to dynamically alter a trial's stimulustimes. I don't understand what you mean by "insertstimulustime waits until the time elapses."

It is a fact that a trial's stimulus presentation sequence cannot be altered while the trial is already running and presenting stimuli. That goes for /stimulustimes as well as using inserstimulustime().

Since your overall description is cryptic, that is all I can say for now.





Thanks for your reply.
There are 4 stimuli, two of them flicker in the same rate (constant freq = F1) and the other 2 flicker in a higher rate (but each one in a different freq: F2 and F3).
The challenge is to adjust the deltaF1 = (F2 - F1) and  deltaF2 = (F3 - F1) according to user performance.
I've been playing with this quite a while, thought that it is working but then discover that it is not working :-(
In order to flicker the stimuli here is what I did:
(The first call to this is with all the parameters satisfying the conditions (so the if is true and we go in))
<trial mainLoop>
/ ontrialbegin = [

if(values.elapsedTimeLow >= values.stimLowFreqMs){
trial.mainLoop.insertstimulustime(text.flickerPrimaryLow, 0);
trial.mainLoop.insertstimulustime(text.blankPrimaryLow, values.stimLowFreqMs);

trial.mainLoop.insertstimulustime(text.flickerSecondaryLow, 0);
trial.mainLoop.insertstimulustime(text.blankSecondaryLow, values.stimLowFreqMs);
values.elapsedTimeLow = 0;
};

if(values.elapsedTimeHigh_1 >= values.stimP_HighFreqMs){
trial.mainLoop.insertstimulustime(text.flickerPrimaryHigh, 0);
trial.mainLoop.insertstimulustime(text.blankPrimaryHigh, values.stimS_HighFreqMs);
values.elapsedTimeHigh_1 = 0;
};

if(values.elapsedTimeHigh_2 >= values.stimS_HighFreqMs){
trial.mainLoop.insertstimulustime(text.flickerSecondaryHigh, 0);
trial.mainLoop.insertstimulustime(text.blankSecondaryHigh, values.stimP_HighFreqMs);
values.elapsedTimeHigh_2 = 0;
};


values.countCyclesLow += values.stimLowFreqMs;
values.countCyclesHigh += values.stimS_HighFreqMs;
]
/ response = timeout(0))

/ ontrialend = [
values.currentTrialTime += trial.mainLoop.elapsedtime;
]
/ branch = [
 if (values.currentTrialTime < values.durationMs){
  values.elapsedTimeLow += trial.mainLoop.elapsedtime;
  values.elapsedTimeHigh_1 += trial.mainLoop.elapsedtime;
    values.elapsedTimeHigh_2 += trial.mainLoop.elapsedtime;
 return trial.mainLoop; //this is not being executed before the last call to insertstimulustime is being executed
 }
 else {
     return trial.responsetrial;
 };    
    
]
</trial>

This is not accurate because the recursive call is not being executed until the last call to insertstimulustime is being executed, which changes the timing of the flickering (bounded to the low freq)

Thanks,
Sharon.
By Dave - 8/26/2020

sharondan - 8/26/2020

Thanks for your reply.
There are 4 stimuli, two of them flicker in the same rate (constant freq = F1) and the other 2 flicker in a higher rate (but each one in a different freq: F2 and F3).
The challenge is to adjust the deltaF1 = (F2 - F1) and  deltaF2 = (F3 - F1) according to user performance.
I've been playing with this quite a while, thought that it is working but then discover that it is not working :-(
In order to flicker the stimuli here is what I did:
(The first call to this is with all the parameters satisfying the conditions (so the if is true and we go in))
<trial mainLoop>
/ ontrialbegin = [

if(values.elapsedTimeLow >= values.stimLowFreqMs){
trial.mainLoop.insertstimulustime(text.flickerPrimaryLow, 0);
trial.mainLoop.insertstimulustime(text.blankPrimaryLow, values.stimLowFreqMs);

trial.mainLoop.insertstimulustime(text.flickerSecondaryLow, 0);
trial.mainLoop.insertstimulustime(text.blankSecondaryLow, values.stimLowFreqMs);
values.elapsedTimeLow = 0;
};

if(values.elapsedTimeHigh_1 >= values.stimP_HighFreqMs){
trial.mainLoop.insertstimulustime(text.flickerPrimaryHigh, 0);
trial.mainLoop.insertstimulustime(text.blankPrimaryHigh, values.stimS_HighFreqMs);
values.elapsedTimeHigh_1 = 0;
};

if(values.elapsedTimeHigh_2 >= values.stimS_HighFreqMs){
trial.mainLoop.insertstimulustime(text.flickerSecondaryHigh, 0);
trial.mainLoop.insertstimulustime(text.blankSecondaryHigh, values.stimP_HighFreqMs);
values.elapsedTimeHigh_2 = 0;
};


values.countCyclesLow += values.stimLowFreqMs;
values.countCyclesHigh += values.stimS_HighFreqMs;
]
/ response = timeout(0))

/ ontrialend = [
values.currentTrialTime += trial.mainLoop.elapsedtime;
]
/ branch = [
 if (values.currentTrialTime < values.durationMs){
  values.elapsedTimeLow += trial.mainLoop.elapsedtime;
  values.elapsedTimeHigh_1 += trial.mainLoop.elapsedtime;
    values.elapsedTimeHigh_2 += trial.mainLoop.elapsedtime;
 return trial.mainLoop; //this is not being executed before the last call to insertstimulustime is being executed
 }
 else {
     return trial.responsetrial;
 };    
    
]
</trial>

This is not accurate because the recursive call is not being executed until the last call to insertstimulustime is being executed, which changes the timing of the flickering (bounded to the low freq)

Thanks,
Sharon.

I still have no idea what exactly you're trying to do or why "the recursive call is not being executed until the last call to insertstimulustime is being executed" is a problem. Put differently, I absolutely cannot decipher how you would *want* the code to behave based on the little information you have provided.
By sharondan - 8/26/2020

sharondan - 8/26/2020
Dave - 8/25/2020
sharondan - 8/25/2020
Dave - 8/12/2020
Dave - 8/11/2020
sharondan - 8/11/2020
Hi,
I'm trying to make flickering images (4 stimuli that will flicker in a different rate)
One thing I've noticed is that when using regular text (for instance letters) the size of the masking shape has to be bigger than the stimuli (the text size is set by fontstyle with percentage of screen size, background colour is transparent) in a factor of 1.35. For some reason, the width is completely overlapped but there are some variation with hight. (please see enclosed the debugger window). So there is still some portion of the text that is not covered by the mask. 
I had to increase the size of the mask by a factor of 1.31 in order to cover fully the stimuli.
Here is a short example:

<item shapeItems>
/1 = "o" //primary
/2 = "o" //secondary
/3 = "o" //always
</item>

<text flickerSimLow_1>
/ items = item.shapeItems
/ txcolor = black
/ txbgcolor = transparent
/ select = list.aShapePrimaryLow.nextvalue
</text>

<shape blankLow_1>
/ color = parameters.globalScreenColor
/shape = rectangle
/ size = (text.flickerSimLow_1.widthpct*values.multBlankStimRatio_w, text.flickerSimLow_1.heightpct*values.multBlankStimRatio_h)
/ position = (text.flickerSimLow_1.hposition, text.flickerSimLow_1.vposition)
</shape>

============================End example ========================================
Note that even though the percentage is the same, pixel-wise they are not.
Changing the mask shape to be as the same pixels of the text does not help either.


BTW
Originally the flickering was made by these text shapes  "⚫", "▲", ""◼", but due to the problem I've changed it to be 4 stimuli that are the same and the problem still exist. 

Any idea why this happens and would it be the same for pictures?

It would be really helpful if your example code contained any and all actual values and definitions it needs to run. Anyway, what you'll want to do is define a proper /size for the <text> element, not just a font size. Fonts are weird, different glyphs in a given font have vastly different heights and widths, which I suspect is where the seeming discrepancy comes from.

As an aside, if I wanted to use text shapes / symbol glyphs to achieve blinking while ensuring the masking stimulus matches the glyph size, I'd set things up like this:

<text shape>
/ items = shapeitems
/ txcolor = blue
/ fontstyle = ("Arial", 10%)
/ select = sequence
/ erase = false
</text>

<text erasehape>
/ items = shapeitems
/ txcolor = white
/ fontstyle = ("Arial", 10%)
/ select = text.shape.currentindex
/ erase = false
</text>

<item shapeitems>
/ 1 = "●"
/ 2 = "▲"
/ 3 = "■"
</item>

<trial blink>
/ stimulustimes = [0=shape; 40=erasehape; 80=shape; 120=erasehape; 160=shape; 200=erasehape; 240 = shape; 280=erasehape; 320=shape; 360=erasehape; 400=shape; 440=erasehape]
/ validresponse = (57)
</trial>

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



Hi Dave,
Thanks for your answer.
I need to change the flickering rate according to participant performance.
I've seen from your previous answers that stimulustimes cannot be changed dynamically, on the other hand, insertstimulustime waits until the time elapses, so I'm bounded by the lowest freq rate.
Is there a way to solve it (dynamically changing the frames without waiting for its executions) ?

> I've seen from your previous answers that stimulustimes cannot be changed dynamically, on the other hand, insertstimulustime waits until the time elapses

The insertstimulustimes() function is there to dynamically alter a trial's stimulustimes. I don't understand what you mean by "insertstimulustime waits until the time elapses."

It is a fact that a trial's stimulus presentation sequence cannot be altered while the trial is already running and presenting stimuli. That goes for /stimulustimes as well as using inserstimulustime().

Since your overall description is cryptic, that is all I can say for now.





Thanks for your reply.
There are 4 stimuli, two of them flicker in the same rate (constant freq = F1) and the other 2 flicker in a higher rate (but each one in a different freq: F2 and F3).
The challenge is to adjust the deltaF1 = (F2 - F1) and  deltaF2 = (F3 - F1) according to user performance.
I've been playing with this quite a while, thought that it is working but then discover that it is not working :-(
In order to flicker the stimuli here is what I did:
(The first call to this is with all the parameters satisfying the conditions (so the if is true and we go in))
<trial mainLoop>
/ ontrialbegin = [

if(values.elapsedTimeLow >= values.stimLowFreqMs){
trial.mainLoop.insertstimulustime(text.flickerPrimaryLow, 0);
trial.mainLoop.insertstimulustime(text.blankPrimaryLow, values.stimLowFreqMs);

trial.mainLoop.insertstimulustime(text.flickerSecondaryLow, 0);
trial.mainLoop.insertstimulustime(text.blankSecondaryLow, values.stimLowFreqMs);
values.elapsedTimeLow = 0;
};

if(values.elapsedTimeHigh_1 >= values.stimP_HighFreqMs){
trial.mainLoop.insertstimulustime(text.flickerPrimaryHigh, 0);
trial.mainLoop.insertstimulustime(text.blankPrimaryHigh, values.stimS_HighFreqMs);
values.elapsedTimeHigh_1 = 0;
};

if(values.elapsedTimeHigh_2 >= values.stimS_HighFreqMs){
trial.mainLoop.insertstimulustime(text.flickerSecondaryHigh, 0);
trial.mainLoop.insertstimulustime(text.blankSecondaryHigh, values.stimP_HighFreqMs);
values.elapsedTimeHigh_2 = 0;
};


values.countCyclesLow += values.stimLowFreqMs;
values.countCyclesHigh += values.stimS_HighFreqMs;
]
/ response = timeout(0))

/ ontrialend = [
values.currentTrialTime += trial.mainLoop.elapsedtime;
]
/ branch = [
 if (values.currentTrialTime < values.durationMs){
  values.elapsedTimeLow += trial.mainLoop.elapsedtime;
  values.elapsedTimeHigh_1 += trial.mainLoop.elapsedtime;
    values.elapsedTimeHigh_2 += trial.mainLoop.elapsedtime;
 return trial.mainLoop; //this is not being executed before the last call to insertstimulustime is being executed
 }
 else {
     return trial.responsetrial;
 };    
    
]
</trial>

This is not accurate because the recursive call is not being executed until the last call to insertstimulustime is being executed, which changes the timing of the flickering (bounded to the low freq)

Thanks,
Sharon.

Hi Dave,
Thank you for your help!
I think I solved it, here is the solution:
(a1 - a6) are just indicatrots for time elapesd.
<trial mainLoop>
/ ontrialbegin = [
if(mod(floor(values.currentTrialTime / values.stimLowFreqMs), 2) == 0) {
values.a1 += 1;
trial.mainLoop.insertstimulustime(text.flickerPrimaryLow, 0);
trial.mainLoop.insertstimulustime(text.flickerSecondaryLow, 0);
}
else {
trial.mainLoop.insertstimulustime(text.blankPrimaryLow, 0);
trial.mainLoop.insertstimulustime(text.blankSecondaryLow, 0);    
values.a2 += 1;
}

if(mod(floor(values.currentTrialTime / values.stimP_HighFreqMs), 2) == 0){
 trial.mainLoop.insertstimulustime(text.flickerPrimaryHigh, 0);
  values.a3 += 1;
}
else{    
  trial.mainLoop.insertstimulustime(text.blankPrimaryHigh, 0);
  values.a4 += 1;
}


if(mod(floor(values.currentTrialTime / values.stimS_HighFreqMs), 2) == 0){
  trial.mainLoop.insertstimulustime(text.flickerSecondaryHigh, 0);
  values.a5 += 1;
}
else {
  trial.mainLoop.insertstimulustime(text.blankSecondaryHigh, 0);
     values.a6 += 1;
}
]
/ response = timeout(0)

/ ontrialend = [
values.currentTrialTime += trial.mainLoop.elapsedtime;
]
/ branch = [
 if (values.currentTrialTime < values.durationMs){
 return trial.mainLoop;
 }
 else {
     return trial.responsetrial;
 };    
    
]
// recorddata = false
</trial>
Cheers,
Sharon.