I am not sure this is what you are after, but maybe it will help someone.
Here is a different approach method that I love and use frequently.
(Step 1-4 is done once on paper w/calculator, step 5 is done in webCoRE)
- Find/decide on the absolute highest result
- Find/decide on the absolute lowest result
- Highest - Lowest = Difference
- 100 / Difference = varMultiplier
- Take your output, subtract Lowest, and then multiply by varMultiplier
This method will force all your outputs to be in the range of 0-100.
If you want it to be in the range of 100-200, simply add 100 to the final results.
So here is an example from one of my pistons. It monitors the distance between the Moon and the Earth, and stores it in my variable called ‘distance’. I know from a bit of research, that the nearest the Moon will be to earth is 221,441 miles, and the farthest will be 252,724 miles. So my preliminary math is:
Highest - Lowest = Difference
252,724 - 221,441 = 31,283 miles difference
Then, I decided that I want all results to be displayed somewhere between 0 and 100, so my next math is:
100 / Difference = varMultiplier
100 / 31,283 = 0.00319662 <-- This last number will be used in webCoRE
Ok, so finally, we can work on the piston. Get your output like normally, and save to a variable. (In my example below, it’s called ‘distance’) Then, the code in webCoRE will be:
(yourOutput - Lowest) * varMultiplier
(226758 - 221441) * 0.00319662
That is basically it! This code works for anything you can think of. The key elements is getting the absolute maximum and minimum correct, and then deciding on what scale you want it displayed. (I like 0-100 personally) Also note, if you tweak or change the min/max numbers, you will have to do steps 3 & 4 again, and place the new varMultiplier into your webCoRE piston.
I have highlighted the code (yourOutput - Lowest) * varMultiplier in the picture below.
I went a step farther because I wanted to round my results to two decimals, and invert the answer, so that’s why there is the extra “round(100 - ( … ),2)” in the picture above…
And for those curious, here is an example of my outputs. It will ALWAYS be between 0 and 100.