Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello,

I would like to write a Lua script that makes announcements according to the airline, as Fenixsim does with the Fenix A320.

Would it be possible to have an offset which gives the three letters of the airline as indicated in Aircraft.cfg (icao_airline =AFR for "Air France", for example). ?

The "atc_airline" (which already have an offset) is too long for everybody.

Thanks in advance.

 

 

Posted
13 hours ago, michel78320 said:

Would it be possible to have an offset which gives the three letters of the airline as indicated in Aircraft.cfg (icao_airline =AFR for "Air France", for example). ?

Do you know of an aircraft (preferably an Asobo/default one) that has this identifier? I have checked several and cannot see this.

Looks like the ICAO airline is always 3 characters. I can add as a 4-character string (3 chars + 0 terminated, at offset 0x062C s this offset is no longer used in FSUIPC7.

Posted

Wonderful !

It seems that this code always has 3 letters.
Here is the list :
https://en.wikipedia.org/wiki/List_of_airline_codes

Indeed Asobo never informs this code !
To test, you can just add a new line in the Flightsim section of Aircraft.cfg :


[FLTSIM.0]
. . . . . .
icao_airline = "TPC"
. . . . . .    

(Example for TAP Air Portugal)

Livreries for Fenixsim A320 are usually properly entered.

Posted
2 hours ago, michel78320 said:

It seems that this code always has 3 letters.
Here is the list :
https://en.wikipedia.org/wiki/List_of_airline_codes

Yes, I saw that.

2 hours ago, michel78320 said:

To test, you can just add a new line in the Flightsim section of Aircraft.cfg :


[FLTSIM.0]
. . . . . .
icao_airline = "TPC"
. . . . . .    

(Example for TAP Air Portugal)

Livreries for Fenixsim A320 are usually properly entered.

So you want this read from the [FLTSIM.0] section? Other ICAO strings are read from the [General] section - e.g., for the C208:

[GENERAL]
atc_type = "TT:ATCCOM.ATC_NAME CESSNA.0.text"
atc_model = "TT:ATCCOM.AC_MODEL C208.0.text"
Category = "airplane"
pilot = "Pilot_Female_Casual"
copilot = "Pilot_Male_Casual"
instructor = "Pilot_Male_Casual"
performance = "Maximum Speed\n175 kts            324 km\/hr\n\nCruise Speed\n164 kts \t        305 km\/hr at 20,000 ft\n\nEngine\nPratt & Whitney Canada, Inc., PT6A-114A Free Turbine Flat Rated at 675 Shaft hp  \n\nPropeller\nThree-Bladed, Constant Speed, Full Feathering, Reversible  McCauley, 106-inch diameter\n\nMaximum Endurance\n5.1 hours maximum cruise at 10,000 ft\n6.6 hours maximum cruise at 18,000 ft\n6.4 hours maximum range at 10,000 ft\n7.2 hours maximum range at 18,000 ft\n\nService Ceiling\n22,800 ft            6,949 m\n\nFuel Capacity\n335  gal              1,268 L\n\nEmpty Weight\n4,575 lb              2,075 kg\n\nMaximum Gross Weight\n8,785 lb\t            3,985 kg\n\nUseful Load\n4,000 lb\t            1,814 kg\n\nLength\n41 ft, 7 in             12.7 m\n\nWingspan\n52 ft, 1 in\t            15.8 m\n\nHeight\n15 ft, 5-1\/2 in      4.8 m\n\nSeating\nUp to 14"
icao_type_designator = "C208"
icao_manufacturer = "CESSNA"
icao_model = "208 Grand Caravan"
icao_engine_type = "Turboprop/Turboshaft"
icao_engine_count = 1
icao_WTC = "L"

Please try the attached version where this is read from the [FLTSIM.0] section and added to offset 0x062C. Note that this will not be available if the location of the aircraft.cfg file is not available in offset 0x3C00 (possibly due to the aircraft being encrypted).

I can switch to reading from the [General] section if needed, or possibly try both.

Cheers,

John

FSUIPC7.exe

Posted

What would be good is to read the current aircraft, even if it is  [FLTSIM.x]

At 0x3C00, I can read the full pathname of the current aircraft.
At 0x3D00, I can read the full "Title" of the current aircraft (livery)

Currently, your latest version is working fine, and I read "AF0" which is the icao_airline of [FLTSIM.0].

But I read the same value if I load the livery [FLTSIM.1] with icao_airline= "AF1"

 

Posted
2 minutes ago, michel78320 said:

What would be good is to read the current aircraft, even if it is  [FLTSIM.x]

But how do I know what x is? Do you expect me to read the title in each FLTSIM section, and then read the icao_airline  from the section that has a matching title? I could possibly do this, but I need to check if the TITLE simvar has been received by the time I read the aircraft.cfg fille - it may not yet be available.

6 minutes ago, michel78320 said:

But I read the same value if I load the livery [FLTSIM.1]

Of course, as it is currently only read from [FLTSIM.0].

Also, it seems that some strings are enclosed in double-quotes, others not. Will the icao_airline string always be enclosed in double-quotes, or can it also be without these?

John

Posted
2 minutes ago, John Dowson said:

But how do I know what x is? Do you expect me to read the title in each FLTSIM section, and then read the icao_airline  from the section that has a matching title? I could possibly do this, but I need to check if the TITLE simvar has been received by the time I read the aircraft.cfg fille - it may not yet be available.

Yes. It would good in the same way that the title is found for the current livery.

The icao_airline is only three lettrers without double-quotes : AF0 or AF1 or BEL ...
What I found in your new offset is correct (for [FLTSIM.0], of course).

Posted
2 minutes ago, michel78320 said:

Yes. It would good in the same way that the title is found for the current livery.

FSUIPC gets the title from the TITLE simvar. This may originate from the aircraft.cfg file, but it is not read from there by FSUIPC for exactly the same reason - it would not know which FLTSIM.x section to load it from. So I would need to check the title in the FLTSIM.x sections until I found one that matches the TITLE as received from the simvar, which is why I can only do this if this simvar is available BEFORE I read the aircraft.cfg file. All other data read from the aircraft.cfg file is read from the GENERAL section.

6 minutes ago, michel78320 said:

If this is too complicated, it is not essential : Most of planes have only one livery in their Aircraft.cfg.

It isn't that complicated, but I do need to check the order of things to see if this is possible. If the title isn't available in offset 0x3D00 by the time I read the aircraft.cfg file, then I will not be able to read the FLTSIM sections and will not add the icao_airline string (even if there is only one FLTSIM.0 section).

I will check this and get back to you, but most probably tomorrow now.

John

Posted
38 minutes ago, John Dowson said:

If the title isn't available in offset 0x3D00 by the time I read the aircraft.cfg file, then I will not be able to read the FLTSIM sections and will not add the icao_airline string (even if there is only one FLTSIM.0 section).

Unfortunately the title isn't yet available when I am reading the aircraft.cfg file, so this is not that straight-forward.  I will see if I can read the aircraft.cfg file for this after the TITLE is received.

Posted

Wonderful ... it's good. 😍

Thank you very much for this work.
FSUIPC is an excellent product that allows us to make lots of original things with our simulator.

Thank you for always listening to our needs.

  • Like 1

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.