BoXon Posted August 18, 2008 Report Posted August 18, 2008 Hey! Just a litle request, if anybody has a script to read the current remaining fuel of an aircraft in Visual Basic i would be very grateful if you shared it with me. Well, please share if you have a VB6 script that can read the fuel weight of an aircraft! Best Regards Patrik
Toppa80 Posted August 18, 2008 Report Posted August 18, 2008 Hi BoXon, this is my version. Might be a littlebit complicated, but it works... ' Left Tanks Quantity Dim FQ_gal_LM As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HB80) Dim FQ_per_LM As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HB7C) Dim FQ_gal_LA As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HB88) Dim FQ_per_LA As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HB84) Dim FQ_gal_LT As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HB90) Dim FQ_per_LT As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HB8C) ' Center Tanks Quantity Dim FQ_gal_C1 As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HB78) Dim FQ_per_C1 As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HB74) Dim FQ_gal_C2 As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H1248) Dim FQ_per_C2 As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H1244) Dim FQ_gal_C3 As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H1250) Dim FQ_per_C3 As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H124C) ' Right Tanks Quantity Dim FQ_gal_RM As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HB98) Dim FQ_per_RM As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HB94) Dim FQ_gal_RA As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HBA0) Dim FQ_per_RA As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HB9C) Dim FQ_gal_RT As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HBA8) Dim FQ_per_RT As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HBA4) ' Weights Dim weight_lbs_per_gal As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HAF4) then calculate all together... ' Fuel Density Dim weight_kg_per_ltr As Double = weight_lbs_per_gal.Value / 256 / 2.20462262 / 3.78541178 ' Fuel Quantity Left TANKS in Liter Dim FQ_Left_ltr As Double = ((FQ_gal_LM.Value * (FQ_per_LM.Value / 128 / 65536)) + (FQ_gal_LA.Value * (FQ_per_LA.Value / 128 / 65536)) + (FQ_gal_LT.Value * (FQ_per_LT.Value / 128 / 65536))) * 3.785411784 * weight_kg_per_ltr Me.txtFQ_Left_ltr.Text = FQ_Left_ltr.ToString("f2") ' Fuel Quantity CENTER TANKS in Liter Dim FQ_Center_ltr As Double = ((FQ_gal_C1.Value * (FQ_per_C1.Value / 128 / 65536)) + (FQ_gal_C2.Value * (FQ_per_C2.Value / 128 / 65536)) + (FQ_gal_C3.Value * (FQ_per_C3.Value / 128 / 65536))) * 3.785411784 * weight_kg_per_ltr Me.txtFQ_Center_ltr.Text = FQ_Center_ltr.ToString("f2") ' Fuel Quantity Left TANKS in Liter Dim FQ_Right_ltr As Double = ((FQ_gal_RM.Value * (FQ_per_RM.Value / 128 / 65536)) + (FQ_gal_RA.Value * (FQ_per_RA.Value / 128 / 65536)) + (FQ_gal_RT.Value * (FQ_per_RT.Value / 128 / 65536))) * 3.785411784 * weight_kg_per_ltr Me.txtFQ_Right_ltr.Text = FQ_Right_ltr.ToString("f2") ' Fuel TOTAL Quantity in Liter Dim fuelQuantity As Double = FQ_Left_ltr + FQ_Center_ltr + FQ_Right_ltr Me.txtFuelQuantity.Text = fuelQuantity.ToString("f2") I hope you can handle with my data. Greetings, Tobias
BoXon Posted August 18, 2008 Author Report Posted August 18, 2008 Thank you very much! I will test it right away! :D
BoXon Posted August 18, 2008 Author Report Posted August 18, 2008 Doesnt seem to work for me. :( The code turns red in VB6 and when trying to run it VB6 returns: Compile Error: Expected: end of statement
Pete Dowson Posted August 18, 2008 Report Posted August 18, 2008 if anybody has a script to read the current remaining fuel of an aircraft in Visual Basic i would be very grateful if you shared it with me. If you only need this for FSX and beyond, there's are new offsets giving Total Fuel in Gallons and Total Fuel Weight in Pounds, now (offsets 1264 and 126C. I'm afraid I can't help with VB though. Regards Pete
BoXon Posted August 19, 2008 Author Report Posted August 19, 2008 Thanks Pete! Will try them later this day, where can i find more information about these offsets? Can't find them in the "FSUIPC for programmers.pdf".
Pete Dowson Posted August 19, 2008 Report Posted August 19, 2008 Will try them later this day, where can i find more information about these offsets? Can't find them in the "FSUIPC for programmers.pdf". As it actually says in the third line of that reference document, the correct document to use for FSUIPC4 is called "FSUIPC4 Offsets Status.pdf", which has been included in the SDK for some time now, but originally was only supplied in the FSUIPC SDK addendum in the FSX Downloads announcement above. Maybe you are still using an old copy of the SDK? Pete
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now