Set play count for subsequent clip elements to 0 if an error is detected

 

// Test for error here.
// This example assumes "errorDetected" is true if there was an error.
var errorDetected = true;

// Was there an error?
if (errorDetected)
{
  // There was an error.
  
  // Disable all following items in the current Clip.
  var nextItem = $context.currentItem.nextItem;
  while (nextItem != null)
  {
    nextItem.setRepeat(nextItem.REPEAT_TIMING_SERIAL, nextItem.REPEAT_TYPE_COUNT_CONSTANT, 0, nextItem.REPEAT_DISTRIBUTION_CONSTANT, 0);
    nextItem = nextItem.nextItem;
  }
}