psychopy.org | Reference | Downloads | Github

Ratings on slider and clicking on a box to continue

URL of experiment: https://run.pavlovia.org/omidghasemi21/brighvalexp4/html/?__pilotToken=c4ca4238a0b923820dcc509a6f75849b&__oauthToken=1107c244a2dd1e37075b90faa65353b668a18dbdd815ff6ce031ef6816d9bc85

Hi,

My experiment presents some statement and after 5 seconds in each trial, a slider, a mouse and a box appear. I want to make sure that participants rate their response on the slider and then click on the box to continue to the next trial. So, I used this code in the each frame tab and it worked fine:

// continue if both slider and mouse is clicked

if (mouse_save_prac.getPressed()[0] === 1) { 
  clickable = [save_box_prac];
  for (const obj of clickable) { 
    if (obj.contains(mouse_save_prac)) {
      if (obj === save_box_prac && practice_bright_slider.getRating()) {
         continueRoutine = false;
      } else {
        continueRoutine = true;
       }
    }
  }
}

However, the problem is that if participants click on the screen before the mouse onset, they will got this error: TypeError: Cannot read property ‘map’ of undefined.

Are there any ways to solve this problem?

Thanks.

Did you ever manage to solve this error?

I’m getting the same thing with Ebbinghaus darts

Before I had a mixture of builder and code visual components but I’ve now replaced all of the builder visuals with code, because only the builder components were being displayed. I had to add a keyboard component so that the routine got processed at all.

The experiment is designed for a touchscreen, and therefore looks at the mouse location rather than clicks. However, I’ve added a gap before it starts to ensure that the screen is not being actively touched when the trial routine starts.

Edit: On my phone I’m getting TypeError: undefined is not an object (evaluating ‘color.rgb.map’) which suggests that it’s not related to the mouse at all.

Hi @wakecarter,

If you mean the issue with forcing participants to respond on a scale then click on an object, you can find the solution here: