Keith's LUA Help thread.

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Message
Author
JackZ
Posts: 2267
Joined: Mon Feb 22, 2016 1:02 pm

Re: Keith's LUA Help thread.

#31 Post by JackZ »

The thing is that AM in Lua is not a 100% procedural language, and some functions are “non blocking”

Simply put, tasks are sometimes done concurrently, such as a call to a function to parse data from an external source not in memory (in our case a JSON file).

This parsing function takes some time, because it has to actually “read” a file, that is roughly :
send a request to the OS to get the requested file, wait for an answer from the OS (yes/no the file exists), wait for the OS to read the file ie move physically to the correct location to the hard drive (if not an SSD), then receive the whole data and store it to memory, and lastly do it’s Corjan magical tricks to parse the data, strip the enclosing characters and sorting the right data. Even with modern computers this process takes some time (and it increases with the size of the data file), say a few milliseconds.

Fortunately this function is “non blocking”, so In the meantime the AM Lua program will go on but the whole data will not be available till the end of the function.
If you’re trying to use a variable BEFORE it has been filled by the parsing function, AM will simply use whatever value it has into it’s memory at the time.
After a slight delay, the JSON parsing is finished, and the vars you populated during the data parsing call are fully ready for further use.

Hence the delay needed, but if you are using the data directly into the parsing function, the data will not be released or displayed until it is available.

Hence Keith, as per your request of a “global” variable, yes variables are indeed global ones (if not declared local) even in the parse_data function, but they will be available after a slightly delay due to to the physical access to the file.

Another method to avoid that kind of naughty side effect is to get the data parsed very early during initialization, and to display that data afterwards in the code, after all the ressources have been created. The time taken for the initialization should be enough to introduce a delay and avoid the use of a timer.

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

JackZ
Posts: 2267
Joined: Mon Feb 22, 2016 1:02 pm

Re: Keith's LUA Help thread.

#32 Post by JackZ »

Keith Baxter wrote: Sun Mar 03, 2019 5:51 am
Sling wrote: Sun Mar 03, 2019 2:10 am
Keith Baxter wrote: Sun Mar 03, 2019 12:02 am I still think that a var_set function would be less troublesome.
When I was searching the net I came across this list of variables. They use varset.

http://www.prepar3d.com/SDKv3/LearningC ... pting.html
In your example var_set() and var_get() are related to an access to P3D internal sim variables which are already in memory.

A huge difference with some data in a file like a JSON data file which is located on a physical support such as a hard drive.

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Keith's LUA Help thread.

#33 Post by Keith Baxter »

JackZ wrote: Sun Mar 03, 2019 8:05 am
Keith Baxter wrote: Sun Mar 03, 2019 5:51 am
Sling wrote: Sun Mar 03, 2019 2:10 am
When I was searching the net I came across this list of variables. They use varset.

http://www.prepar3d.com/SDKv3/LearningC ... pting.html
In your example var_set() and var_get() are related to an access to P3D internal sim variables which are already in memory.

A huge difference with some data in a file like a JSON data file which is located on a physical support such as a hard drive.

Jacques
Thank you for explaining Jacques.
Now what Corjan said to me is making sense.

Quote "I see you use static_data_load within dial callbacks. It should work, but is not recommended. Since static_data_load is slow, and you can get a lot of dial callbacks. For the chars.json, it is better to only load the data once, and store it in a variable.You can keep accessing that variable after that point. Add this to the start of the logic.lua. charts_data = nil
static_data_load("charts.json", function(data)
charts_data = data
end)
When you need to access the data, you can use 'charts_data'.
if charts_data ~= nil then
print(charts_data[iaco_var][chart_type]["A"]["TEXT"])
end
You do have to check if charts_data has been loaded, so do a 'if charts_data ~= nil' before using it"

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Sling
Posts: 5239
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Keith's LUA Help thread.

#34 Post by Sling »

Keith,

I did not realise you were using it in that way. Corjan is absolutely correct. Why read the same file over and over again. The way I tackled this is like one of the suggestions Jacques gave. You read the file once and once only during initial code run. The trick is to store the result of the read into an array name of your choosing and then access data within it by using this array name. This is essentially loading the file contents into memory.

You also need to account for varying lengths of file and computer speed so i included a timer to check on the read status every few ms until it was complete. When complete you call your code that wants to use the data from the read file.

If that doesn't quite make sense I have attached a modified version of your test script accordingly.

Tony


map_lat_lon_2.siff
(1.29 MiB) Downloaded 172 times

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Keith's LUA Help thread.

#35 Post by Keith Baxter »

Jacques, Tony, Corjan,

Thank you guys so much for all the assistance and help.

You guys have assisted me so much and now I understand what is happening.

A shorten version on what is been said here needs to be in the wiki so that others will not fall into the same trap that I have.
Tony you must make it clear in the static_data_load video.

My instrument has many JSON files. One for charts, one for Airports, one each for the 3 manuals, one each for the check lists, one for flight plans and one for way points.
So it is important that I get it right so as not to have issues then having to redo everything.

Thanks Guys you are stars most appreciated.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

JackZ
Posts: 2267
Joined: Mon Feb 22, 2016 1:02 pm

Re: Keith's LUA Help thread.

#36 Post by JackZ »

JSON parsing is a fairly new option, and some problem might arise with it, as you had.
These were interresting problems, thanks for raising them!

Nowadays memory (RAM) is cheap, so it is best to use it!
Instead of parsing the files each time, the best way is to load the JSON files into memory in different indexed arrays (data1,data2,data3,etc...) at the very beginning of your program.

You then check that the data has been fully loaded using Corjan’s trick (testing first if it is populated (data1~=nil)) , and can then access the data internally using the array indexes.

One exception is for graphical items (maps and text files), you don’t want to fill the memory with graphic files which might or might not be used, so it’s best to wait and retrieve the file using its path and file name previously loaded in memory, only if and when the image is needed, and add it using img_add().
The cool thing is you can even remove the graphic resource when it is no longer needed, using img_remove()

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Keith's LUA Help thread.

#37 Post by Keith Baxter »

Corjan,

I am going to load all the JSON files right at the beginning of the logic_lua like this. Because I am loading a few JSON files I am going to use different callbacks. Reason there will be many (data). Is it better to use (data_chart), (data_airports) etc.

Code: Select all


charts_data = nil
static_data_load("charts.json", function(data_charts)
	charts_data = data_charts
end)

ariport_data = nil
static_data_load("airport.json", function(data_airports)
	airports_data = data_airports
end)

keyboard_data = nil
static_data_load("kryboard.json", function(data_keyboard)
	keyboard_data = data_keyboard
end)

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Keith's LUA Help thread.

#38 Post by Keith Baxter »

JackZ wrote: Sun Mar 03, 2019 11:29 am JSON parsing is a fairly new option, and some problem might arise with it, as you had.
These were interresting problems, thanks for raising them!

Nowadays memory (RAM) is cheap, so it is best to use it!
Instead of parsing the files each time, the best way is to load the JSON files into memory in different indexed arrays (data1,data2,data3,etc...) at the very beginning of your program.

You then check that the data has been fully loaded using Corjan’s trick (testing first if it is populated (data1~=nil)) , and can then access the data internally using the array indexes.

One exception is for graphical items (maps and text files), you don’t want to fill the memory with graphic files which might or might not be used, so it’s best to wait and retrieve the file using its path and file name previously loaded in memory, only if and when the image is needed, and add it using img_add().
The cool thing is you can even remove the graphic resource when it is no longer needed, using img_remove()

Jacques
Jacques,

Yes I think I am one of very few users using static_data. I am very impressed with the flexibility it provides and it opens up loads of awesomeness that can be implemented in ones AM instrument.

I am hoping that more users will start to use static_data so that it gives Corjan more appetite to develop it more. :mrgreen: :mrgreen:

Corjan has done a lot of debugging so far. It is a pity he id dealing with a not so good programmer in me. Corjan has been very patience with me.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Sling
Posts: 5239
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Keith's LUA Help thread.

#39 Post by Sling »

Keith Baxter wrote: Sun Mar 03, 2019 11:38 am Corjan,

I am going to load all the JSON files right at the beginning of the logic_lua like this. Because I am loading a few JSON files I am going to use different callbacks. Reason there will be many (data). Is it better to use (data_chart), (data_airports) etc.

Code: Select all


charts_data = nil
static_data_load("charts.json", function(data_charts)
	charts_data = data_charts
end)

ariport_data = nil
static_data_load("airport.json", function(data_airports)
	airports_data = data_airports
end)

keyboard_data = nil
static_data_load("kryboard.json", function(data_keyboard)
	keyboard_data = data_keyboard
end)

Keith

Don’t forget to use that timer also to check for when they have all loaded. You should be able to check them all in the one timer loop.

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Keith's LUA Help thread.

#40 Post by Keith Baxter »

JackZ wrote: Sun Mar 03, 2019 11:29 am
One exception is for graphical items (maps and text files), you don’t want to fill the memory with graphic files which might or might not be used, so it’s best to wait and retrieve the file using its path and file name previously loaded in memory, only if and when the image is needed, and add it using img_add().
The cool thing is you can even remove the graphic resource when it is no longer needed, using img_remove()

Jacques
Jacques,

I am currently loading a bunch of text files using the txt_set(). does that mean that the data is stored twice?
For the Charts I do use the img_remove() but for the text I was doing as follows.
Is there a better way of doing it? Or should we be requesting a txt_remove() as well?

Code: Select all

static_data_load("airports.json", function(data)
        lat = data[icao_var]["AIRPORT"]["LAT"]
        long = data[icao_var]["AIRPORT"]["LON"]
        map_goto(navmapA, lat, long)

	txt_set(chartA_text, data[icao_var]["AIRPORT"]["INDENT"])		
	txt_set(airpA_text1,data[icao_var]["AIRPORT"]["NAME"])
	txt_set(airpA_text2,data[icao_var]["AIRPORT"]["AREA"])	
	txt_set(airpA_text3,data[icao_var]["AIRPORT"]["POSITION"])	
	txt_set(airpA_text4,data[icao_var]["AIRPORT"]["ELIVATION"])
	txt_set(airpA_text7,data[icao_var]["AIRPORT"]["MAGVAR"])	
	txt_set(airpA_text9,data[icao_var]["AIRPORT"]["IFR"])
	txt_set(airpA_text11,data[icao_var]["AIRPORT"]["ARP TYPE"])	
	txt_set(airpA_text13,data[icao_var]["AIRPORT"]["LONG RWY"])
	
	txt_set(chart_text, data[icao_var]["NEAR AIRP"]["ICAO1"][1])	
	txt_set(chart_text1, data[icao_var]["NEAR AIRP"]["ICAO1"][2])
	txt_set(chart_text2, data[icao_var]["NEAR AIRP"]["ICAO1"][4])
	txt_set(chart_text2x, data[icao_var]["NEAR AIRP"]["ICAO1"][3])
	
	txt_set(chart_text3, data[icao_var]["NEAR AIRP"]["ICAO2"][1])	
	txt_set(chart_text4, data[icao_var]["NEAR AIRP"]["ICAO2"][2])
	txt_set(chart_text5, data[icao_var]["NEAR AIRP"]["ICAO2"][4])
	txt_set(chart_text5x, data[icao_var]["NEAR AIRP"]["ICAO2"][3])	
	txt_set(chart_text6, data[icao_var]["NEAR AIRP"]["ICAO3"][1])	
	txt_set(chart_text7, data[icao_var]["NEAR AIRP"]["ICAO3"][2])
	txt_set(chart_text8, data[icao_var]["NEAR AIRP"]["ICAO3"][4])
	txt_set(chart_text8x, data[icao_var]["NEAR AIRP"]["ICAO3"][3])	
	txt_set(chart_text9, data[icao_var]["NEAR AIRP"]["ICAO4"][1])	
	txt_set(chart_text10, data[icao_var]["NEAR AIRP"]["ICAO4"][2])
	txt_set(chart_text11, data[icao_var]["NEAR AIRP"]["ICAO4"][4])
	txt_set(chart_text11x, data[icao_var]["NEAR AIRP"]["ICAO4"][3])	
	txt_set(chart_text12, data[icao_var]["NEAR AIRP"]["ICAO5"][1])	
	txt_set(chart_text13, data[icao_var]["NEAR AIRP"]["ICAO5"][2])
	txt_set(chart_text14, data[icao_var]["NEAR AIRP"]["ICAO5"][4])
	txt_set(chart_text14x, data[icao_var]["NEAR AIRP"]["ICAO5"][3])	



	
	txt_set(chart_text15, data[icao_var]["NEAR NAV"]["ID1"][1])	
	txt_set(chart_text16, data[icao_var]["NEAR NAV"]["ID1"][2])
	txt_set(chart_text17, data[icao_var]["NEAR NAV"]["ID1"][3])
	txt_set(chart_text18, data[icao_var]["NEAR NAV"]["ID1"][4])	
	txt_set(chart_text19, data[icao_var]["NEAR NAV"]["ID1"][5])
	txt_set(chart_text20, data[icao_var]["NEAR NAV"]["ID1"][6])	
	txt_set(chart_text21, data[icao_var]["NEAR NAV"]["ID2"][1])	
	txt_set(chart_text22, data[icao_var]["NEAR NAV"]["ID2"][2])
	txt_set(chart_text23, data[icao_var]["NEAR NAV"]["ID2"][3])	
	txt_set(chart_text24, data[icao_var]["NEAR NAV"]["ID2"][4])	
	txt_set(chart_text25, data[icao_var]["NEAR NAV"]["ID2"][5])
	txt_set(chart_text26, data[icao_var]["NEAR NAV"]["ID2"][6])	
	txt_set(chart_text27, data[icao_var]["NEAR NAV"]["ID3"][1])	
	txt_set(chart_text28, data[icao_var]["NEAR NAV"]["ID3"][2])
	txt_set(chart_text29, data[icao_var]["NEAR NAV"]["ID3"][3])	
	txt_set(chart_text30, data[icao_var]["NEAR NAV"]["ID3"][4])	
	txt_set(chart_text31, data[icao_var]["NEAR NAV"]["ID3"][5])
	txt_set(chart_text32, data[icao_var]["NEAR NAV"]["ID3"][6])
	txt_set(chart_text33, data[icao_var]["NEAR NAV"]["ID4"][1])	
	txt_set(chart_text34, data[icao_var]["NEAR NAV"]["ID4"][2])
	txt_set(chart_text35, data[icao_var]["NEAR NAV"]["ID4"][3])	
	txt_set(chart_text36, data[icao_var]["NEAR NAV"]["ID4"][4])	
	txt_set(chart_text37, data[icao_var]["NEAR NAV"]["ID4"][5])
	txt_set(chart_text38, data[icao_var]["NEAR NAV"]["ID4"][6])	
	txt_set(chart_text39, data[icao_var]["NEAR NAV"]["ID5"][1])	
	txt_set(chart_text40, data[icao_var]["NEAR NAV"]["ID5"][2])
	txt_set(chart_text41, data[icao_var]["NEAR NAV"]["ID5"][3])	
	txt_set(chart_text42, data[icao_var]["NEAR NAV"]["ID5"][4])	
	txt_set(chart_text43, data[icao_var]["NEAR NAV"]["ID5"][5])
	txt_set(chart_text44, data[icao_var]["NEAR NAV"]["ID5"][6])

	txt_set(chartA_text, data[icao_var]["AIRPORT"]["INDENT"])		
	txt_set(airpA_text1,data[icao_var]["AIRPORT"]["NAME"])
	txt_set(airpA_text2,data[icao_var]["AIRPORT"]["AREA"])	
	txt_set(airpA_text3,data[icao_var]["AIRPORT"]["POSITION"])	
	txt_set(airpA_text4,data[icao_var]["AIRPORT"]["ELIVATION"])
	txt_set(airpA_text7,data[icao_var]["AIRPORT"]["MAGVAR"])	
	txt_set(airpA_text9,data[icao_var]["AIRPORT"]["IFR"])
	txt_set(airpA_text11,data[icao_var]["AIRPORT"]["ARP TYPE"])	
	txt_set(airpA_text13,data[icao_var]["AIRPORT"]["LONG RWY"])
	
	txt_set(airapA_frq_text1,data[icao_var]["COM"]["COM1"][1])
	txt_set(airapA_frq_text2,data[icao_var]["COM"]["COM1"][2])
	txt_set(airapA_frq_text3,data[icao_var]["COM"]["COM1"][3])
	txt_set(airapA_frq_text4,data[icao_var]["COM"]["COM1"][4])	
	txt_set(airapA_frq_text5,data[icao_var]["COM"]["COM2"][1])
	txt_set(airapA_frq_text6,data[icao_var]["COM"]["COM2"][2])
	txt_set(airapA_frq_text7,data[icao_var]["COM"]["COM2"][3])
	txt_set(airapA_frq_text8,data[icao_var]["COM"]["COM2"][4])
	txt_set(airapA_frq_text9,data[icao_var]["COM"]["COM3"][1])
	txt_set(airapA_frq_text10,data[icao_var]["COM"]["COM3"][2])
	txt_set(airapA_frq_text11,data[icao_var]["COM"]["COM3"][3])
	txt_set(airapA_frq_text12,data[icao_var]["COM"]["COM3"][4])	
	txt_set(airapA_frq_text13,data[icao_var]["COM"]["COM4"][1])
	txt_set(airapA_frq_text14,data[icao_var]["COM"]["COM4"][2])
	txt_set(airapA_frq_text15,data[icao_var]["COM"]["COM4"][3])
	txt_set(airapA_frq_text16,data[icao_var]["COM"]["COM4"][4])	
	txt_set(airapA_frq_text17,data[icao_var]["COM"]["COM5"][1])
	txt_set(airapA_frq_text18,data[icao_var]["COM"]["COM5"][2])
	txt_set(airapA_frq_text19,data[icao_var]["COM"]["COM5"][3])
	txt_set(airapA_frq_text20,data[icao_var]["COM"]["COM5"][4])	
	txt_set(airapA_frq_text21,data[icao_var]["COM"]["COM6"][1])
	txt_set(airapA_frq_text22,data[icao_var]["COM"]["COM6"][2])
	txt_set(airapA_frq_text23,data[icao_var]["COM"]["COM6"][3])
	txt_set(airapA_frq_text24,data[icao_var]["COM"]["COM6"][4])		
	txt_set(airapA_frq_text25,data[icao_var]["COM"]["COM7"][1])
	txt_set(airapA_frq_text26,data[icao_var]["COM"]["COM7"][2])
	txt_set(airapA_frq_text27,data[icao_var]["COM"]["COM7"][3])
	txt_set(airapA_frq_text28,data[icao_var]["COM"]["COM7"][4])	
	txt_set(airapA_frq_text29,data[icao_var]["COM"]["COM8"][1])
	txt_set(airapA_frq_text30,data[icao_var]["COM"]["COM8"][2])
	txt_set(airapA_frq_text31,data[icao_var]["COM"]["COM8"][3])
	txt_set(airapA_frq_text32,data[icao_var]["COM"]["COM8"][4])
	txt_set(airapA_frq_text33,data[icao_var]["COM"]["COM9"][1])
	txt_set(airapA_frq_text34,data[icao_var]["COM"]["COM9"][2])
	txt_set(airapA_frq_text35,data[icao_var]["COM"]["COM9"][3])
	txt_set(airapA_frq_text36,data[icao_var]["COM"]["COM9"][4])	
	txt_set(airapA_frq_text37,data[icao_var]["COM"]["COM10"][1])
	txt_set(airapA_frq_text38,data[icao_var]["COM"]["COM10"][2])
	txt_set(airapA_frq_text39,data[icao_var]["COM"]["COM10"][3])
	txt_set(airapA_frq_text40,data[icao_var]["COM"]["COM10"][4])
	txt_set(airapA_frq_text41,data[icao_var]["COM"]["COM11"][1])
	txt_set(airapA_frq_text42,data[icao_var]["COM"]["COM11"][2])
	txt_set(airapA_frq_text43,data[icao_var]["COM"]["COM11"][3])
	txt_set(airapA_frq_text44,data[icao_var]["COM"]["COM11"][4])	
	txt_set(airapA_frq_text45,data[icao_var]["COM"]["COM12"][1])
	txt_set(airapA_frq_text46,data[icao_var]["COM"]["COM12"][2])
	txt_set(airapA_frq_text47,data[icao_var]["COM"]["COM12"][3])
	txt_set(airapA_frq_text48,data[icao_var]["COM"]["COM12"][4])	
	txt_set(airapA_frq_text49,data[icao_var]["COM"]["COM13"][1])
	txt_set(airapA_frq_text50,data[icao_var]["COM"]["COM13"][2])
	txt_set(airapA_frq_text51,data[icao_var]["COM"]["COM13"][3])
	txt_set(airapA_frq_text52,data[icao_var]["COM"]["COM13"][4])	
	txt_set(airapA_frq_text53,data[icao_var]["COM"]["COM14"][1])
	txt_set(airapA_frq_text54,data[icao_var]["COM"]["COM14"][2])
	txt_set(airapA_frq_text55,data[icao_var]["COM"]["COM14"][3])
	txt_set(airapA_frq_text56,data[icao_var]["COM"]["COM14"][4])	
	txt_set(airapA_frq_text57,data[icao_var]["COM"]["COM15"][1])
	txt_set(airapA_frq_text58,data[icao_var]["COM"]["COM15"][2])
	txt_set(airapA_frq_text59,data[icao_var]["COM"]["COM15"][3])
	txt_set(airapA_frq_text60,data[icao_var]["COM"]["COM15"][4])	
	txt_set(airapA_frq_text61,data[icao_var]["COM"]["COM16"][1])
	txt_set(airapA_frq_text62,data[icao_var]["COM"]["COM16"][2])
	txt_set(airapA_frq_text63,data[icao_var]["COM"]["COM16"][3])
	txt_set(airapA_frq_text64,data[icao_var]["COM"]["COM16"][4])		
	txt_set(airapA_frq_text65,data[icao_var]["COM"]["COM17"][1])
	txt_set(airapA_frq_text66,data[icao_var]["COM"]["COM17"][2])
	txt_set(airapA_frq_text67,data[icao_var]["COM"]["COM17"][3])
	txt_set(airapA_frq_text68,data[icao_var]["COM"]["COM17"][4])


	txt_set(chart_text, data[icao_var]["NEAR AIRP"]["ICAO1"][1])	
	txt_set(chart_text1, data[icao_var]["NEAR AIRP"]["ICAO1"][2])
	txt_set(chart_text2, data[icao_var]["NEAR AIRP"]["ICAO1"][4])
	txt_set(chart_text2x, data[icao_var]["NEAR AIRP"]["ICAO1"][3])
	
	txt_set(chart_text3, data[icao_var]["NEAR AIRP"]["ICAO2"][1])	
	txt_set(chart_text4, data[icao_var]["NEAR AIRP"]["ICAO2"][2])
	txt_set(chart_text5, data[icao_var]["NEAR AIRP"]["ICAO2"][4])
	txt_set(chart_text5x, data[icao_var]["NEAR AIRP"]["ICAO2"][3])	
	txt_set(chart_text6, data[icao_var]["NEAR AIRP"]["ICAO3"][1])	
	txt_set(chart_text7, data[icao_var]["NEAR AIRP"]["ICAO3"][2])
	txt_set(chart_text8, data[icao_var]["NEAR AIRP"]["ICAO3"][4])
	txt_set(chart_text8x, data[icao_var]["NEAR AIRP"]["ICAO3"][3])	
	txt_set(chart_text9, data[icao_var]["NEAR AIRP"]["ICAO4"][1])	
	txt_set(chart_text10, data[icao_var]["NEAR AIRP"]["ICAO4"][2])
	txt_set(chart_text11, data[icao_var]["NEAR AIRP"]["ICAO4"][4])
	txt_set(chart_text11x, data[icao_var]["NEAR AIRP"]["ICAO4"][3])	
	txt_set(chart_text12, data[icao_var]["NEAR AIRP"]["ICAO5"][1])	
	txt_set(chart_text13, data[icao_var]["NEAR AIRP"]["ICAO5"][2])
	txt_set(chart_text14, data[icao_var]["NEAR AIRP"]["ICAO5"][4])
	txt_set(chart_text14x, data[icao_var]["NEAR AIRP"]["ICAO5"][3])	
	

	txt_set(chart_text15, data[icao_var]["NEAR NAV"]["ID1"][1])	
	txt_set(chart_text16, data[icao_var]["NEAR NAV"]["ID1"][2])
	txt_set(chart_text17, data[icao_var]["NEAR NAV"]["ID1"][3])
	txt_set(chart_text18, data[icao_var]["NEAR NAV"]["ID1"][4])	
	txt_set(chart_text19, data[icao_var]["NEAR NAV"]["ID1"][5])
	txt_set(chart_text20, data[icao_var]["NEAR NAV"]["ID1"][6])	
	txt_set(chart_text21, data[icao_var]["NEAR NAV"]["ID2"][1])	
	txt_set(chart_text22, data[icao_var]["NEAR NAV"]["ID2"][2])
	txt_set(chart_text23, data[icao_var]["NEAR NAV"]["ID2"][3])	
	txt_set(chart_text24, data[icao_var]["NEAR NAV"]["ID2"][4])	
	txt_set(chart_text25, data[icao_var]["NEAR NAV"]["ID2"][5])
	txt_set(chart_text26, data[icao_var]["NEAR NAV"]["ID2"][6])	
	txt_set(chart_text27, data[icao_var]["NEAR NAV"]["ID3"][1])	
	txt_set(chart_text28, data[icao_var]["NEAR NAV"]["ID3"][2])
	txt_set(chart_text29, data[icao_var]["NEAR NAV"]["ID3"][3])	
	txt_set(chart_text30, data[icao_var]["NEAR NAV"]["ID3"][4])	
	txt_set(chart_text31, data[icao_var]["NEAR NAV"]["ID3"][5])
	txt_set(chart_text32, data[icao_var]["NEAR NAV"]["ID3"][6])
	txt_set(chart_text33, data[icao_var]["NEAR NAV"]["ID4"][1])	
	txt_set(chart_text34, data[icao_var]["NEAR NAV"]["ID4"][2])
	txt_set(chart_text35, data[icao_var]["NEAR NAV"]["ID4"][3])	
	txt_set(chart_text36, data[icao_var]["NEAR NAV"]["ID4"][4])	
	txt_set(chart_text37, data[icao_var]["NEAR NAV"]["ID4"][5])
	txt_set(chart_text38, data[icao_var]["NEAR NAV"]["ID4"][6])	
	txt_set(chart_text39, data[icao_var]["NEAR NAV"]["ID5"][1])	
	txt_set(chart_text40, data[icao_var]["NEAR NAV"]["ID5"][2])
	txt_set(chart_text41, data[icao_var]["NEAR NAV"]["ID5"][3])	
	txt_set(chart_text42, data[icao_var]["NEAR NAV"]["ID5"][4])	
	txt_set(chart_text43, data[icao_var]["NEAR NAV"]["ID5"][5])
	txt_set(chart_text44, data[icao_var]["NEAR NAV"]["ID5"][6])

	txt_set(airapA_rwy_text1,data[icao_var]["RWY"]["RWY1"][1])
	txt_set(airapA_rwy_text2,data[icao_var]["RWY"]["RWY1"][2])	
	txt_set(airapA_rwy_text3,data[icao_var]["RWY"]["RWY1"][3])	
	txt_set(airapA_rwy_text4,data[icao_var]["RWY"]["RWY1"][4])
	txt_set(airapA_rwy_text5,data[icao_var]["RWY"]["RWY1"][5])
	txt_set(airapA_rwy_text6,data[icao_var]["RWY"]["RWY2"][1])
	txt_set(airapA_rwy_text7,data[icao_var]["RWY"]["RWY2"][2])	
	txt_set(airapA_rwy_text8,data[icao_var]["RWY"]["RWY2"][3])	
	txt_set(airapA_rwy_text9,data[icao_var]["RWY"]["RWY2"][4])
	txt_set(airapA_rwy_text10,data[icao_var]["RWY"]["RWY2"][5])
	txt_set(airapA_rwy_text11,data[icao_var]["RWY"]["RWY3"][1])
	txt_set(airapA_rwy_text12,data[icao_var]["RWY"]["RWY3"][2])	
	txt_set(airapA_rwy_text13,data[icao_var]["RWY"]["RWY3"][3])	
	txt_set(airapA_rwy_text14,data[icao_var]["RWY"]["RWY3"][4])
	txt_set(airapA_rwy_text15,data[icao_var]["RWY"]["RWY3"][5])
	txt_set(airapA_rwy_text16,data[icao_var]["RWY"]["RWY4"][1])
	txt_set(airapA_rwy_text17,data[icao_var]["RWY"]["RWY4"][2])	
	txt_set(airapA_rwy_text18,data[icao_var]["RWY"]["RWY4"][3])	
	txt_set(airapA_rwy_text19,data[icao_var]["RWY"]["RWY4"][4])
	txt_set(airapA_rwy_text20,data[icao_var]["RWY"]["RWY4"][5])	
	txt_set(airapA_rwy_text21,data[icao_var]["RWY"]["RWY5"][1])
	txt_set(airapA_rwy_text22,data[icao_var]["RWY"]["RWY5"][2])	
	txt_set(airapA_rwy_text23,data[icao_var]["RWY"]["RWY5"][3])	
	txt_set(airapA_rwy_text24,data[icao_var]["RWY"]["RWY5"][4])
	txt_set(airapA_rwy_text25,data[icao_var]["RWY"]["RWY5"][5])
	txt_set(airapA_rwy_text26,data[icao_var]["RWY"]["RWY6"][1])
	txt_set(airapA_rwy_text27,data[icao_var]["RWY"]["RWY6"][2])	
	txt_set(airapA_rwy_text28,data[icao_var]["RWY"]["RWY6"][3])	
	txt_set(airapA_rwy_text29,data[icao_var]["RWY"]["RWY6"][4])
	txt_set(airapA_rwy_text30,data[icao_var]["RWY"]["RWY6"][5])
	
	txt_set(airapA_nav_text1,data[icao_var]["NAV"]["RWY1"][1])
	txt_set(airapA_nav_text2,data[icao_var]["NAV"]["RWY1"][2])	
	txt_set(airapA_nav_text3,data[icao_var]["NAV"]["RWY1"][3])	
	txt_set(airapA_nav_text4,data[icao_var]["NAV"]["RWY1"][4])	
	txt_set(airapA_nav_text5,data[icao_var]["NAV"]["RWY2"][1])
	txt_set(airapA_nav_text6,data[icao_var]["NAV"]["RWY2"][2])	
	txt_set(airapA_nav_text7,data[icao_var]["NAV"]["RWY2"][3])	
	txt_set(airapA_nav_text8,data[icao_var]["NAV"]["RWY2"][4])	
	txt_set(airapA_nav_text9,data[icao_var]["NAV"]["RWY3"][1])
	txt_set(airapA_nav_text10,data[icao_var]["NAV"]["RWY3"][2])	
	txt_set(airapA_nav_text11,data[icao_var]["NAV"]["RWY3"][3])	
	txt_set(airapA_nav_text12,data[icao_var]["NAV"]["RWY3"][4])	
	txt_set(airapA_nav_text13,data[icao_var]["NAV"]["RWY4"][1])
	txt_set(airapA_nav_text14,data[icao_var]["NAV"]["RWY4"][2])	
	txt_set(airapA_nav_text15,data[icao_var]["NAV"]["RWY4"][3])	
	txt_set(airapA_nav_text16,data[icao_var]["NAV"]["RWY4"][4])
	txt_set(airapA_nav_text17,data[icao_var]["NAV"]["RWY5"][1])
	txt_set(airapA_nav_text18,data[icao_var]["NAV"]["RWY5"][2])	
	txt_set(airapA_nav_text19,data[icao_var]["NAV"]["RWY5"][3])	
	txt_set(airapA_nav_text20,data[icao_var]["NAV"]["RWY5"][4])	
	txt_set(airapA_nav_text21,data[icao_var]["NAV"]["RWY6"][1])
	txt_set(airapA_nav_text22,data[icao_var]["NAV"]["RWY6"][2])	
	txt_set(airapA_nav_text23,data[icao_var]["NAV"]["RWY6"][3])	
	txt_set(airapA_nav_text24,data[icao_var]["NAV"]["RWY6"][4])

		
end)
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply