Jump to content
Sign in to follow this  
fayeliang

Can i setup 1 switch toggle 2 functions in LINDA

Recommended Posts

for example,i put a switch from postion up to down on my warthog throttle,in NGXu,both air condition pack can trun on or trun off at the same time.

in default situation,1 switch can mapping 1 function only.how to 1 switch maping 2 functions?

sorry for my poor english.i hope someone can understand me:)

Share this post


Link to post
Share on other sites

You can easily combine 2 or more existing functions into one. In the aircraft folder (/linda/aircrafts/pmdg 737NGXu) you will find a actions.lua and a user.lua file. You need to edit the user.lua. You can do this by loading the aircraft and clicking Edit next to the aircraft selector. Then click Edit User button.

I recommend you first study the existing module code in actions.lua. This can be opened by clicking Edit Actions in the Edit Aircraft Module page. Search for NGX_PACK. You will see several functions relating to the left and right packs. You do not need to understand the internal operation, just note the function names. LUA treats all function names as case sensitive - they must be written as is.

Add following code to user.lua:

function NGX_PACK_both_high()

      NGX_PACK_L_high()

      NGX_PACK_R_high()

end

function NGX_PACK_both_off()

      NGX_PACK_L_off()

      NGX_PACK_R_off()

end

function NGX_PACK_both_toggle()     

NGX_PACK_both_high()

      If ipc.readLvar('switch_200_73X')  ~= 100 then

              NGX_both_high()

      else

             NGX_PACK_both_off()

      end

end

After saving the modified user.lua you can test your new functions by right-clicking on the function name in the LINDA Editor.

I hope this is understandable.

Edited by ScotFlieger

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

Share this post


Link to post
Share on other sites
On 10/28/2020 at 7:40 PM, ScotFlieger said:

You can easily combine 2 or more existing functions into one. In the aircraft folder (/linda/aircrafts/pmdg 737NGXu) you will find a actions.lua and a user.lua file. You need to edit the user.lua. You can do this by loading the aircraft and clicking Edit next to the aircraft selector. Then click Edit User button.

I recommend you first study the existing module code in actions.lua. This can be opened by clicking Edit Actions in the Edit Aircraft Module page. Search for NGX_PACK. You will see several functions relating to the left and right packs. You do not need to understand the internal operation, just note the function names. LUA treats all function names as case sensitive - they must be written as is.

Add following code to user.lua:

function NGX_PACK_both_high()

      NGX_PACK_L_high()

      NGX_PACK_R_high()

end

function NGX_PACK_both_off()

      NGX_PACK_L_off()

      NGX_PACK_R_off()

end

function NGX_PACK_both_toggle()     

NGX_PACK_both_high()

      If ipc.readLvar('switch_200_73X')  ~= 100 then

              NGX_both_high()

      else

             NGX_PACK_both_off()

      end

end

After saving the modified user.lua you can test your new functions by right-clicking on the function name in the LINDA Editor.

I hope this is understandable.

thanks for your reply.i follow your word to edit my user.lua.it is worked perfectly.

i try to study actions.lua,but it is too difficult for me.i found a lot of functions,most of them is "ON,OFF,TOGGLE".i can understand what they mean.but another one is "SHOW",i set one switch to NGX_PACK_L_show,but when i operate the switch,it does not any change in my P3D.what does the "SHOW" means?when do i use the "SHOW" function?

Share this post


Link to post
Share on other sites

With LINDA modules we try to use standard naming for most operations if possible. What the code in each function does can be ignored by most users.

These are the self-explanatory _on, _off and _toggle together with _high, _low, etc where there are specific switch/knob positions.

Other relate to LINDA original aim of supporting the VRInsight Combo panels. These _inc, _incfast, _dec and _decfast for the way the Combo knobs are actioned and _show to give information on the panel display.

 


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

Share this post


Link to post
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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...