Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Adding default FSX commands into and aircraft specific funct

Featured Replies

Hi there,

Linda is the best addon for my flight simulator - period. Thank you all on here for the part(s) you have played.

I was wondering if someone could help me with an idea.

i would like an aircraft specific function to also send an FSX command as well as the aircraft specific action.

ie. for the NGX, i would like the heading bug function to be something like:

function NGX_AP_HDG_inc ()
    if mcp_hdg_mode == 1 then
        ipc.control(PMDGBaseVar+390, PMDG_inc)
        ipc.sleep(20)
    else
        NGX_AP_BANK_inc ()
    end
    NGX_AP_HDG_show ()

FSX:HDG INCR ()
end

 

however im not sure how to code the default AP action - i have represented it in the code as FSX:HDG INCR

 

1. is this possible? and

2. is there a list of the default FSX commands so I could add it to for example altitude set and so so on....

 

Thank you!

Clark

 

You should be able to get most info you need from the editor and tracer function of Linda. You can search by name of Fsx control, then set it to tell you the control number

so - control:33456 (or whatever hdg is)

have a play with it, read the manual

 

Luke Pype

  • Author

Thanks for the quick reply!

I sort of get it. I can open the FSX Library (//modules/Linda/Libs/libs-fsx.LUA) and find the function for Heading bug increase or decrease but what confuses me is that inside the Linda GUI, if I am assigning an FSX control to a button, I can choose for example HDG Plus or Heading Plus Fast... but I don't see that in the library... perhaps I am looking in the wrong place?

@clarklidbury I would be interested to know why you would want to include the FSX Default function inside the aircraft module which works with the specific aircraft.

To answer your question. As you identified, the FSX Default aircraft functions can be found in the libs-fix.lua library. These functions implement the FSX Control instructions that appear in the Tracer FSX Controls listing. All are of the form _HEADING_BUG_INC() (underscore prefix). You can insert these functions into your LUA code. These are equivalent to using the Lua instruction ipc.control(65879,p)

It is strongly advised not to modify the original supplied code. Instead you can add your bespoke code to the aircrafts user.lua file. You can use the same function name as the module and this will override (replace) the original. In this case you will be to copy all the original function code across before modifying it for your needs. Alternatively, you can give it a unique name and include calls to the original function name and any additional code or function calls.

Should you wish to write your own general functions for all aircraft then you can add your code to the lib-users.lua file. 

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

  • Author

Hi Andrew,

Thanks so much for the detailed reply! The reason why I am looking to achieve such an outcome is because I use air manager on my ipad. For some aircraft (eg the PMDG NGXu) I have installed the amazing aircraft module and use the NGXu specific function to move the heading bug on the MCP and PFD/ND. Works a treat! I have this assigned to the rotary on my VRi MCP. However, my air manager instrument doesn't sync or move the heading bug. So while the aircraft responds to the heading bug change from linda, air manager reflects a different heading on its heading bug. If I change the rotary to use the default FSX heading bug control, then air manager responds (as the command is sent to FSX as to increment the heading bug and FSX still presumably received the command) but the NGX doesn't receive the command into its own system... So I thought I could modify the NGXu heading bug functions inside the aircraft module to ALSO trigger a default FSX command and that way I would get the best of both worlds I think... but I am not sure.... I also feel that the headings may lose sync so to speak but again i am not sure yet.

I have other addon aircraft that don't have this connundrum - ie the Majestic Q400 - with this addon the heading from the aircraft specific function and the FSX function have no difference... and the air manager instrument and the aircraft EFIS system itself sync and update together.... I an looking to achieve the same result....

I hope at least some of that makes sense! Thanks again for the reply, I am going to attempt some trial and error. I can live with it if I can't figure it out, but it seemed like a good project to learn a little bit more how this stuff works.

So would I simply type something similar to _HEADING_BUG_INC() inside the NGX function which does the same thing?

Thanks again!

Clark

I understand what you are trying to do. Aircraft like PMDG that don’t use standard FSX parameters make module writer’s lives interesting. 

You can just insert the appropriate FSX default function into the NGX function. As I said this should be a copy of that function placed in the user.lua. 

However, a word of caution. Trying to apply 2 different inputs (one NGX and one FSX) can lead to the output becoming out of sync. A better solution would be to identify the corresponding FSUIPC offset and inject the value (eg. HDG) suitably scaled from within your modified function. You need to find the FSUIPC Offsets Document with lists all the offsets, their size in bytes and the scaling, You can use the LINDA Tracer to monitor the offset and directly input values. You would to use functions like ipc.writeUW().

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

  • Author

Thanks! I am going to give it a go - but this might be above my knowledge level for now. This would be 'nice' functionality for me but not required...

Clark

  • 3 weeks later...
  • Author

I wanted to quickly reply that I figured this out! below is the code i used! I read the NGX heading from the lvar and stored it under FSX_HDG (for lack of a better name), then I write that number straight back to FSX 🙂

function NGX_AP_HDG_inc ()
    if mcp_hdg_mode == 1 then
        ipc.control(PMDGBaseVar+390, PMDG_inc)
        ipc.sleep(20)
    else
        NGX_AP_BANK_inc ()
    end
    fsx_hdg = ipc.readLvar("L:ngx_HDGwindow")
    ipc.control(66042,fsx_hdg)
    NGX_AP_HDG_show ()
end

Hehe, well done Clark. “Winning!”

Luke Pype

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.