My solution to control all the Latécoère (6) and the “Dornier Do X” (12) engines with a 4 throttle controller.
I defined the 4 lever axes in FSUIPC7 and then put the following modified script into the fsuipc7.exe folder.
Create and use an MSFS controller config with the throttles removed for the Latecoere and Dornier X.
Many thanks to the person who sent me the original code. Note: the script doesn’t work with the Hercules for some reason, I use SPAD.neXt for the Hercules.
– +++++++++++++++++++
– File Throttle.lua
– Put this file to the FSUIPC folder that contains the FSUIPC.ini file
– Add the file name to the [AUTO] section of the .ini file like this
-- [AUTO]
-- 1=lua throttle
-- or (make sure numbering is consistent if the AUTO section already has entries)
-- [AUTO]
-- 1=lua xyz1
-- 2=lua xyz2
-- 3=lua throttle
--variable definitions
local user_aircraft_type = “” – holds name of user aircraft in sim
local number_of_engines = “” – how many engines on the current aircraft
local calc_code = “” – string to hold RPN code
local combine_throttles = 0 – 0 = no, 1 = yes
local My_Aircraft_Type = 0 – Number assigned to a recognised aircraft
--this is called whenever new aircraft is loaded in the sim
function aircraft_changed(offset, uat)
user_aircraft_type = ipc.readSTR(0x3D00, 256)
number_of_engines = ipc.readUW(0x0AEC)
ipc.log(“in change_aircraft_name = <”…offset…" “…user_aircraft_type…”>“)
ipc.log(“Number of engines = <”…offset…” “…number_of_engines…”>")
if string.find(user_aircraft_type,"Latecoere") then -- Is this a recognised aircraft
My_Aircraft_Type = 1
elseif string.find(user_aircraft_type,"Dornier Do X") then
My_Aircraft_Type = 2
else
My_Aircraft_Type = 0
os.exit() -- Not a recognised aircraft, so stop the script.
end
end
--this is called when Thrustlever 1 changes
function throttle_lever_1(offset, value)
if My_Aircraft_Type == 1 then
value = ((value + 16384) / 32767.0) * 100.0 -- squeeze value to 0-100
value = value > 99.0 and 100 or value < 1.0 and 0 or value
calc_code = value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:1, Percent) " .. -- throttle 1
value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:2, Percent) " -- throttle 2
ipc.execCalcCode(calc_code)
elseif My_Aircraft_Type == 2 then
value = ((value + 16384) / 32767.0) * 100.0 -- squeeze value to 0-100
value = value > 99.0 and 100 or value < 1.0 and 0 or value
calc_code = value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:1, Percent) " .. -- throttle 1
value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:2, Percent) " .. -- throttle 2
value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:3, Percent) " -- throttle 3
ipc.execCalcCode(calc_code)
end
end
--this is called when Thrustlever 2 changes
function throttle_lever_2(offset, value)
if My_Aircraft_Type == 1 then
value = ((value + 16384) / 32767.0) * 100.0 – squeeze value to 0-100
value = value > 99.0 and 100 or value < 1.0 and 0 or value
calc_code = value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:3, Percent) " – throttle 3
ipc.execCalcCode(calc_code)
elseif My_Aircraft_Type == 2 then
value = ((value + 16384) / 32767.0) * 100.0 – squeeze value to 0-100
value = value > 99.0 and 100 or value < 1.0 and 0 or value
calc_code = value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:4, Percent) " … – throttle 4
value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:5, Percent) " … – throttle 5
value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:6, Percent) " – throttle 6
ipc.execCalcCode(calc_code)
end
end
--this is called when Thrustlever 3 changes
function throttle_lever_3(offset, value)
if My_Aircraft_Type == 1 then
value = ((value + 16384) / 32767.0) * 100.0 – squeeze value to 0-100
value = value > 99.0 and 100 or value < 1.0 and 0 or value
calc_code = value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:4, Percent) " – throttle 4
ipc.execCalcCode(calc_code)
elseif My_Aircraft_Type == 2 then
value = ((value + 16384) / 32767.0) * 100.0 – squeeze value to 0-100
value = value > 99.0 and 100 or value < 1.0 and 0 or value
calc_code = value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:7, Percent) " … – throttle 7
value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:8, Percent) " … – throttle 8
value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:9, Percent) " – throttle 9
ipc.execCalcCode(calc_code)
end
end
--this is called when Thrustlever 4 changes
function throttle_lever_4(offset, value)
if My_Aircraft_Type == 1 then
value = ((value + 16384) / 32767.0) * 100.0 – squeeze value to 0-100
value = value > 99.0 and 100 or value < 1.0 and 0 or value
calc_code = value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:5, Percent) " … – throttle 5
value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:6, Percent) " – throttle 6
ipc.execCalcCode(calc_code)
elseif My_Aircraft_Type == 2 then
value = ((value + 16384) / 32767.0) * 100.0 – squeeze value to 0-100
value = value > 99.0 and 100 or value < 1.0 and 0 or value
calc_code = value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:10, Percent) " … – throttle 10
value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:11, Percent) " … – throttle 11
value … " (>A:GENERAL ENG THROTTLE LEVER POSITION:12, Percent) " – throttle 12
ipc.execCalcCode(calc_code)
end
end
--callbacks
event.offset (0x3D00, “STR”, 64, “aircraft_changed”)
event.offset (0x25F0, “SW”, “throttle_lever_1”)
event.offset (0x25F2, “SW”, “throttle_lever_2”)
event.offset (0x25F4, “SW”, “throttle_lever_3”)
event.offset (0x25F6, “SW”, “throttle_lever_4”)
– +++++++++++++++++++++