avgcrate and maxcrate now call avgrange and maxrange lua scripts