I see a number of built-in Functions, but I would like to write my own sub-function for use within one of the existing Functions. Specifically, I want to write a sub-function that will calculate a value 0 to 100 based on engine speed between low and high limits. The math is the easy part, the exact syntax to define it is what I need help with.
What I'm getting at is staged, variable duty cycle shift light.

