Second screen appearing only after a specific response in first screen

Hello,

I am doing a visual search task and I have created on the builder the first routine (where participants are presented with 8 items and have to say if a target is present amongst distractors giving a target-present response or say that a target is not present at all, giving a target-absent response) and the second routine (where the 8 items that were previously presented turn black and the participant has to click on the particular target they have previously spotted). However, as you can understand, if participants give a target absent response in the firsts routine then there is not point to present the second routine as there will be no particular target to identify.

So I want the second routine to appear only if participants give a target-present response. How can I do that?

Thank you

Put something like the following in the Begin Routine tab of a code component in your second routine.

if ‘a’ in response.keys:
     continueRoutine =False 

The ‘a’ button is the target-present response that participants will give and in that case the second routine will appear normally but the ‘l’ button is the target-absent response after which the second routine should not appear. So I have put the following:

if ‘l’ in trial_resp:

 continueRoutine = False 

but the experiment breaks when i press either the a or the l in the response of the first routine and it shows this error:

if ‘l’ in trial_resp:
TypeError: argument of type ‘Keyboard’ is not iterable

You missed .keys

It is working properly now thank you very much!