How to present all the squares at the same time using the custom code?

Hi,

I have changed the codes to endExpNow = True as suggested. It works well! :slight_smile: The routine ends following ONE incorrect response.

Then, I managed to make the routine to end after TWO incorrect responses by adding new variable into the Begin Experiment tab.

Begin Experiment

total_wrong=0

Each Frame

if respMouse.isPressedIn(currentTile) and currentTile.fillColor == "white":
        currentTile.fillColor = "black"
        # Compare clicked tile
        if currentTile.fillColor != patternTile.fillColor:
            total_wrong=total_wrong+1
            continueRoutine = False

End Routine

if total_wrong >=2:
    endExpNow = True
else:
    total_wrong<2
    endExpNow = False

In the visual patterns test, there are 3 patterns for each pre-determined grid/matrix. Starting with a grid size of 4 (2 × 2), participants complete three trials at each grid size, with the grid size increasing as long as they get at least two out of the three trials correct. There are 14 grid size in total.

So, I created 14 blocks of trials with 14 xlsx. file as shown in Blocks of trials and counterbalancing — PsychoPy v2023.2.3

I tried to move the total_wrong=0 to Begin Routine hoping that it would have recorded the number of wrongs in each grid/matrix. But it didn’t work.

So, my question is how do I:

  1. record the number of wrong responses for each grid/matrix set
  2. depending on the number of wrong responses in each grid/matrix set, continueRoutine =False or endExpNow=True

Additionally, when I tried to upload the task to Pavlovia, the following error popped up.
ReferenceError: createGrid is not defined VPTblocks.psyexp (47.5 KB)

cond.xlsx (8.3 KB)
blockEight.xlsx (8.5 KB)
blockSeven.xlsx (8.5 KB)
chooseBlocks.xlsx (8.5 KB)