Millisecond Forums

Using stimulustimes: can you have a variable instead of an integer?

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

By AbigailNovick - 10/7/2020

Hello,

I would like my stimuli to be displayed at different times depending on previous user performance.

My code worked fine before, when I had:
/ stimulustimes = [0=target;200=wordyellowcolorredup; 1800=target]

It doesn't work when I have:
/ stimulustimes = [0=target; 200=wordyellowcolorredup; values.buttonRT=target]

Is this a limitation of Inquisit? Do you have any suggestions for how I can dynamically update my stimulus timing?

Thanks so much,
Abby
By Dave - 10/7/2020

AbigailNovick - 10/7/2020
Hello,

I would like my stimuli to be displayed at different times depending on previous user performance.

My code worked fine before, when I had:
/ stimulustimes = [0=target;200=wordyellowcolorredup; 1800=target]

It doesn't work when I have:
/ stimulustimes = [0=target; 200=wordyellowcolorredup; values.buttonRT=target]

Is this a limitation of Inquisit? Do you have any suggestions for how I can dynamically update my stimulus timing?

Thanks so much,
Abby

The way to do this is via the insertstimulustime() function:

<trial example>
/ ontrialbegin = [
    trial.example.resetstimulusframes():
    trial.example.insertstimulustime(text.target, values.buttonRT);
]
/ stimulustimes = [0=target; 200=wordyellowcolorredup;]
...
</trial>

https://www.millisecond.com/support/docs/v6/html/language/functions/insertstimulustime.htm

By AbigailNovick - 10/7/2020

Hi Dave,

Thanks for pointing me to this function!

Unfortunately I don't think it's working. I tried making a giant white rectangle to mask out the stimulus right after it was displayed. The rectangle never appears, and the stimulus is visible for the entire duration of the trial (when I only want it to be visible for a few milliseconds). Am I doing something wrong here? 

<values>
/buttonRT = 205
</values>

<shape whiteRectangle>
/ shape = rectangle
/ color = white
/ size = (1000, 1000)
</shape>

<trial example>
/ ontrialbegin = [
  trial.example.resetstimulusframes():
  trial.example.insertstimulustime(shape.whiteRectangle, values.buttonRT);
]
/ stimulustimes = [0=target; 200=values.wordredcolorredup]
/ trialduration = 1800
</trial>
By Dave - 10/7/2020

AbigailNovick - 10/7/2020
Hi Dave,

Thanks for pointing me to this function!

Unfortunately I don't think it's working. I tried making a giant white rectangle to mask out the stimulus right after it was displayed. The rectangle never appears, and the stimulus is visible for the entire duration of the trial (when I only want it to be visible for a few milliseconds). Am I doing something wrong here? 

<values>
/buttonRT = 205
</values>

<shape whiteRectangle>
/ shape = rectangle
/ color = white
/ size = (1000, 1000)
</shape>

<trial example>
/ ontrialbegin = [
  trial.example.resetstimulusframes():
  trial.example.insertstimulustime(shape.whiteRectangle, values.buttonRT);
]
/ stimulustimes = [0=target; 200=values.wordredcolorredup]
/ trialduration = 1800
</trial>

There's a typo in the code (which originated with my example).

/ ontrialbegin = [
trial.example.resetstimulusframes():
trial.example.insertstimulustime(shape.whiteRectangle, values.buttonRT);
]

needs to be

/ ontrialbegin = [
trial.example.resetstimulusframes();
trial.example.insertstimulustime(shape.whiteRectangle, values.buttonRT);
]

to work.

Another problem is the chosen timing: Your display would have to be running at 200Hz for a 5ms display onset difference between the stimulus and the rectangle to be possible. If your display is running at a lower rate, which is likely, then the stimulus and the rectangle will be drawn to the screen at the exact same time, i.e. you'll never see the target to begin with.

<values>
/buttonRT = 210
</values>

<shape whiteRectangle>
/ shape = rectangle
/ color = white
/ size = (100%, 100%)
</shape>

<trial example>
/ ontrialbegin = [
trial.example.resetstimulusframes();
trial.example.insertstimulustime(shape.whiteRectangle, values.buttonRT);
]
/ stimulustimes = [0=target; 200=red]
/ trialduration = 1800
</trial>

<text target>
/ items = ("Target")
</text>

<text red>
/ items = ("STIMULUS")
/ txcolor = red
</text>

<block my>
/ trials = [1-4 = example]
</block>

By AbigailNovick - 10/7/2020

Dave - 10/7/2020
AbigailNovick - 10/7/2020
Hi Dave,

Thanks for pointing me to this function!

Unfortunately I don't think it's working. I tried making a giant white rectangle to mask out the stimulus right after it was displayed. The rectangle never appears, and the stimulus is visible for the entire duration of the trial (when I only want it to be visible for a few milliseconds). Am I doing something wrong here? 

<values>
/buttonRT = 205
</values>

<shape whiteRectangle>
/ shape = rectangle
/ color = white
/ size = (1000, 1000)
</shape>

<trial example>
/ ontrialbegin = [
  trial.example.resetstimulusframes():
  trial.example.insertstimulustime(shape.whiteRectangle, values.buttonRT);
]
/ stimulustimes = [0=target; 200=values.wordredcolorredup]
/ trialduration = 1800
</trial>

There's a typo in the code (which originated with my example).

/ ontrialbegin = [
trial.example.resetstimulusframes():
trial.example.insertstimulustime(shape.whiteRectangle, values.buttonRT);
]

needs to be

/ ontrialbegin = [
trial.example.resetstimulusframes();
trial.example.insertstimulustime(shape.whiteRectangle, values.buttonRT);
]

to work.

Another problem is the chosen timing: Your display would have to be running at 200Hz for a 5ms display onset difference between the stimulus and the rectangle to be possible. If your display is running at a lower rate, which is likely, then the stimulus and the rectangle will be drawn to the screen at the exact same time, i.e. you'll never see the target to begin with.

<values>
/buttonRT = 210
</values>

<shape whiteRectangle>
/ shape = rectangle
/ color = white
/ size = (100%, 100%)
</shape>

<trial example>
/ ontrialbegin = [
trial.example.resetstimulusframes();
trial.example.insertstimulustime(shape.whiteRectangle, values.buttonRT);
]
/ stimulustimes = [0=target; 200=red]
/ trialduration = 1800
</trial>

<text target>
/ items = ("Target")
</text>

<text red>
/ items = ("STIMULUS")
/ txcolor = red
</text>

<block my>
/ trials = [1-4 = example]
</block>


That did the trick ;) Thanks again, Dave!