I have been working on a patch which needs a counter that increments by the value input and splits the output, if count decreases it goes out one side, increases out the other. Fairly simple but I am having issues with restricting its range, mod works wonderfully, but 5 mod 24 is not the same as 5 mod 32, so count gets screwed up if you change the mod, which can and does happen in this patch. Select works but it greatly increases the number of things I need to update when changing the length, can over shoot, gets confused easily and requires more logic to deal with counting by anything but 1/-1 to insure it does reset which just means more objects I need to update when changing length, it becomes a complicated easy to screw up mess quickly. Just looking for some ideas, seem to be trapped in these two paths and can not see anything else, Here is my simple but flawed [mod] based counter to clarify my ramblings.

EDIT: forgot to say, trying to keep it vanilla.