Script error on my pavlovia experiment on tablet

This is the code in begin routine and the code in each frame is this one

mouseLoc = mouse1.getPos()
if t < .05:
     pass
elif mouseLoc[0] != mouseRec[0] or mouseLoc[1] != mouseRec[1]:
     mouseRec = mouseLoc
     if img1.contains(mouse1):
          response = 1
          continueRoutine = False
     elif img2.contains(mouse1):
          response = 2
          continueRoutine = False
     elif img3.contains(mouse1):
          response = 3
          continueRoutine = False
     elif img4.contains(mouse1):
          response = 4
          continueRoutine = False

Change your Begin Routine code to:

mouseRec = mouse1.getPos()
response = 0

This was the code I had at the beginning, which you gave me earlier in the forum, and it did the same thing.

If you keep your finger on the screen then you will probably end a trial every 50ms.

Increase this number to the minimum reasonable reaction time to give time for the finger to be lifted.

1 Like

it works thanks !

Hello,

I’m following up because I wanted to check if it would be possible to make the participant double-tap on the image to proceed to the next trial. I noticed that, even when taking a significant amount of time on certain tablets, two trials sometimes get skipped at once. It’s very strange in my data I have this

I would like to try this alternative to see if it helps reduce this issue.

Thanks in advance!

What I do is require a mouse click on a different location (e.g. a submit button) after each selection.

1 Like

So, I need to create a code in each frame that saves the last position of a moose and compare it with the current position?

Try this:

mouseLoc = mouse1.getPos()
if t < .05 or response > 0:
     pass
elif mouseLoc[0] != mouseRec[0] or mouseLoc[1] != mouseRec[1]:
     mouseRec = mouseLoc
     if img1.contains(mouse1):
          response = 1
     elif img2.contains(mouse1):
          response = 2
     elif img3.contains(mouse1):
          response = 3
     elif img4.contains(mouse1):
          response = 4

Then add a button component which ends the routine on a click with start condition response > 0