PERSONALIZANDO ATALHOS COM DATAREFS NO X-PLANE 11
Hoje vamos aprender a acionar vários botões programaticamente no X-plane usando os Datarefs.
Para instalar os plugins e entender como tudo funciona assista ao vídeo
Plugin do Dataref Editor no Github
Copie esse texto abaixo e cole eu seu editor de texto preferido:
-- Check if we're in the B738 aircraft, you can have multiple of these for different aircraf inside a single script
if (PLANE_ICAO == "B738") then
-- Create a callback function that we will call with our button
--comandos que ligam
-- Brightness Up
function bright_up()
set_array("laminar/B738/electric/panel_brightness", 0, 1) --Captain Main Painel Brightness
set_array("laminar/B738/electric/panel_brightness", 1, 1) --First Officer Painel Brightness
set_array("laminar/B738/electric/panel_brightness", 2, 1) --Overhead Painel Brightness
set_array("laminar/B738/electric/panel_brightness", 3, 1) --Pedestal Panel Brightness
set_array("laminar/B738/electric/instrument_brightness",0,1) --Captain Otbd DU Brightness
set_array("laminar/B738/electric/instrument_brightness",1,1) --First Officer Otbd DU Brightness
set_array("laminar/B738/electric/instrument_brightness",2,1) --Captain Indb DU Brightness
set_array("laminar/B738/electric/instrument_brightness",3,1) --First Officer Inbd DU Brightness
set_array("laminar/B738/electric/instrument_brightness",4,1) --Upper DU Brightness
set_array("laminar/B738/electric/instrument_brightness",5,1) --Lower DU Brightness
set_array("sim/cockpit2/switches/generic_lights_switch",6,1) --Forward Panel Flood
set_array("sim/cockpit2/switches/generic_lights_switch",7,1) --Glareshiel Flood
set_array("sim/cockpit2/switches/generic_lights_switch",8,1) --Pedestal Flood
set_array("sim/cockpit2/switches/generic_lights_switch",10,1) --Luzes do Overhead Left
set_array("sim/cockpit2/switches/generic_lights_switch",11,1) --Luzes do Overhead Right
set_array("sim/cockpit2/switches/generic_lights_switch",12,1) --Circuit Breaker Flood
command_once("laminar/B738/toggle_switch/cockpit_dome_dn")
return
end
create_command("FlyWithLua/Zibo/Bright_up", "Bright_Up", "bright_up()","","")
--comandos que desligam
-- Brightness Down
function bright_dn()
set_array("laminar/B738/electric/panel_brightness", 0, 0) --Captain Main Painel Brightness
set_array("laminar/B738/electric/panel_brightness", 1, 0) --First Officer Painel Brightness
set_array("laminar/B738/electric/panel_brightness", 2, 0) --Overhead Painel Brightness
set_array("laminar/B738/electric/panel_brightness", 3, 0) --Pedestal Panel Brightness
set_array("laminar/B738/electric/instrument_brightness",0,0) --Captain Otbd DU Brightness
set_array("laminar/B738/electric/instrument_brightness",1,0) --First Officer Otbd DU Brightness
set_array("laminar/B738/electric/instrument_brightness",2,0) --Captain Indb DU Brightness
set_array("laminar/B738/electric/instrument_brightness",3,0) --First Officer Inbd DU Brightness
set_array("laminar/B738/electric/instrument_brightness",4,0) --Upper DU Brightness
set_array("laminar/B738/electric/instrument_brightness",5,0) --Lower DU Brightness
set_array("sim/cockpit2/switches/generic_lights_switch",6,0) --Forward Panel Flood
set_array("sim/cockpit2/switches/generic_lights_switch",7,0) --Glareshiel Flood
set_array("sim/cockpit2/switches/generic_lights_switch",8,0) --Pedestal Flood
set_array("sim/cockpit2/switches/generic_lights_switch",10,0) --Luzes do Overhead Left
set_array("sim/cockpit2/switches/generic_lights_switch",11,0) --Luzes do Overhead Right
set_array("sim/cockpit2/switches/generic_lights_switch",12,0) --Circuit Breaker Flood
command_once("laminar/B738/toggle_switch/cockpit_dome_up")
return
end
create_command("FlyWithLua/Zibo/Bright_dn", "Bright_Dn", "bright_dn()","","")
end