PDA

View Full Version : Help with Dependent Variables

GossamerSolid
Feb 5 2011, 20:42
I have a slider control that has values ranging from 1 to 60. The slider starts on the highest value, 60.

As the slider goes downwards towards 1, I need my second value (which is cost for this example) to increase.

I remember learning about Dependent Variables back in high school, but I cannot figure this out.

I tried to avoid this problem alltogether by just making my slider control's minimum value to 60 and then maximum value to 10, but it just breaks the slider control.

Any help would be appreciated.

Muzzleflash
Feb 5 2011, 20:53
Let's say you have your slider which gives the value 'a' from 0 to 60. You want a 'b' which is 0 to 100 inverse proportional to a:

b = (60-a)*(100/60);

Edit: May be of interest: http://en.wikipedia.org/wiki/Inverse_proportion#Inverse_proportionality

Xeno426
Feb 5 2011, 21:18
_costDelay = _payloadDelayCost * (-1 * ((floor (SliderPosition 12909)) - (_artyDelayMIN + _artyDelayMAX)));

GossamerSolid
Feb 5 2011, 22:37
This thread can be closed now, xeno solved it.