November 21, 2024, 10:42:19 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Inverting a range?

Started by steveo, March 10, 2008, 12:01:35 PM

Previous topic - Next topic

steveo

Jon,
If I have a variable that outputs a range, say 60 descending to 1. But I need to use that value inverse, so the 60 to 1 range is equal to 195 to 255.

The value comes from the ping sensor, so this is being generated in real time.

Is there an operation that will do this? If not, how would you do it?

JonnyMac

The answer is deceptively simple:
 
  newVal = 256 - oldVal
Jon McPhalen
EFX-TEK Hollywood Office

steveo

My brain just feels very embarrassed right now. And it should be.