Profile image

Fuel indicator lights [Funky trees]

3,761 stig27  5.0 years ago
522 downloads

Fuel indicator lights, the first one stays on until 75% capacity, the second until 50% capacity, the third until 25% capacity, and the red one will blink once it drops under 25%.
For use in cockpits, or whatever you snap it on.
To use:
You can either grab the fuselage behind the lights, or the individual lights, if you only want the critic capacity one, for example.
The code:
You'll want to edit the values at some point, so here's what I can explain:
Use overload and edit the input, and use without quotes:
'max(0 , Fuel - "percentage [56%=0.56]")'

As for the critical blinking one, use
'max(0 , "the decimal value" - Fuel)'

PS: thanks to SledDriver for this upgraded formulas

General Characteristics

  • Successors 2 airplane(s)
  • Created On Android
  • Wingspan 4.0ft (1.2m)
  • Length 3.7ft (1.1m)
  • Height 3.4ft (1.0m)
  • Empty Weight 595lbs (270kg)
  • Loaded Weight 595lbs (270kg)

Performance

  • Wing Loading 439,839.3lbs/ft2 (2,147,483.6kg/m2)
  • Wing Area 0.0ft2 (0.0m2)
  • Drag Points 385

Parts

  • Number of Parts 3
  • Control Surfaces 0
  • Performance Cost 27
  • Log in to leave a comment
  • Profile image
    197k SledDriver

    @stig27 Sure. If you want a light to come on when the fuel drops below 25%, use this for the input:

    max(0, 0.25 - Fuel)

    As long as the fuel remaining is over 0.25 (25%), 0.25 - Fuel will be a negative value, i.e., less than zero. So max(0, negative_value) will always be zero. As soon as the fuel drops below 0.25, 0.25 - Fuel will be a positive number, so max(0, positive_value) will return positive_value, turning the light on.

    Pinned 5.0 years ago
  • Profile image
    197k SledDriver

    There's a better way to do this. If you want ten lights indicating the fuel remaining from 100% to 10%, use these as the inputs:


    max(0, Fuel - 0.99)
    max(0, Fuel - 0.9)
    max(0, Fuel - 0.8)
    max(0, Fuel - 0.7)
    max(0, Fuel - 0.6)
    max(0, Fuel - 0.5)
    max(0, Fuel - 0.4)
    max(0, Fuel - 0.3)
    max(0, Fuel - 0.2)
    max(0, Fuel - 0.1)

    Pinned 5.0 years ago
  • Profile image
    14.0k silver

    Looking for this :)

    4.6 years ago
  • Profile image
    3,761 stig27

    @Rsouissi brightness isn't an editable property, so, you can't.

    4.9 years ago
  • Profile image
    2,903 FaLLin1

    How can I set a brightness range with funky trees

    4.9 years ago
  • Profile image

    @SledDriver PERFECT!

    5.0 years ago
  • Profile image
    197k SledDriver

    @Type2volkswagen

    OK, you should've just said "a light that stays on when fuel is above 0.01 and below 0.25". Anyway, here's how to achieve that.

    You want a light that comes on when two conditions are met:

    (Fuel > 0.01) AND (Fuel < 0.25)

    If the developers had included boolean operators in the update, it would've been easy. But they haven't, so it'll take some work.

    The Fuel > 0.01 condition can be represented as:

    max(0, Fuel - 0.01)

    The Fuel < 0.25 condition can be represented as:

    max(0, 0.25 - Fuel)

    Now we want to condense both these formulae into an output that's positive when both conditions are true. To make this easier, let's apply a ceil() function. This function takes any value and rounds it up to the nearest integer, i.e., if you give it 0.0123 or 0.999, it will round it up to 1. So we get:

    ceil(max(0, Fuel - 0.01))

    and

    ceil(max(0, 0.25 - Fuel))

    Both the above formulae will evaluate to 0 when the condition is not met, and 1 when the condition is met. How do we combine the output of these? Simple, we multiply them together.

    ceil(max(0, Fuel - 0.01)) * ceil(max(0, 0.25 - Fuel))

    This formula will evaluate to 1 if and only if both conditions are true and 0 in all other cases, which is what you want.

    +3 5.0 years ago
  • Profile image

    @SledDriver

    Here is a link to the Lights I'm asking about

    5.0 years ago
  • Profile image

    @SledDriver
    After the low fuel light (4th light) comes on @ 25% remaining, I'd like the Flashing light to go "off" when the tank is empty (-0.99 remaining), at which time the "empty" light (5th light) comes on @ -0.99 remaining.

    something like this for the 4th light:
    max(0, 0.25 - Fuel) ="(on)"
    and then
    max(0, 0.01 - Fuel) = "(off)"

    5.0 years ago
  • Profile image
    197k SledDriver

    @Type2volkswagen Let's see if I understand. You have a 'low fuel' light that starts flashing when the fuel drops below 25%. Then you have a steady light that comes on when the fuel drops below 99%. The low fuel light will already be off until the fuel drops below 25%, so what's the question again?

    5.0 years ago
  • Profile image

    @SledDriver Not trying to Hijack @stig27's Post BUT,,,,

    I'm using your formula for the lights.
    5 lights, counting down @ 25% intervals.
    0.25 Light Flashes using your negative value string "max(0, 0.25 - Fuel)"
    I then have a Light that comes on @ max(0, 0.99 - Fuel) steady.

    What code do I use to have the flashing light go "ON" @ max(0, 0.25 - Fuel) and "OFF" @ max(0, 0.99 - Fuel)?
    thx for your help.

    5.0 years ago
  • Profile image
    3,761 stig27

    @SledDriver thanks, I just need some time to get used to all of the functions

    5.0 years ago
  • Profile image
    3,761 stig27

    @SledDriver btw, there isn't a better formula for the critical fuel light, is it?

    5.0 years ago
  • Profile image
    3,761 stig27

    @SledDriver welp, thanks!
    That sure is better!

    5.0 years ago
  • Profile image
    3,761 stig27

    @AtlasAviation I thought you people would like this stuff in your custom cockpits, was a bit hard/boring to get to the formulas.

    5.0 years ago
  • Profile image

    A very useful contraption.

    5.0 years ago