Getting questions to show up at given, but varying, intervals

Hi!
I’m trying to create an EEG experiment using PsychoPy (v.2021.2.3).
For my setup, participants will see sentences presented word by word, which has been relatively easy to create. However, after some of the sentences I would like a question related to the preceding sentence to appear. This should be on average after every third sentence, but I would like the interval to vary, e.g.
sentence+question
sentence+question
sentence
sentence
sentence
sentence+question
sentence
sentence+question

…etc.
The questions should ideally be presented as a full sentence on the screen (i.e. not word by word).

I guess I will need to use a bit of code to achieve this, could anybody help me out with how? I’d really appreciate it. I’m attaching a screenshot of what my experiment currently looks like without the questions (W1-w_4 are the words in each sentence).

Hello Sarah

you need a little bit code and a column in your Excel-file to determine when to present a question and when not, at least in the solution I attach to this post.

Satz.psyexp (14.4 KB)
loopTemplate.xlsx (17.8 KB)

To present a sentence, simply type the whole sentence in a column.

My approach does not yet address the randomly interspersed questions. One problem after another. :wink:

Best wishes Jens

1 Like

Wonderful! This works perfectly, and is really all I need - the occurrence of questions will be manually pseudorandomized anyway.

Thank you so much for your quick help, I’m glad it turned out to be quite simple in the end.

Best,
Sarah