dazz Posted June 28, 2022 Report Posted June 28, 2022 Hi there, long time no see! Hope you're doing great, Pete. So I'm planning to go back to doing some flight simming after a long hiatus. Got some new gear and I'm in the process of configuring everything in FSUIPC/LINDA. I have a Lua script to map the flaps, spoilers and gear lever to a single axis using ranges. The idea is to push the lever all the way up/down to retract/deploy the gear, while a smaller input to the lever increments or decrements the flaps. Then I use the global shift utility in LINDA to duplicate that for the spoilers. I have a Lua script to take care of all that called lindaDefault.lua, which works well for aircrafts that use default controls for the gear, flaps and spoilers. The plan is to then use specific scripts for planes that require some custom logic for some or all the controls. These scripts execute a require('lindaDefault') so that they have access to all the default functions there, and then I can (hopefully) override the functions that are needed to make the script work for that specific plane. For example, the NGX uses different controls for the spoilers, so I would be overrinding those functions while using the default ones for the flaps and gear. This is a snippet of lindaDefault.lua, containing one of the functions - spoilersDeploy() - that are meant to be overriden if necessary. [code] ------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------- OVERRIDABLE FUNCTIONS --------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- function spoilersDeploy() ipc.control(66064) -- Spoilers Deploy end ------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- function AXIS_GEAR_SPOILERS_100() if SHIFT_GLOB == 0 then ipc.control(66080) -- Gear down else spoilersDeploy() end ipc.set('LEVER_MAXED_OUT', true) end FUNCTIONS = { [1] = AXIS_PARKINGBRAKES_SPOILERS_OFF, [2] = AXIS_PARKINGBRAKES_SPOILERS_ON_ARM, [3] = VOID, [4] = AXIS_FLAPS_SPOILERS_DEC, [5] = AXIS_FLAPS_SPOILERS_INC, [6] = AXIS_GEAR_SPOILERS_0, [7] = AXIS_GEAR_SPOILERS_100, } func = FUNCTIONS[f] if (func) then func() else ipc.log('nope, no function here to be called') end [/code] Then I have this lindaNGX.lua that's supposed to override the spoiler functions like this: [code] require('lindaDefault') ------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------- OVERRIDABLE FUNCTIONS --------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- function spoilersDeploy() ipc.control(86637, 16384) -- Spoilers Deploy end function spoilersRetract() ipc.control(86637, -16384) -- Spoilers Retract end function spoilersArm() ipc.control(86637, -13100) -- Spoilers Arm end function spoilersDisarm() spoilersRetract() end ------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- [/code] This is not working. The functions in lindaDefault.lua are the ones being called. Any ideas, please? Thanks in advance.
dazz Posted June 28, 2022 Author Report Posted June 28, 2022 Nevermind. I figured it out. All I needed to do is to ensure that the code was loaded and executed in the right order.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now