Likely want to just skip down 10 or so posts if you stumble upon this thread, I had issues and nothing made sense. I have fewer issues now and I think things should become productive.

Normally this is pretty simple, but I need XYZ to wrap, so a 3x3x3 array counting in X would go 0,1,2,0,1... and in the Y it would go o 3, 6, 0, 3... and Z would be 0, 9, 18, 0, 9... Here is the simplified version of what I am currently doing to illustrate more clearly, Z is of variable size.

This works, but it means I have to do a great deal of conversion between XYZ and array index which complicates the rest of the patch. Working off array index and having a single counter incremented by the needed amount would greatly simplify the patch overall. I think I had this figured out awhile ago but I either did not save it or saved over it and now things are so messed up in my head I am not even certain this is a reasonable task. I will consider externals for this one, but I still want to know how to do it in vanilla if it is sane to do so.

Edit: That [mod 100] should be [mod 10], typo when I simplified the patch.

Edit: Not that it matters, those are not even my actual sizes, I just can not think straight on this any longer.

Edit: [v x] [v y] and [v z] would just be 1 or 0 if that was not apparent, think I should be done with edits now