psychopy.org | Reference | Downloads | Github

Probabilistic Presentation of Routine

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): v2020.1.3
Standard Standalone? (y/n) If not then what?: Y
What are you trying to achieve?:

I’m fairly new to PsychoPy and trying to build an experiment which involves presenting stimuli sentences word-by-word followed by a possible comprehension question. There should be a 1 in 5 chance of this question appearing - it only serves to keep participants’ attention to reading the sentences. My practice sequence is as below (the actual experimental blocks will look more or less the same)

What did you try to make it work?:
I tried following the suggestions in this topic, but to no avail. I then modified the code slightly, resulting in the following script:

I also tried splitting the code in two after the addData argument and appending the first part to the ‘end routine’ window of the preceding routine. However, some of my sentences are less than 9 words long and I have separate code built into the sequence preventing words from firing if they are not long enough, so this did not work.

What specifically went wrong when you tried that?:
The comprehension questions are now appearing 100% of the time, no matter what probability I enter into the code and no matter where I place it. Would really appreciate some help in this, thank you!

You could use compVal instead of option for the second if statement, or even ditch option entirely and put two variations of addData and one copy of continueRoutine in the first if else statements.

Also, you need continueRoutine = False in the else / == ‘nonComp’ not != ‘nonComp’

Best wishes,

Wakefield

Thanks very much for your reply! It appears the incorrect syntax in the continueRoutine statement was the issue here. Thanks for pointing that out!