Just thought I'd ask for some help on nutting out a formula for this problem:
You have a counter that starts at one, and always adds one to itself until it gets to 144.
Then you have another counter that always adds one to itself, but when it reaches 12 it sets itself back to 1, so it goes like this: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.... Until the other counter reaches 144.
What I want to know is this: A formula that converts the number from the first counter, into the number from the second counter.. example: The first counter is at 43, so set the second counter to 7.
The thing is, 144 can be replaced by anything and 12 can also be replaced by anything. The only rule is that the "144" must be a multiple of the "12". So it could be "100" and "5", where the first counter is at 57, so set the second counter to 2.
If you can understand what I mean, any help would be appreciated
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
I don't know how noobish this sounds but I'm not quite familiar with the term "mod" I think after a bit of thinking I've fixed my problem, however.
X-(Y*(Floor(X/Y))
//Where X is counter 1, and Y is counter 2.
Will always give me the correct value, whatever numbers I substitute into the equation
So, using the numbers from my first post:
43-(12*(Floor(43/12)) ...Will give me 7.
I'm just converting a position in a dynamic array to a column in an easy grid
This always happens, I get so frustrated with a problem so I post for help on TDC, then I go back to it and an answer is staring me right in the face. It might be something to do with thinking about my problem as I type it out.
Uh, just use mod. It's literally mod in MMF.
X mod Y. That's it.
43 mod 12 = 7
99 mod 12 = 3
144 mod 12 = 0
54 mod 12 = 6
Don't use complex formulas, they'll come back and screw you in the future. Not knowing mod is fine (though they should teach it in school, after division). Using a complex formula when there's an easy one is noobish. It's like the noob who adds a lens flare in Photoshop because he thinks it makes him elite
I get what you mean about posting problems, though. I end up arguing about people about formulas and stuff, and that makes me realize the obvious
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
That's funny, because that's exactly what the mod operator does. It returns the remainder after a division.
I agree with Muz, don't go making things harder for yourself, just use the mod function