Bonsoir,
La dernière version du plugin était faite pour XP10.50/51 mais ne fonctionne pas avec XP11. Sur le .org, un simeur à donné une solution mais je suis incapable de la mettre en oeuvre car je n'en comprend pas le sens !!
il s'agit d'un fichier "parametres de config" qui s'ouvre en .txt. Il ressemble à une programmation, mais hélas je ne suis pas informaticien !!
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- --
-- -- D '' T D II T !! -- --
-- -- D '' T EE D T !! -- --
-- -- DDD OO N NN TTT E E DDD II TTT !! -- --
-- -- D D O O NN N T EEE D D I T !! -- --
-- -- D D O O N N T E D D I T -- --
-- -- DDD OO N N TT EEE DDD I TT !! -- --
-- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- SaveInitialAssignments.ini version 2.1.26 build 2013-03-20
function save_initial_assignments()
-- first we have to open a textfile for writing
local textfile
if SYSTEM == "IBM" then
textfile = io.open("Resources\\plugins\\FlyWithLua\\initial_a ssignments.txt", "w")
else
textfile = io.open("Resources/plugins/FlyWithLua/initial_assignments.txt", "w")
-- else
-- textfile = io.open("Resources:plugins:FlyWithLua:initial_assi gnments.txt", "w")
end
-- now we can read and write the axis assignments, the code is taken from the old 1.x script
-- X-Plane only stores an integer to represent the function, we use a table to give it a name
local axis_functions = { "pitch", "roll", "yaw", "throttle", "collective", "left toe brake", "right toe brake", "prop",
"mixture", "carb heat", "flaps", "thrust vector", "wing sweep", "speedbrakes", "displacement",
"reverse", "elev trim", "ailn trim", "rudd trim", "throttle 1", "throttle 2", "throttle 3",
"throttle 4", "prop 1", "prop 2", "prop 3", "prop 4", "mixture 1", "mixture 2",
"mixture 3", "mixture 4", "reverse 1", "reverse 2", "reverse 3", "reverse 4", "landing gear",
"nosewheel tiller", "backup throttle", "auto roll", "auto pitch", "view left/right", "view up/down", "view zoom",
"camera left/right", "camera up/down", "camera zoom", "gun/bomb left/right", "gun/bomb up/down" }
-- now we can write the axis config to the Log.txt file
textfile:write("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n")
textfile:write("-- -- FlyWithLua: The initial assignments are stored in this file. -- --\n")
textfile:write("-- -- 8< -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n\n")
textfile:write("clear_all_axis_assignments()\n")
-- make the variables local to keep Lua clean
local i
local axis_function_index
local axis_reverse
-- look into all 100 axis
for i = 0, 99 do
-- pull the index to the function name from X-Plane
axis_function_index = get( "sim/joystick/joystick_axis_assignments", i )
-- pull the reverse info from X-Plane
-- the value is 0, if the axis is normal, but is the number of the axis, if the axis is reverse
if get( "sim/joystick/joystick_axis_reverse", i ) > 0 then
axis_reverse = "reverse"
else
axis_reverse = "normal"
end
-- we do not need to kill axis twice, this was already done by clear_all_axis_assignments()
if axis_function_index > 0 then
textfile:write( "set_axis_assignment( " .. i .. ', "' .. axis_functions[axis_function_index] .. '", "' .. axis_reverse .. '" )\n' )
end
end
-- now we will write the button assignments
textfile:write("\nclear_all_button_assignments()\n ")
-- read the information from X-Plane's own settings
local xplanefile
if SYSTEM == "IBM" then
xplanefile = io.open("Output\\preferences\\X-Plane Joystick Settings.prf", "r")
else
xplanefile = io.open("Output/preferences/X-Plane Joystick Settings.prf", "r")
-- else
-- xplanefile = io.open("Output:preferences:X-Plane.prf", "r")
end
local number
local sticknumber
local stickindex
local commandstring
local linestring
-- find the last axis assignments (the next line defines the first button assignment
repeat
linestring = xplanefile:read()
until linestring:find("_joy_AXIS_use249 ") ~= nil
for i = 0, 1599, 1 do
-- the text "_joy_BUTN_use" has a length of 13 character, we will jump over them
xplanefile:read(13)
-- read the number, skip the space and read the commandstring
number = xplanefile:read("*n")
xplanefile:read(1)
commandstring = xplanefile:read()
-- reformat the number to (n*40) + i
sticknumber = math.floor(number / 40)
stickindex = number - (sticknumber*40)
-- check if it is useful and write it to the config textfile
if commandstring ~= "sim/none/none" then
textfile:write("set_button_assignment( (" .. sticknumber .. '*40) + ' .. stickindex .. ', "' .. commandstring .. '" )\n')
end
end
-- some DataRefs who should be set too
textfile:write("\n-- setting nullzone, sensitivity and augment\n")
textfile:write(string.format('set( "sim/joystick/joystick_pitch_nullzone", %1.3f )\n', get("sim/joystick/joystick_pitch_nullzone")))
textfile:write(string.format('set( "sim/joystick/joystick_roll_nullzone", %1.3f )\n', get("sim/joystick/joystick_roll_nullzone")))
textfile:write(string.format('set( "sim/joystick/joystick_heading_nullzone", %1.3f )\n', get("sim/joystick/joystick_heading_nullzone")))
textfile:write(string.format('set( "sim/joystick/joystick_pitch_sensitivity", %1.3f )\n', get("sim/joystick/joystick_pitch_sensitivity")))
textfile:write(string.format('set( "sim/joystick/joystick_roll_sensitivity", %1.3f )\n', get("sim/joystick/joystick_roll_sensitivity")))
textfile:write(string.format('set( "sim/joystick/joystick_heading_sensitivity", %1.3f )\n', get("sim/joystick/joystick_heading_sensitivity")))
textfile:write(string.format('set( "sim/joystick/joystick_pitch_augment", %1.3f )\n', get("sim/joystick/joystick_pitch_augment")))
textfile:write(string.format('set( "sim/joystick/joystick_roll_augment", %1.3f )\n', get("sim/joystick/joystick_roll_augment")))
textfile:write(string.format('set( "sim/joystick/joystick_heading_augment", %1.3f )\n', get("sim/joystick/joystick_heading_augment")))
-- finish
textfile:write("\n-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >8 -- --\n\n")
textfile:write(string.format('-- PLANE_ICAO == "%s"\n', PLANE_ICAO))
textfile:write(string.format('-- PLANE_TAILNUMBER == "%s"\n', PLANE_TAILNUMBER))
textfile:write(string.format('-- AIRCRAFT_FILENAME == "%s"\n', AIRCRAFT_FILENAME))
textfile:close()
xplanefile:close()
end
save_initial_assignments()
La dernière version du plugin était faite pour XP10.50/51 mais ne fonctionne pas avec XP11. Sur le .org, un simeur à donné une solution mais je suis incapable de la mettre en oeuvre car je n'en comprend pas le sens !!
il s'agit d'un fichier "parametres de config" qui s'ouvre en .txt. Il ressemble à une programmation, mais hélas je ne suis pas informaticien !! -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- --
-- -- D '' T D II T !! -- --
-- -- D '' T EE D T !! -- --
-- -- DDD OO N NN TTT E E DDD II TTT !! -- --
-- -- D D O O NN N T EEE D D I T !! -- --
-- -- D D O O N N T E D D I T -- --
-- -- DDD OO N N TT EEE DDD I TT !! -- --
-- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- SaveInitialAssignments.ini version 2.1.26 build 2013-03-20
function save_initial_assignments()
-- first we have to open a textfile for writing
local textfile
if SYSTEM == "IBM" then
textfile = io.open("Resources\\plugins\\FlyWithLua\\initial_a ssignments.txt", "w")
else
textfile = io.open("Resources/plugins/FlyWithLua/initial_assignments.txt", "w")
-- else
-- textfile = io.open("Resources:plugins:FlyWithLua:initial_assi gnments.txt", "w")
end
-- now we can read and write the axis assignments, the code is taken from the old 1.x script
-- X-Plane only stores an integer to represent the function, we use a table to give it a name
local axis_functions = { "pitch", "roll", "yaw", "throttle", "collective", "left toe brake", "right toe brake", "prop",
"mixture", "carb heat", "flaps", "thrust vector", "wing sweep", "speedbrakes", "displacement",
"reverse", "elev trim", "ailn trim", "rudd trim", "throttle 1", "throttle 2", "throttle 3",
"throttle 4", "prop 1", "prop 2", "prop 3", "prop 4", "mixture 1", "mixture 2",
"mixture 3", "mixture 4", "reverse 1", "reverse 2", "reverse 3", "reverse 4", "landing gear",
"nosewheel tiller", "backup throttle", "auto roll", "auto pitch", "view left/right", "view up/down", "view zoom",
"camera left/right", "camera up/down", "camera zoom", "gun/bomb left/right", "gun/bomb up/down" }
-- now we can write the axis config to the Log.txt file
textfile:write("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n")
textfile:write("-- -- FlyWithLua: The initial assignments are stored in this file. -- --\n")
textfile:write("-- -- 8< -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n\n")
textfile:write("clear_all_axis_assignments()\n")
-- make the variables local to keep Lua clean
local i
local axis_function_index
local axis_reverse
-- look into all 100 axis
for i = 0, 99 do
-- pull the index to the function name from X-Plane
axis_function_index = get( "sim/joystick/joystick_axis_assignments", i )
-- pull the reverse info from X-Plane
-- the value is 0, if the axis is normal, but is the number of the axis, if the axis is reverse
if get( "sim/joystick/joystick_axis_reverse", i ) > 0 then
axis_reverse = "reverse"
else
axis_reverse = "normal"
end
-- we do not need to kill axis twice, this was already done by clear_all_axis_assignments()
if axis_function_index > 0 then
textfile:write( "set_axis_assignment( " .. i .. ', "' .. axis_functions[axis_function_index] .. '", "' .. axis_reverse .. '" )\n' )
end
end
-- now we will write the button assignments
textfile:write("\nclear_all_button_assignments()\n ")
-- read the information from X-Plane's own settings
local xplanefile
if SYSTEM == "IBM" then
xplanefile = io.open("Output\\preferences\\X-Plane Joystick Settings.prf", "r")
else
xplanefile = io.open("Output/preferences/X-Plane Joystick Settings.prf", "r")
-- else
-- xplanefile = io.open("Output:preferences:X-Plane.prf", "r")
end
local number
local sticknumber
local stickindex
local commandstring
local linestring
-- find the last axis assignments (the next line defines the first button assignment
repeat
linestring = xplanefile:read()
until linestring:find("_joy_AXIS_use249 ") ~= nil
for i = 0, 1599, 1 do
-- the text "_joy_BUTN_use" has a length of 13 character, we will jump over them
xplanefile:read(13)
-- read the number, skip the space and read the commandstring
number = xplanefile:read("*n")
xplanefile:read(1)
commandstring = xplanefile:read()
-- reformat the number to (n*40) + i
sticknumber = math.floor(number / 40)
stickindex = number - (sticknumber*40)
-- check if it is useful and write it to the config textfile
if commandstring ~= "sim/none/none" then
textfile:write("set_button_assignment( (" .. sticknumber .. '*40) + ' .. stickindex .. ', "' .. commandstring .. '" )\n')
end
end
-- some DataRefs who should be set too
textfile:write("\n-- setting nullzone, sensitivity and augment\n")
textfile:write(string.format('set( "sim/joystick/joystick_pitch_nullzone", %1.3f )\n', get("sim/joystick/joystick_pitch_nullzone")))
textfile:write(string.format('set( "sim/joystick/joystick_roll_nullzone", %1.3f )\n', get("sim/joystick/joystick_roll_nullzone")))
textfile:write(string.format('set( "sim/joystick/joystick_heading_nullzone", %1.3f )\n', get("sim/joystick/joystick_heading_nullzone")))
textfile:write(string.format('set( "sim/joystick/joystick_pitch_sensitivity", %1.3f )\n', get("sim/joystick/joystick_pitch_sensitivity")))
textfile:write(string.format('set( "sim/joystick/joystick_roll_sensitivity", %1.3f )\n', get("sim/joystick/joystick_roll_sensitivity")))
textfile:write(string.format('set( "sim/joystick/joystick_heading_sensitivity", %1.3f )\n', get("sim/joystick/joystick_heading_sensitivity")))
textfile:write(string.format('set( "sim/joystick/joystick_pitch_augment", %1.3f )\n', get("sim/joystick/joystick_pitch_augment")))
textfile:write(string.format('set( "sim/joystick/joystick_roll_augment", %1.3f )\n', get("sim/joystick/joystick_roll_augment")))
textfile:write(string.format('set( "sim/joystick/joystick_heading_augment", %1.3f )\n', get("sim/joystick/joystick_heading_augment")))
-- finish
textfile:write("\n-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >8 -- --\n\n")
textfile:write(string.format('-- PLANE_ICAO == "%s"\n', PLANE_ICAO))
textfile:write(string.format('-- PLANE_TAILNUMBER == "%s"\n', PLANE_TAILNUMBER))
textfile:write(string.format('-- AIRCRAFT_FILENAME == "%s"\n', AIRCRAFT_FILENAME))
textfile:close()
xplanefile:close()
end
save_initial_assignments()
"
Commentaire