Millisecond Forums

Make a picture pop up upon pressing key buttons

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

By mingwu - 11/14/2016

Hi,
I'm trying to program an experiment where in every trial, as soon as the participant presses any valid key button, an image will pop up for 1 second and disappear. I'm good with the other parts of the experiment, I just don't know how to make the picture flash upon participants pressing the key. Any one has any ideas?
Greatly appreciated!


By Dave - 11/14/2016

mingwu - Monday, November 14, 2016
Hi,
I'm trying to program an experiment where in every trial, as soon as the participant presses any valid key button, an image will pop up for 1 second and disappear. I'm good with the other parts of the experiment, I just don't know how to make the picture flash upon participants pressing the key. Any one has any ideas?
Greatly appreciated!



You can either use the <trial>'s /responsemessage attribute or /branch to a separate <trial> that displays the image for the desired amount of time. The latter approach is the one you'll want to use in case you need to log information about the image presented.

<trial mytrial>
/ validresponse = ("d", "k")
/ branch = [if (trial.mytrial.response == 32) trial.d_pic]
/ branch = [if (trial.mytrial.response == 37) trial.k_pic]
</trial>

<trial d_pic>
/ stimulusframes = [1=d]
/ validresponse = (0)
/ trialduration = 1000
</trial>

<trial k_pic>
/ stimulusframes = [1=k]
/ validresponse = (0)
/ trialduration = 1000
</trial>

<picture d>
/ items = ("d1.jpg", "d2.jpg")
</picture>

<picture k>
/ items = ("k1.jpg", "k2.jpg")
</picture>