Lets say I have a player that has some score like custom at 5, or deaths of supply depot at 10.
How would I make a trigger that says
conditions - always
actions - create ( # custom) marines at location xxxx
Or if I was doing income it would be set resources to add (# of deaths of supply depot) ore to player xxxx
None.
Conditions:
score is x
Actions
Subtract x score
add x deaths
create x marines
Repeat (x = some binary number, like 64, 32, 16, 8, 4, 2, 1, in that order. This will make 127 marines max)
Next, do it again, but this time, return the score.
conditions:
deaths is x
Actions
Subtract x deaths
add x custom
These are called
binary countoffs
"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch
Starcraft doesn't support variable values in actions or conditions. So there's a few ways to approach this, I'll give you the most efficient:
Binary countoffs. You can read more about them in the wiki.
Basically you have a set of triggers that work with binary numbers, starting with the binary number that is just smaller than your max. custom score. For example when max. custom score is 50 you start with 32, then 16, 8, 4, 2, 1.
That way you can convert every possible score into units/resources in one trigger loop. The trigger(s) would look like this:
<Human Players>
C: Current Player has at least 32 custom score
A: Subtract 32 custom score
A: Create 32 marines / res
Then triggers with 16, 8, 4, 2, 1 too. That's 6 easy triggers you can mostly copy and paste. Order is important here.
If your max custom score is below 10 then it's probably acceptable to make only the last trigger with the 1. It'll take at most 9 trigger loops which isn't much with hyper triggers.
EDIT: Oh, rockz beat me to it.
And yes, after reading his reply I think he's right, you want the score to stay the same, so you have to do a 2nd countoff to return the score.
Yea I actually just got it working using 2 items like you guys have. I guess yea that sucks theres no better way to do this
None.