Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Guys, please help me out with 2 small lua files for VS Inc and VS Dec functions of FCU. I've collected most of the lua files needed to control principal FCU buttons and rotaries from the past discussions of Pete, guenseli and Kaptejnln. Luckily most of the examples of short single Luas made by Kaptejnln work just fine in AXExtended and I use them to control buttons and rotaries on FCU via FSUIPC. But for the life of me I can not figure out lua scripts for VS Increase and VS decrease, and actually VS is the last function that I need to map to my GoFlight modules. I'd greatly appreciate somebody posted the required text for the 2 luas here.

Much thanks,

Dirk.

Posted

Here you go, Dirk:


-- VS/FPA switch button
function switchHDGTRK (joynum, button, downup)
ipc.writeLvar( "L:AB_AP_HDGTRK", 1 - ipc.readLvar("L:AB_AP_HDGTRK") )
ipc.writeLvar( "L:SmallOverheadPushButtons", 1 )
end

-- VS/FPA Inc
function incFPAorVS ( joynum, button, downup )
if ipc.readLvar("L:AB_AP_HDGTRK") == 1 then -- 1 = TRK/FPA

local lFPA = ipc.readLvar( "L:AB_AP_FPA_Select2" ) + 0.1
if lFPA > 9.9 then
lFPA = 9.9
end
ipc.writeLvar( "L:AB_AP_FPA_Select2", lFPA )

else -- 0 = HDG/SPD so set VS

local lVS = ipc.readLvar( "L:AB_AP_VS_Select2" ) + 1
if lVS > 60 then
lVS = 60
end
ipc.writeLvar( "L:AB_AP_VS_Select2", lVS )

end

end

-- VS/FPA Dec
function decFPAorVS ( joynum, button, downup )
if ipc.readLvar("L:AB_AP_HDGTRK") == 1 then -- 1 = TRK/FPA

local lFPA = ipc.readLvar( "L:AB_AP_FPA_Select2" ) - 0.1
if lFPA < -9.9 then
lFPA = -9.9
end
ipc.writeLvar( "L:AB_AP_FPA_Select2", lFPA )

else -- 0 = HDG/SPD so set VS

local lVS = ipc.readLvar( "L:AB_AP_VS_Select2" ) - 1
if lVS < -60 then
lVS = -60
end
ipc.writeLvar( "L:AB_AP_VS_Select2", lVS )

end

end


-- VS/FPA Level
function levFPAorVS ( joynum, button, downup )
if ipc.readLvar("L:AB_AP_HDGTRK") == 1 then

ipc.writeLvar( "L:AB_AP_FPA_Select2", 0 )

else

ipc.writeLvar( "L:AB_AP_VS_Select2", 0 )

end

end


-- register the buttons of your joystick triggering the functions
-- replace joyletter by the actual used letter/number, also replace buttonX by the actual value
event.button("joyletter", button1, 1, "incFPAorVS")
event.button("joyletter", button2, 1, "decFPAorVS")
event.button("joyletter", button3, 1, "switchHDGTRK")
event.button("joyletter", button4, 1, "levFPAorV")[/CODE]

[color=#666600]Cheers,[/color]

[color=#666600]Dirk [/color] :D

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.