Jump to content
The simFlight Network Forums

How to use a LUA file with multiple functions to assign keys in FSUIPC?


waqar_mw

Recommended Posts

Hi, 

Can someone please guide me as I am not able to use the lua file with multiple functions in FSUIPC. I am unsure if this is even possible to do, basically what I am trying to do is use someone's lua file for the PMDG737 and use certain functions from that lua file in FSUIPC for example how do I assign "PMDG_GLSD_EFIS_NAV1_cycle" function to a key on my keyboard. 

 

Do I have to create multiple lua files with each function? or can I just use one lua file and assign different functions to different keys. I am sorry if this has been asked before I tried looking it up but couldn't find an example.

 

Thanks.

FSUIPC7.ini PMDG737.lua

Link to comment
Share on other sites

7 minutes ago, waqar_mw said:

Can someone please guide me as I am not able to use the lua file with multiple functions in FSUIPC.

Please see the provided document FSUIPC Lua Plugins.pdf. You cannot assign to a specific lua function, only to one of the provided lua controls (from that document):

The controls added for each Lua
program are:
Lua <name>       to run the named program
LuaDebug <name>  to run the program in debug mode (more below)
                 Ths is actually superseded by the Trace Lua option in FSUIPC4’s Logging Tab.
LuaKill <name>   to forcibly terminate the named program, if it is running
LuaSet <name>    to set a flag (0-255 according to parameter) specifically for the named program to test
LuaClear <name>  to clear a flag (0-255 according to parameter) specifically for the named program to test
LuaToggle <name> to toggle a flag (0-255 according to parameter) specifically for the named program to test
LuaValue <name>  to set the ipcPARAM variable to the given parameter, or the axis value when so assig

 

17 minutes ago, waqar_mw said:

what I am trying to do is use someone's lua file for the PMDG737 and use certain functions from that lua file in FSUIPC

You can extract what you need - but you really need to understand what you are doing of you do this.
However, there are easier methods.

20 minutes ago, waqar_mw said:

how do I assign "PMDG_GLSD_EFIS_NAV1_cycle"

There are custom controls available which allow you to either set the EFIS NAV1 mode directly or to inc/dec the current mode:

Quote

#define    EVT_EFIS_CPT_VOR_ADF_SELECTOR_L                    (THIRD_PARTY_EVENT_ID_MIN + 358)    

You can either use the Rotor Brake control with an appropriate parameter (mouse action) to use this: see 

 

Or a custom control number: see 

 

If you want  a single key to cycle through the modes, then you will also have to handle the move from vor to adf To do this, you need to add the lvar L:switch_358_73X to an fsuipc offset, overload your key assignment to also use the preset PPMDG_B737_EFIS_L_VOR_ADF_ADF1 and then add an offset condition to send the rotor brake/custom control with a left mouse-click parameter when the switch is in the off or adf position, and to send the preset PMDG B737 EFIS L VOR/ADF OFF when in the vor position. where the current position is indicated by the value of that lvar held in an FSUIPC offset. In fact, maybe better to just use the presets and overload the key with 3 assignments, one for each value of the offset/switch position.  So, first add the lvar to an offset, by adding the following to your FSUIPC7.ini file:

Quote

[LvarOffsets.xxx]
1=L:switch_358_73X=UB0xA000

where xxx is your profile name (or just use [LvarOffsets] if not using profiles). This adds the switch position to offset 0XA000 - you can change this if already using that (free for user assignment) offset, Then, your key assignments will look something like the following - here I have assigned to the M key:

Quote

2=BA000=0 77,8,PPMDG_B737_EFIS_L_VOR_ADF_ADF1,0     -{M: Press=Preset Control }-
3=BA000=100 77,8,PPMDG_B737_EFIS_L_VOR_ADF_OFF,0     -{M: Press=Preset Control }-
4=BA000=50 77,8,PPMDG_B737_EFIS_L_VOR_ADF_VOR1,0     -{M: Press=Preset Control }-

So, when the offset is 0, the switch is in the VOR1 position and the keypress will send the preset PMDG_B737_EFIS_L_VOR_ADF_ADF1 which will move the switch to the ADF1 position. When the offset is 100, the switch is in the ADF1 position and the keypress will send the preset PMDG_B737_EFIS_L_VOR_ADF_OFF which will move the switch to the OFF position. And when the offset is 50, the switch is in the OFF position and the keypress will send the preset PMDG_B737_EFIS_L_VOR_ADF_VOR1 which will move the switch to the VOR1 position,

John

Link to comment
Share on other sites

Hi John, First of all I would like to thank you for your detailed response. I will try to program the switches as you have recommended in your reply and if I have any doubts I will ask further questions but I think I understand now how to program all the functions I need to my X56 HOTAS. Thank you.

Link to comment
Share on other sites

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.