@Stuart_Furnell I also assume you have read through this whole thread: "Take a break" works locally but not online
Your case is actually slightly more difficult because you are targeting specific trials that don’t have an obvious regular structure. That said, the logging I suggested there is also worth doing here, it will let you see the values you are working with and when the conditions are or are not being met.