Not so far, but I kept A as it is, as a death counter.
It is essential that A is NOT split up. Whether you use a virtual counter or a unit counter is up to you, but for a value of A up to 999 a unit counter would be consuming too many units. Also, this counter has to be comparable to other values, with conditions such as "most resources", "highest score", "command the most at".
(another reason why I can't split up A is that I will subtract several values from it later, and this is more complicated - in SC - with split up values than with normal counters)
Ok, so A is a comparable counter.
Next: B. In my map, B is split up. But it is not really necessary; I my case it would result in the same amount of triggers if it wasn't, and it would not need 10 switches but only one death counter (backup value). But since I already used it in multiplication (where it does make sense), I kept it.
Explanation: A is stored in P1's Kills Score. The values A is comparable to are P2's to P8's Kills score. What I do is put B * 512 into P2's kills score, B * 256 into P3's kills score and so on. Since I have 7 empty slots, I can do 512, 256, 128, 64, 32, 16, 8. All of these are calculated in a single set of triggers. In my case this would be by checking if switch 10 is set, adding 512 * 1 to P2's kills score, 256 * 1 to P3's kills score and so on, repeating this for 512 * 2 (to P2's score), 256 * 2 for swicth 11, then 512 * 4 and so on. If you chose not to split up B, you can use a simple copy-value binary countoff, so setting P2's to P8's kills scores and creating a backup of B in a different counter.
So now we set up all these multiples of B. I'll explain the maths behind it:
If A is larger than 512 * B, B fits at least 512 times into A. If B * 512 is larger than A, B fits at most 511 times into A.
If A is the larger value, I add 512 to the result, C, and subtract 512 * B from A. Note that A must now be smaller than 512 * B, or else it wouldn't work, so the input value for A has a maximum - which is quite large anyways.
If B * 512 is larger, I just dump this value and leave A untouched.
So now lets put this into triggers: P1's kills score is A, P2's to P8's kills scores are multiples of B.
When I check for the highest score now, I will either get A or P2's kills score (512 * B in this case), because 512 * B obviously is larger than 256 * B (on a sidenote: try division by 0 in my calc
). Since "highest score" is a CurrentPlayer trigger, it has to be run by P1. So if P1 has the highest score (A), B * 512 (P2's kills score) is subtracted with a simple binary countoff, and 512 added to C. If A is not the highest value, P2's kills score is reset to 0.
Same procedure is repeated, but now it can only be A or B * 256, since I reset B * 512 to 0.
This is repeated until I hit P8's kills score.
Now I have to set up a new kills score table. If I used the split up B earlier, I can repeat the same procedure for 4, 2, 1, 0.5 (explanation follows later). If I used another death counter as backup, I can just calculate the values from this one using a binary countoff.
Now I repeat the highest score thing for 4, 2, 1. We now know how many times B fits into A, and A is smaller than B now.
The 0.5 thing is only needed when you want to round your values. Setting up the 0.5 value has a little detail you should notice: B could be an odd value, but a score cannot be 14.5 or something like that. This has to be rounded up. So we have a binary countoff like this:
(k represents B, for example k could be the backup value; m is a kills score)
C: k > 511;
A: k - 512; m + 256;
C: k > 255;
A: k - 256; m + 128;
...
C: k > 1;
A: k - 2; m + 1;
C: k > 0;
A: k - 1;
m + 1;
When I now check A against m, and A s larger or equal to m (fulfills the highest score condition), C is rounded up - C + 1.
I don't even check th opposite case because after this the division is completed, and unless someone gave me invalid input, nothing was able to go wrong
I hope this helps