Jump to content
Sign in to follow this  
Dartzman

Help with incomplete script

Recommended Posts

Gday everyone.... Am very new to Sims and scripts as stated in previous messages....

I am using Xplane 12 with Air Manager, Flywithlau and Arduino Uno Cards along with a couple of LB Cards

The Sim I am building is a Generic GA/C172SP simpit

I have managed to work out some simple scripts for all the switches etc with flywithlau thanks to the help from here.

however I cant get my head around a fuel issue script

I found the below on the net which is exaclty what I am after to show the Low Fuel LED tank1 and Low Fuel LED Tank2 on the cessna. but I know the script is incomplete..

Am also after "Vacuum L and R" as well

I have installed and tried datareftool which I am workign out.. and is great to find Datarefs but it doesnt help with coding

can someone please fill in the blanks... with that it would give me a template to work off for other scripts

sim/flightmodel/weight/m_fuel 1 0 20
sim/flightmodel/weight/m_fuel 2 0 20

 

Thanks in Advance

kevin

 

 

Share this post


Link to post
Share on other sites

sorry. maybe I should have been a bit clearer.   i am trying to get the fuel warning LEDS to work on my sim. the datarefs i have is just for low fuel.  i am trying to work out "LOW FUEL Left tank" and "LOW FUEL Right tank" LEDS. 

I was informed that, to get the LED Announciators to work on individual LEDS I would need to use the weight datarefs as shown in my previous message. each line referring to each LED. 

I hope that helps

Kevin

Share this post


Link to post
Share on other sites
On 1/23/2023 at 5:45 PM, Dartzman said:

Gday everyone.... Am very new to Sims and scripts as stated in previous messages....

I am using Xplane 12 with Air Manager, Flywithlau and Arduino Uno Cards along with a couple of LB Cards

The Sim I am building is a Generic GA/C172SP simpit

I have managed to work out some simple scripts for all the switches etc with flywithlau thanks to the help from here.

however I cant get my head around a fuel issue script

I found the below on the net which is exaclty what I am after to show the Low Fuel LED tank1 and Low Fuel LED Tank2 on the cessna. but I know the script is incomplete..

Am also after "Vacuum L and R" as well

I have installed and tried datareftool which I am workign out.. and is great to find Datarefs but it doesnt help with coding

can someone please fill in the blanks... with that it would give me a template to work off for other scripts

sim/flightmodel/weight/m_fuel 1 0 20
sim/flightmodel/weight/m_fuel 2 0 20

 

Thanks in Advance

kevin

 

 

Hi,

Can't you grab that data from X-Planes default 172 aircraft script? 


Former Beta Tester - (for a few companies) - As well as provide Regional Voice Set Recordings

       Four-Intel I9/10900K | One-AMD-7950X3D | Three-Asus TUF 4090s | One-3090 | One-1080TI | Five-64GB DDR5 RAM 6000mhz | Five-Cosair 1300 P/S | Five-Pro900 2TB NVME        One-Eugenius ECS2512 / 2.5 GHz Switch | Five-Ice Giant Elite CPU Coolers | Three-75" 4K UHDTVs | One-24" 1080P Monitor | One-19" 1080P Monitor | One-Boeing 737NG Flight Deck

Share this post


Link to post
Share on other sites

Are you looking for code? I think something like this is what you mean:

    function lowfuel()
        if get("sim/flightmodel/weight/m_fuel1")<=9.9 then -- Use your numbers, 9.9 is about 15% fuel for C172 (I think)
        -- turn on Tank1 LED
        else
        -- turn off Tank1 LED
        end
        if get("sim/flightmodel/weight/m_fuel2")<=9.9 then
        -- turn on Tank2 LED
        else
        -- turn off Tank2 LED
        end
    end
    do_often("lowfuel()")


I don't know how Arduino turns on the LEDs, sorry. Can you work it out from your working switch scripts?

Oh, and these DRs are from XP12. Not sure where those numbers "1 0 20" in your original post came from.

EDIT: The C172 fuel numbers are 0 to 79 so 15% would be 11.8.

Edited by dolph98
  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, Dartzman said:

sorry. maybe I should have been a bit clearer.   i am trying to get the fuel warning LEDS to work on my sim. the datarefs i have is just for low fuel.  i am trying to work out "LOW FUEL Left tank" and "LOW FUEL Right tank" LEDS. 

I was informed that, to get the LED Announciators to work on individual LEDS I would need to use the weight datarefs as shown in my previous message. each line referring to each LED. 

I hope that helps

THAT you want the LEDs to work off the datarefs is the part I managed to catch. The crucial missing part is WHEN those LEDs are supposed to be on.


7950X3D + 6900 XT + 64 GB + Linux | 4800H + RTX2060 + 32 GB + Linux
My add-ons from my FS9/FSX days

Share this post


Link to post
Share on other sites

Thanks for the replies everyone.. Bjoern, The LEDS are to come on when the fuel is low, reaches a certain level

Share this post


Link to post
Share on other sites
2 hours ago, Bjoern said:

The crucial missing part is WHEN those LEDs are supposed to be on.

I get you. Right. I noted 15% is 5 ga. on the gauge but is that where they are supposed to turn on? Is 10 ga. enough to get to a safe landing? 15% is a guess and seems reasonable. YMMV (literally)

Share this post


Link to post
Share on other sites

 

On 1/25/2023 at 11:44 PM, dolph98 said:

I get you. Right. I noted 15% is 5 ga. on the gauge but is that where they are supposed to turn on? Is 10 ga. enough to get to a safe landing? 15% is a guess and seems reasonable. YMMV (literally)

Well, Dartzman won't tell us what constitutes a "certain level", so it remains an utter unsolved mystery.

Your script is fine, by the way. I'd do it the same way.

  • Like 1

7950X3D + 6900 XT + 64 GB + Linux | 4800H + RTX2060 + 32 GB + Linux
My add-ons from my FS9/FSX days

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...