Keith's LUA Help thread.
Re: Keith's LUA Help thread.
I looked at those datarefs and all of the ones i had in there were simple integer values. What you showed was an alpha numeric tail number. I don't see how you go from INT's to tail numbers unless i'm missing something. Which is quite possible because its getting late.
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Keith's LUA Help thread.
Tony,Sling wrote: ↑Sat Feb 13, 2021 2:51 pm I looked at those datarefs and all of the ones i had in there were simple integer values. What you showed was an alpha numeric tail number. I don't see how you go from INT's to tail numbers unless i'm missing something. Which is quite possible because its getting late.
You know you are not going to sleep. Going to need this info soon maybe...
So lay awake wondering what those datarefs indicate.
We will chat after a refreshed night.
I would have hoped that that @Ralph or @Corjan would have an Idea as well.
In the meantime I will look up the aircraft numbers I have within the AI traffic selected and see if I can correlate any resemblance to those datarefs.
I need to be honest. I have not spent any time searching Xplane forum. Thought there would be a quick resolve here.
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
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Keith's LUA Help thread.
Hi,
Ok I did some Pi work on these two datarefs and it would seem that there is no correlation between these values and the aircraft ID .
So to.... LR for an explanation on how these values are determined and interpreted .
Will revert on their answer if I get one.
Keith
Ok I did some Pi work on these two datarefs and it would seem that there is no correlation between these values and the aircraft ID .
So to.... LR for an explanation on how these values are determined and interpreted .
Will revert on their answer if I get one.
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
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Keith's LUA Help thread.
Hay Tony,
Got this response from "philipp" @xplane.org .
The link, in the link below is very informative and something to take note of.
https://forums.x-plane.org/index.php?/f ... 36479_menu
So now the conversion to make that code mean something other than a a bunch of calculator digits.
Keith
Got this response from "philipp" @xplane.org .
The link, in the link below is very informative and something to take note of.
https://forums.x-plane.org/index.php?/f ... 36479_menu
Code: Select all
As you can read here: https://developer.x-plane.com/article/overriding-tcas-and-providing-traffic-information/
The modeS ID "hex code" is simply a random number, unique per aircraft, for AI aircraft spawned by X-Plane. If the aircraft is spawned by another AI traffic provider, such as Traffic Global or Live Traffic, they can make their own rules and potentially use real IDs from actual aircraft out there.
The mode C code is assigned in ascending order as new aircraft are spawned by X-Plane AI traffic. Again, if the aircraft are spawned by a third-party provider, they can assign the mode C code according to their own ideas.
So now the conversion to make that code mean something other than a a bunch of calculator digits.
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
Re: Keith's LUA Help thread.
Yes I saw that on the org. The bit I didn’t get was the mention of optional flight Id but no further explanation of how it’s implemented. Either way the tcas generation is aimed at hird party plugins so I guess all you can do I’d display whatever is in the datarefs. The code I posted will do the decimal to hex conversion of the 24 bit codes.
Tony
Tony
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Keith's LUA Help thread.
Hi,
I am getting a lot of <Error in timer callback: mod_nrst_pages.lua:1031: attempt to index a nil value (field '?')>
This is because the nav feature field is missing or the value in the field is nil,
I cannot believe that for each field within the nav data one has to add a ....
<If AIRPORT[i]["NAME"] ~= nil then> and then a <If AIRPORT[i]["ICAO"] ~= nil then> and then another <If AIRPORT[i]["SURFACE_LONGEST"] ~= nil then> and so for every single field one wants to search,concat etc
Is there a global way to get around this?
Of course this would not happen if ALL the fields within the nav data had a value.
Keith
I am getting a lot of <Error in timer callback: mod_nrst_pages.lua:1031: attempt to index a nil value (field '?')>
This is because the nav feature field is missing or the value in the field is nil,
I cannot believe that for each field within the nav data one has to add a ....
<If AIRPORT[i]["NAME"] ~= nil then> and then a <If AIRPORT[i]["ICAO"] ~= nil then> and then another <If AIRPORT[i]["SURFACE_LONGEST"] ~= nil then> and so for every single field one wants to search,concat etc
Is there a global way to get around this?
Of course this would not happen if ALL the fields within the nav data had a value.
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
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Keith's LUA Help thread.
Hi,
How do you test a inf value?
This dataref returns inf when there is no time. I want to exclude ,
I tried this but it don't work. I also tried >=0 and that also don't work
Keith
How do you test a inf value?
This dataref returns inf when there is no time. I want to exclude ,
I tried this but it don't work. I also tried >=0 and that also don't work
Code: Select all
ariB_28magR ="font:arimo_bold.ttf; size:28px; color: #ff00ff; halign:right; valign:center;"
nav_stat_pos4=txt_add("",ariB_28magR,828,53,120,20)
function nav_info(ete)
if ete ~= inf then
print(ete)
hrs = math.floor(ete/ 60)
mins = math.floor(ete % 60)
secs = var_round((ete %1)* 60)
txt_set(nav_stat_pos4,hrs..":"..mins..":"..secs)
else
txt_set(nav_stat_pos4,"_:_")
end
end
xpl_dataref_subscribe("sim/cockpit2/radios/indicators/hsi_dme_time_min_pilot","FLOAT",nav_info)
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
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Keith's LUA Help thread.
Hi,
OK sorted it out. I get these doff moments sometimes.
Keith
OK sorted it out. I get these doff moments sometimes.
Code: Select all
if tostring(ete) ~= "inf" then
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
-
- Posts: 79
- Joined: Tue Dec 01, 2020 8:50 am
MULTIPLE assignments to one pin
Hi Guru's.
Noob question, example question. I have a plane with 4 engines, 4 prop controls, 4 minxure controls. Can i assign engine 1/2/3/4 to one linear hardware pod and control alle engines with one. Same would go for the Mixture and Prop control. reason for asking, if i would like to fly a DC6 for example my current setup is a C172. The instruments i can change but the hardware is a bit more tricky.
Code wise it would be same as the tutorial. That has an error in it.
- For X-Plane we need to override the joystick input first NONONONONO this disables all Joystick input like the ruddel pedals, saitek yoke and all others !!!!!
xpl_dataref_write("sim/operation/override/override_joystick", "INT", 1) -- DONT USE this part of the example[/b]
Mike
Noob question, example question. I have a plane with 4 engines, 4 prop controls, 4 minxure controls. Can i assign engine 1/2/3/4 to one linear hardware pod and control alle engines with one. Same would go for the Mixture and Prop control. reason for asking, if i would like to fly a DC6 for example my current setup is a C172. The instruments i can change but the hardware is a bit more tricky.
Code wise it would be same as the tutorial. That has an error in it.
- For X-Plane we need to override the joystick input first NONONONONO this disables all Joystick input like the ruddel pedals, saitek yoke and all others !!!!!
xpl_dataref_write("sim/operation/override/override_joystick", "INT", 1) -- DONT USE this part of the example[/b]
Mike
Last edited by Mike Horsten on Fri Apr 23, 2021 1:05 pm, edited 2 times in total.
Building a home Cessna 172SP Steam. X-plane/MFS2020
(ex Name on Airmanager forum Polarair)
(ex Name on Airmanager forum Polarair)
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: MULTIPLE assignments to one pin
Mike,Mike Horsten wrote: ↑Fri Apr 23, 2021 1:00 pm Hi Guru's.
Noob question, example question. I have a plane with 4 engines, 4 prop controls, 4 minxure controls. Can i assign engine 1/2/3/4 to one linear hardware pod and control alle engines with one. Same would go for the Mixture and Prop control. reason for asking, if i would like to fly a DC6 for example my current setup is a C172. The instruments i can change but the hardware is a bit more trickey.
Mike
Should be no problem.
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