Inability to play routine after 4 trials of previous one

hello all,
OS : Mac
PsychoPy version (e.g. 1.84.x): 23.2.3
What are you trying to achieve?:
I’m designing a PsychoPy experiment where participants are presented with a series of trials involving sounds and images. After every fourth trial, instead of proceeding to the next sound-image trial immediately, i want to present them with a video (from a set of five videos) that plays before moving on to the next trial.
I have 20 trials (20 images and sounds ), and I have 5 videos.
What did you try to make it work?:
-I tried to made a loop of both routine(sound image) and routine of videos , with excel file of 20images and sounds , then made a smaller loop with video routine alone , yet once it reaches the first movie it keeps repeating the movies ,

  • another attempt was to add trial counter , and I read somewhere that I should initialise the videos before starting trials like loading them in a different routine which I did , then trial counter , then add some thing called conditional logic in begin routine tab of reward routine to check if it’s time to show a reward , yet this one didn’t work and kef giving me wrong syntax error , like this:
    ==========
    if trialCount % 4 == 0 and trialCount > 0:
    awardIndex = ((trialCount // 4) - 1) % len(awardsList)
    awardFilePath = awardsList[awardIndex]
    M_Keys.setMovie(awardFilePath)
    else:
    continueRoutine = False
    )
    ======
    the name of movie is M_keys with 5 videos each one called like Key1.mp4, Key2.mp4,etc…
    so here im stuck and I don’t know what can I do other than this way ,
    another method I read about was using code at begin routine to skip :if trials.thisN % 4 < 3:
    continueRoutine = False
    but I didn’t fully understand how to do it ,
    I appreciate any help with this matter,
    thank you in advance !!