Export 1 0 1
From EagleWiki
DCS Black Shark provides the same way to export data as the LockOn series with the exception of data relating to old LockOn aircrafts.
- TODO: add description
It means that most functions from LockOn export are invalid now, sorry. Most of the common (no avionic or aircraft specific) functions are working.
- TODO: add descriprion
All avionics and aircraft specific functions will be available using GetDevice(device_id_number) method
!! NOTE !! do not store result of this function beetween simulation cycles
common methods available for all devices
- Sending command:
local dev = GetDevice(id_of_device) -- id_of_device unsigned number dev:SetCommand(command_id,command_value) -- send command to device dev:performClickableAction(command_id,command_value) -- send command to device
- TODO: add description of command
Contents |
Export of arguments value
It means state of each switch or button in cockpit, state of all lamps etc. All argument data are stored inside a cockpit device named "MainPanel" you can acces MainPanel using GetDevice() with device ID = 0
- (for all future modules MainPanel will be associated with ID = 0)
local MainPanel = GetDevice(0)
functionality:
- update all arguments state (not needed when camera is inside cockpit)
MainPanel:update_arguments()
- get argument value
local lamp_Hover_status = MainPanel:get_argument_value(175)
in this sample we are getting the status of hover lamp , which is mapped to argument number 175 You can find other arguments in
Scripts/Aircrafts/Ka-50/Cockpit/mainpanel_init.lua
and in
for switches and buttons (it's over 700 so I won't describe all of them here)
Export devices parameters
Radio devices
R800 (radio communicator), R828(radio communicator), ARK22 (ADF). devices id for these items:
R800 48 R828 49 ARK22 46
You can get radio device state table:
local radioDevice = GetDevice(<radio device id>) local state = radioDevice:l_get_state()
State table contains next 9 fields:
1. string name (device name) 2. boolean isOn (device on/off status) 3. boolean soundIsOn (sound on/off status) 4. number volume in range 0.0..1.0 5. number frequency (frequency in Hz) 6. string modulation in range 'FM', 'AM' 7. number pos_x (x world position in meters) 8. number pos_y (y world position in meters) 9. number pos_z (z world position in meters)
Weapon System
get weapon system using device id 12
local weapon_system = GetDevice(12)
export functions are:
local string_name_of_weapon = weapon_system:get_weapon_type_on_station(station_number)
local count_of_wepon_on_station = weapon_system:get_weapon_count_on_station(station_number)
local array_of_station_numbers = weapon_system:get_selected_weapon_stations()
local selected_ammo = weapon_system:get_selected_gun_ammo() -- "HE" or "AP"
local selected_ammo_count = weapon_system:get_selected_gun_ammo_count()
-- and some example
local full_cont_of_weapon_on_selected_stations = 0
for i=1,#array_of_station_numbers do
full_cont_of_weapon_on_selected_stations =
full_cont_of_weapon_on_selected_stations + weapon_system:get_weapon_count_on_station(array_of_station_numbers[i])
end
EKRAN
device id 10
local EKRAN = GetDevice(10) local current_text_frame = EKRAN:get_actual_text_frame() -- return UTF8 string with current text of EKRAN screen
- TODO: to be continued
P.S. sorry for bad english ( feel free to spelling correction)
