Accessing current loop index

Hello. I am building an auditory 3-alternative forced choice test. I want to repeat each trial. After the first iteration of the trial, I have a routine that says “You will now hear the trial again.” This is all incased within a loop. However, at the end of the second repeat when a new trial is supposed to occur, my routine indicating that “you will hear the trail again” will still appear.

I think that the easiest solution is to access the loop that denotes repeats (in this case there are two repeats and I have set nReps = 2 for this. I would like to have the following code somewhere at the end of my stimulus routine before it moves on to me repeat message:

if currentLoop = 2:
    repeat_loop = 0

Essentially, if the trial has begun its second repeat, then it turns of the repeat message and will then move on to the next trial.

I would like to clarify that I have tried something like this and it has not worked. The code I provided in my initial post was to further describe the problem and goal I am trying to accomplish.

if currentLoop = 2:
    repeat_loop = 0

There are three issues to consider with this code.

  1. If you have a loop with no spreadsheet and nReps = 2 then it will run twice. Those iterations will be numbered 0 and 1.
  2. You can access the iteration number using loopName.thisN (replace loopName with the name of your loop, e.g. trials)
  3. Use == when testing equality

The code therefore becomes

if loopName.thisN == 1:
    repeat_loop = 0