psychopy.org | Reference | Downloads | Github

Don't take key press until slider response is made!

URL of experiment: https://pavlovia.org/Aparna11/wordsound

Description of the problem:
Hi,
In my experiment I have slider response followed by key press (space) to go to next trial. I have observed that sometimes participants are pressing space without responding on the slider. I loose data in such situations. I want to hold the trial until slider response is given then only the “space” press should work to go to next trial.

Can anyone help in this?

Thank you
Aparna

Instead of having your keyboard component force the end of the routine, you need some code in Each Frame

e.g.

if slider.getRating() != None:
      if 'space' in key_resp.keys:
          continueRoutine=False

When this auto translates, you’ll need to switch the component to Both and then change null (the auto translation of None) to undefined

or make a start condition for the keyboard: “slider.rating”

Will that work online?

Yes :slight_smile:

1 Like

i used this code on each frame. its giving error message screenshot attached

This works but I have one more key response ‘r’ for repeat. I will have to use code only

Thank you

This works but I have one more key response ‘r’ for repeat. I will have to use code only. but code is giving error message as described before

Thank you

Try

if slider.getRating() != None and len(key_resp.keys):
      if 'space' in key_resp.keys:
          continueRoutine=False
     elif 'r' in key_resp.keys:
          do other stuff

Assuming that r can also only be pressed after the slider rating is set