Resetting mouse position on Pavlovia

URL of experiment: https://run.pavlovia.org/MRLab/temp_ef_math_tol

Description of the problem: I am using isPressedIn() to finish a routine. However, as clicks are dragged from previous routines, multiples routines are finished without being displayed. For example routine 1 finishes when I click on an object; however, as routine 2 also should finished when pressing the same object, it skips and goes directly into routine 3.

On Pyschopy, I fixed by using setPos at the beginning of each routine. However, as far as I know, it is not possible to use this function on Javascrtip.

I would appreciate any help

Roberto A.

What I do is add a minimum response time and (for mobile devices where I’m using contains I also check that the mouse has moved). However, to avoid needing to deal with the mouse in code you could either add a gap between trials to all time for the mouse button to be released, make sure two consecutive trials don’t finish from a click in the same position or require a click on a fixation cross to continue.

You can’t control the mouse position online, but you can fake it by hiding the mouse cursor and using a mouse cursor image at a fixed offset. However, you would also need an invisible object at the opposite offset for the true mouse to click. I doubt this method is worth the effort for you.

@wakecarter Thank you so much for all your help. I am trying to build a Tower of London task in Pavlovia for older children. There is already one in Pavlovia, but it is built in another library different from Psychopy. The task requires moving objects and advancing the task based on the participants’ clicks, which has proven to be quite tricky. I was worried that putting intermediate steps, clicking on unnecessary positions might affect the ‘flow’ of the tasks; however, it seems like there is no other way around.

Thank you again,
Roberto A.

Wouldn’t drag and drop be more intuitive? I just had a go and couldn’t work out what to click to move the ball back to a peg and ended up losing it when I clicked a second ball.

I have some tips on drag and drop code here:

If the participant drops a ball then you could just put it on the closest peg.

Hi @wakecarter, I ended up following your first suggestion, asking participants to click between intermediate steps. The interaction with the task is not as confusing as I thought it would be, and now I can move the two out of the three balls.