Je te met le code en entier. Tu feras le tri avec les différentes images selon l'heure du jour.
- Code: Tout sélectionner
-- Only for DHC6 Twin Otter Extended by Aerosoft --
-- Fuel Quantity FWD Gauge Version 2 --
-- By Christian R (arcc) --
-- Global variables --
local gbl_target_fuel = 0
local gbl_cur_fuel = 0
local gbl_factor = 0.20
-- Set the maximum fuel quantity (full) in gallons here:
local gbl_max_fuel = 184.1
--Images--
img_add_fullscreen("fuel_center_backdrop_day.png")
img_needle = img_add("neddle.png",0,0,256,256)
mask_day = img_add_fullscreen("mask_day.png")
mask_light = img_add_fullscreen("mask_light.png")
mask_night = img_add_fullscreen("mask_night.png")
mask_dusk = img_add_fullscreen("mask_dusk.png")
--choix d'image en fontion de l'eclairage--
function new_light_FSX(light,ambiance,master)
lighted=light and master
img_visible(mask_light, lighted)
img_visible(mask_night, lighted == false and ambiance== 3)
img_visible(mask_dusk, lighted == false and ambiance== 2)
img_visible(mask_day, ambiance == 1)
end
-- Function for Fuel Quantity --
function new_fuel_fsx(gallons_center, battery, fueltest)
-- Convert weight in KG to gallons with 2.73KG / gallon
gallons = gallons_center
if battery == true then
if fueltest == false then
gbl_target_fuel = var_cap(gallons, 0, gbl_max_fuel)
else
gbl_target_fuel = 0
end
else
gbl_target_fuel = 0
end
end
-- Slowly move needle to current amount of fuel --
function timer_callback()
-- Rotate needle image
img_rotate(img_needle, (277 / gbl_max_fuel * gbl_cur_fuel) -160)
-- Calculate the current fuel position
gbl_cur_fuel = gbl_cur_fuel + ((gbl_target_fuel - gbl_cur_fuel) * gbl_factor)
end
--Images--
img_add_fullscreen("glass.png") -- Without glass insert two - at the beginning of the line
-- FSX Variables --
fsx_variable_subscribe("FUEL TANK CENTER QUANTITY", "Gallons",
"ELECTRICAL MASTER BATTERY", "Bool",
"SPOILERS ARMED", "Bool", new_fuel_fsx) -- FSX Variables for test quantity
fsx_variable_subscribe("LIGHT PANEL","Bool",
"TIME OF DAY", "Enum",
"ELECTRICAL MASTER BATTERY", "Bool", new_light_FSX) -- FSX Variables night light
-- Timers --
tmr_update = timer_start(0, 50, timer_callback)
A+
Christian