Jump to content

Recommended Posts

Posted

Hello pilots,

Being new to DCS I wanted to practice my carrier landings in the FA-18C. I was looking for scripts to automate the cockpit configuration, e.g. gear down, flaps full, hook down, TCN and ILS channels configured, etc. so that I could focus just on the landing part without manually having to repeat the landing configuration steps at each trial.

Using the Mission Editor with triggers and "X: COCKPIT PERFORM CLICKABLE ACTION" actions I got things working, but needed a lot of triggers because many UFC keyboard buttons require a delay between press and release. Anyway, I found various pieces of information on the web, explored the available DCS lua code, manuals, tutorials and combined my findings  into a single script that automates cockpit configuration actions, including time delays between certain actions. Combining the steps into a single script also allows comments with explenations to be added, which helps for future reference.

The attached example mission file has one "Mission Start" trigger and one "DO SCRIPT" action. It first sets Active Pause on, goes through multiple time delayed configuration steps and ends with the message "Ready: unpause and good luck!" at which point the pilot can deactivate active pause and practice the carrier landing.

The code below is included in the mission and demonstrates the technique I used, which should be applicable for other cockpit configurations as well. Hope it's usefull. If there are better approaches, please let me know. It certainly helped me in improving my landing skills 🙂

-Orca57


--[[
    Automated cockpit configuration for an F18 carrier landing training mission.

    Some clickable cockpit actions in the F18 require a delay between press and release, for example various UFC keyboard buttons and the course select button.
    In stead of creating multiple triggers with TIME MORE(1) conditions and X: COCKPIT PERFORM CLICKABLE ACTION actions in the mission editor,
    this script does all the cockpit configuration actions in a single script, which is easier to edit, maintain and explain with comments.

    The technique is to configure a LUA table with sequential steps to perform with some delay between them. The steps are implemented in anonymous functions, wich perform
    cockpit clickable actions using the function call net.dostring_in('mission', "_G.a_cockpit_perform_clickable_action(<device id>, <button id>, <value>, ''))", which has the same functionality as X: COCKPIT PERFORM CLICKABLE ACTION()
    At the end of each action the next action is triggered with a time delay using timer.scheduleFunction(steps[step], step + 1, timer.getTime() + 1)
    The very last action must not trigger further actions.

    The actions are:
    - setup the TCN channel (73X)
    - setup the ILS channel, default 1
    - configure the course select (334)
    - configere the left MDI as HSI with TCN and ILS boxed

    When completed, the message "Ready: unpause and good luck!" is shown, at which point active pause can be released by the pilot.

    author: Orca57
]]--

local steps = {} -- The table with actions, populated below.

-- local support functions, reducing syntax clutter.
local function cockpit_action(device_id, action_id, value)
    -- identical to the mission editor action X: COCKPIT PERFORM CLICKABLE ACTION
    net.dostring_in('mission', '_G.a_cockpit_perform_clickable_action('..device_id..', '..action_id..', '..value..', "")')
end

local function set_command(command_id)
    -- identical to the mission editor action X: SET COMMAND
    net.dostring_in('mission', '_G.a_set_command('..command_id..')')
end

local function message(txt, time)
    -- Show message
    trigger.action.outText(txt, time)
end

local function next_step(step, delay)
    -- Schedule the next step
    if (steps[step] ~= nil) then
        timer.scheduleFunction(steps[step], step + 1, timer.getTime() + delay)
    end
end

--[[
    Each table index is automaticaly incremented, the actions are anomymous functions that take the current step index as argument, which is used to invoke the next step after a time delay.
    Order is important. From first to last action. Which actions require a delay between them and the delay value takes some trial and error.
    The arguments for the a_cockpit_perform_clickable_action function are the same as for X: COCKPIT PERFORM CLICKABLE ACTION(), which is rather obscure and cockpit specific, but can be found in various on-line resources.
    or extracted from (for example) C:\Program Files\Eagle Dynamics\DCS World\Mods\aircraft\FA-18C\Cockpit\Scripts\clickabledata.lua
]]--
steps[#steps + 1] = function(step)
    message("Setup TCN 73X", 2)
    cockpit_action(25, 3003, 0) -- UFC, TCN (release)
    cockpit_action(25, 3025, 1) -- UFC, 7 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3025, 0) -- UFC Keyboard Pushbutton, 7 (release)
    cockpit_action(25, 3021, 1) -- UFC Keyboard Pushbutton, 3 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3012, 0) -- UFC Keyboard Pushbutton, 3 release
    cockpit_action(25, 3029, 1) -- UFC Keyboard Pushbutton, ENT (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3029, 0) -- UFC, ENT (release)
    cockpit_action(25, 3007, 1) -- UFC, ON/OFF (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    message("Setup ILS Channel 1", 2)
    cockpit_action(25, 3007, 0) -- UFC, ON/OFF (release)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3004, 1) -- UFC, ILS (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3004, 0) -- UFC, ILS (release)
    cockpit_action(25, 3007, 1) -- UFC, ON/OFF (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    message("Configure HDI", 2)
    -- ILS On
    cockpit_action(25, 3007, 0) -- UFC, ON/OFF (release)
    -- box TCN on HSI
    cockpit_action(35, 3015, 1) -- Left MDI, 5
    -- box ILS on left MDI HSI
    cockpit_action(35, 3014, 1) -- Left MDI, 4
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    message("Setting CRS to 334", 2)
    cockpit_action(35, 3007, -1) -- Course set switch (press)
    next_step(step, 3)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(35, 3007, 0) -- Course set switch (release)
    cockpit_action(25, 3021, 1) -- UFC Keyboard Pushbutton, 3 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3021, 0) -- UFC Keyboard Pushbutton, 3 (release)
    cockpit_action(25, 3021, 1) -- UFC Keyboard Pushbutton, 3 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3021, 0) -- UFC Keyboard Pushbutton, 3 (release)
    cockpit_action(25, 3022, 1) -- UFC Keyboard Pushbutton, 4 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3022, 0) -- UFC Keyboard Pushbutton, 4 (release)
    cockpit_action(25, 3029, 1) -- UFC Keyboard Pushbutton, ENT (press)    
    timer.scheduleFunction(steps[step], step + 1, timer.getTime() + 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3029, 0) -- UFC Keyboard Pushbutton, ENT (release)
    message("Ready: unpause and good luck!", 5)
    --This is the last action, no further timer calls.
    --timer.scheduleFunction(steps[step], step + 1, timer.getTime() + 1)
    return nil
end

-- Mission init
message("Start: setting landing configuration, wait for ready message!", 2)
set_command(816) -- Active pause on

-- Landing configuration
cockpit_action(5, 3001, 0)  -- Landing Gear Control Handle, Down
cockpit_action(5, 3009, 0)  -- Arresting Hook Handle, Down
cockpit_action(2, 3007, -1) -- FLAP Switch, Full
cockpit_action(5, 3004, -1) -- Anti Skip Switch, Off

-- Left MDI settup with HDI at 5nm
cockpit_action(35, 3028, 1) -- Left MDI PB 18
cockpit_action(35, 3028, 1) -- Left MDI PB 18
cockpit_action(35, 3012, 1) -- Left MDI PB 2 (select HDI)
cockpit_action(35, 3018, 1) -- Left MDI PB 8 (scale 20nm)
cockpit_action(35, 3018, 1) -- Left MDI PB 8 (scale 10nm)
cockpit_action(35, 3018, 1) -- Left MDI PB 8 (scale 5nm)

-- Start TCN, ILS and course configuration actions
cockpit_action(25, 3003, 1) -- UFC , TCN (press)

-- Comms
set_command(179) -- Main communications menu

-- Start first time delayed action
next_step(1, 1)

 


F18 carrier landing final approach configured.miz

  • Like 2
  • Thanks 1
Posted

Thanks for sharing, there will probably people who find it helpful.

Personally I took the easy route and I use an AutoHotKey (AHK) script to press the appropriate buttons.  Keeps it simpler than having to figure out the DCS commands.  All I need to know is what binding I have for a button and have AHK send those in the appropriate order and with delays as needed.

  • 1 month later...
Posted
On 7/29/2024 at 3:48 PM, Orca57 said:

Hello pilots,

Being new to DCS I wanted to practice my carrier landings in the FA-18C. I was looking for scripts to automate the cockpit configuration, e.g. gear down, flaps full, hook down, TCN and ILS channels configured, etc. so that I could focus just on the landing part without manually having to repeat the landing configuration steps at each trial.

Using the Mission Editor with triggers and "X: COCKPIT PERFORM CLICKABLE ACTION" actions I got things working, but needed a lot of triggers because many UFC keyboard buttons require a delay between press and release. Anyway, I found various pieces of information on the web, explored the available DCS lua code, manuals, tutorials and combined my findings  into a single script that automates cockpit configuration actions, including time delays between certain actions. Combining the steps into a single script also allows comments with explenations to be added, which helps for future reference.

The attached example mission file has one "Mission Start" trigger and one "DO SCRIPT" action. It first sets Active Pause on, goes through multiple time delayed configuration steps and ends with the message "Ready: unpause and good luck!" at which point the pilot can deactivate active pause and practice the carrier landing.

The code below is included in the mission and demonstrates the technique I used, which should be applicable for other cockpit configurations as well. Hope it's usefull. If there are better approaches, please let me know. It certainly helped me in improving my landing skills 🙂

-Orca57


--[[
    Automated cockpit configuration for an F18 carrier landing training mission.

    Some clickable cockpit actions in the F18 require a delay between press and release, for example various UFC keyboard buttons and the course select button.
    In stead of creating multiple triggers with TIME MORE(1) conditions and X: COCKPIT PERFORM CLICKABLE ACTION actions in the mission editor,
    this script does all the cockpit configuration actions in a single script, which is easier to edit, maintain and explain with comments.

    The technique is to configure a LUA table with sequential steps to perform with some delay between them. The steps are implemented in anonymous functions, wich perform
    cockpit clickable actions using the function call net.dostring_in('mission', "_G.a_cockpit_perform_clickable_action(<device id>, <button id>, <value>, ''))", which has the same functionality as X: COCKPIT PERFORM CLICKABLE ACTION()
    At the end of each action the next action is triggered with a time delay using timer.scheduleFunction(steps[step], step + 1, timer.getTime() + 1)
    The very last action must not trigger further actions.

    The actions are:
    - setup the TCN channel (73X)
    - setup the ILS channel, default 1
    - configure the course select (334)
    - configere the left MDI as HSI with TCN and ILS boxed

    When completed, the message "Ready: unpause and good luck!" is shown, at which point active pause can be released by the pilot.

    author: Orca57
]]--

local steps = {} -- The table with actions, populated below.

-- local support functions, reducing syntax clutter.
local function cockpit_action(device_id, action_id, value)
    -- identical to the mission editor action X: COCKPIT PERFORM CLICKABLE ACTION
    net.dostring_in('mission', '_G.a_cockpit_perform_clickable_action('..device_id..', '..action_id..', '..value..', "")')
end

local function set_command(command_id)
    -- identical to the mission editor action X: SET COMMAND
    net.dostring_in('mission', '_G.a_set_command('..command_id..')')
end

local function message(txt, time)
    -- Show message
    trigger.action.outText(txt, time)
end

local function next_step(step, delay)
    -- Schedule the next step
    if (steps[step] ~= nil) then
        timer.scheduleFunction(steps[step], step + 1, timer.getTime() + delay)
    end
end

--[[
    Each table index is automaticaly incremented, the actions are anomymous functions that take the current step index as argument, which is used to invoke the next step after a time delay.
    Order is important. From first to last action. Which actions require a delay between them and the delay value takes some trial and error.
    The arguments for the a_cockpit_perform_clickable_action function are the same as for X: COCKPIT PERFORM CLICKABLE ACTION(), which is rather obscure and cockpit specific, but can be found in various on-line resources.
    or extracted from (for example) C:\Program Files\Eagle Dynamics\DCS World\Mods\aircraft\FA-18C\Cockpit\Scripts\clickabledata.lua
]]--
steps[#steps + 1] = function(step)
    message("Setup TCN 73X", 2)
    cockpit_action(25, 3003, 0) -- UFC, TCN (release)
    cockpit_action(25, 3025, 1) -- UFC, 7 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3025, 0) -- UFC Keyboard Pushbutton, 7 (release)
    cockpit_action(25, 3021, 1) -- UFC Keyboard Pushbutton, 3 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3012, 0) -- UFC Keyboard Pushbutton, 3 release
    cockpit_action(25, 3029, 1) -- UFC Keyboard Pushbutton, ENT (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3029, 0) -- UFC, ENT (release)
    cockpit_action(25, 3007, 1) -- UFC, ON/OFF (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    message("Setup ILS Channel 1", 2)
    cockpit_action(25, 3007, 0) -- UFC, ON/OFF (release)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3004, 1) -- UFC, ILS (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3004, 0) -- UFC, ILS (release)
    cockpit_action(25, 3007, 1) -- UFC, ON/OFF (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    message("Configure HDI", 2)
    -- ILS On
    cockpit_action(25, 3007, 0) -- UFC, ON/OFF (release)
    -- box TCN on HSI
    cockpit_action(35, 3015, 1) -- Left MDI, 5
    -- box ILS on left MDI HSI
    cockpit_action(35, 3014, 1) -- Left MDI, 4
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    message("Setting CRS to 334", 2)
    cockpit_action(35, 3007, -1) -- Course set switch (press)
    next_step(step, 3)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(35, 3007, 0) -- Course set switch (release)
    cockpit_action(25, 3021, 1) -- UFC Keyboard Pushbutton, 3 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3021, 0) -- UFC Keyboard Pushbutton, 3 (release)
    cockpit_action(25, 3021, 1) -- UFC Keyboard Pushbutton, 3 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3021, 0) -- UFC Keyboard Pushbutton, 3 (release)
    cockpit_action(25, 3022, 1) -- UFC Keyboard Pushbutton, 4 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3022, 0) -- UFC Keyboard Pushbutton, 4 (release)
    cockpit_action(25, 3029, 1) -- UFC Keyboard Pushbutton, ENT (press)    
    timer.scheduleFunction(steps[step], step + 1, timer.getTime() + 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3029, 0) -- UFC Keyboard Pushbutton, ENT (release)
    message("Ready: unpause and good luck!", 5)
    --This is the last action, no further timer calls.
    --timer.scheduleFunction(steps[step], step + 1, timer.getTime() + 1)
    return nil
end

-- Mission init
message("Start: setting landing configuration, wait for ready message!", 2)
set_command(816) -- Active pause on

-- Landing configuration
cockpit_action(5, 3001, 0)  -- Landing Gear Control Handle, Down
cockpit_action(5, 3009, 0)  -- Arresting Hook Handle, Down
cockpit_action(2, 3007, -1) -- FLAP Switch, Full
cockpit_action(5, 3004, -1) -- Anti Skip Switch, Off

-- Left MDI settup with HDI at 5nm
cockpit_action(35, 3028, 1) -- Left MDI PB 18
cockpit_action(35, 3028, 1) -- Left MDI PB 18
cockpit_action(35, 3012, 1) -- Left MDI PB 2 (select HDI)
cockpit_action(35, 3018, 1) -- Left MDI PB 8 (scale 20nm)
cockpit_action(35, 3018, 1) -- Left MDI PB 8 (scale 10nm)
cockpit_action(35, 3018, 1) -- Left MDI PB 8 (scale 5nm)

-- Start TCN, ILS and course configuration actions
cockpit_action(25, 3003, 1) -- UFC , TCN (press)

-- Comms
set_command(179) -- Main communications menu

-- Start first time delayed action
next_step(1, 1)

 


F18 carrier landing final approach configured.miz 24.11 kB · 2 downloads

Thanks for sharing.

This is exactly what I've been looking for some time now. 

I want to make an automated WSO for the F-15E. The idea being simple tasks like setting his cockpit up after mission start, turning on the TPOD, setting up PACS including programming the weapons page.. up to more complex tasks like doing Fence In and Fence out tasks. Also, in order to make him more human like, I was looking for this delay between actions, like he is thinking about what to input and reading off of a mission briefing. 

This will be VERY helpful, I'll test it and come to you back later. 

 

  • 8 months later...
Posted
2024/7/30 AM2点48分,Orca57说:

Hello pilots,

Being new to DCS I wanted to practice my carrier landings in the FA-18C. I was looking for scripts to automate the cockpit configuration, e.g. gear down, flaps full, hook down, TCN and ILS channels configured, etc. so that I could focus just on the landing part without manually having to repeat the landing configuration steps at each trial.

Using the Mission Editor with triggers and "X: COCKPIT PERFORM CLICKABLE ACTION" actions I got things working, but needed a lot of triggers because many UFC keyboard buttons require a delay between press and release. Anyway, I found various pieces of information on the web, explored the available DCS lua code, manuals, tutorials and combined my findings  into a single script that automates cockpit configuration actions, including time delays between certain actions. Combining the steps into a single script also allows comments with explenations to be added, which helps for future reference.

The attached example mission file has one "Mission Start" trigger and one "DO SCRIPT" action. It first sets Active Pause on, goes through multiple time delayed configuration steps and ends with the message "Ready: unpause and good luck!" at which point the pilot can deactivate active pause and practice the carrier landing.

The code below is included in the mission and demonstrates the technique I used, which should be applicable for other cockpit configurations as well. Hope it's usefull. If there are better approaches, please let me know. It certainly helped me in improving my landing skills 🙂

-Orca57


--[[
    Automated cockpit configuration for an F18 carrier landing training mission.

    Some clickable cockpit actions in the F18 require a delay between press and release, for example various UFC keyboard buttons and the course select button.
    In stead of creating multiple triggers with TIME MORE(1) conditions and X: COCKPIT PERFORM CLICKABLE ACTION actions in the mission editor,
    this script does all the cockpit configuration actions in a single script, which is easier to edit, maintain and explain with comments.

    The technique is to configure a LUA table with sequential steps to perform with some delay between them. The steps are implemented in anonymous functions, wich perform
    cockpit clickable actions using the function call net.dostring_in('mission', "_G.a_cockpit_perform_clickable_action(<device id>, <button id>, <value>, ''))", which has the same functionality as X: COCKPIT PERFORM CLICKABLE ACTION()
    At the end of each action the next action is triggered with a time delay using timer.scheduleFunction(steps[step], step + 1, timer.getTime() + 1)
    The very last action must not trigger further actions.

    The actions are:
    - setup the TCN channel (73X)
    - setup the ILS channel, default 1
    - configure the course select (334)
    - configere the left MDI as HSI with TCN and ILS boxed

    When completed, the message "Ready: unpause and good luck!" is shown, at which point active pause can be released by the pilot.

    author: Orca57
]]--

local steps = {} -- The table with actions, populated below.

-- local support functions, reducing syntax clutter.
local function cockpit_action(device_id, action_id, value)
    -- identical to the mission editor action X: COCKPIT PERFORM CLICKABLE ACTION
    net.dostring_in('mission', '_G.a_cockpit_perform_clickable_action('..device_id..', '..action_id..', '..value..', "")')
end

local function set_command(command_id)
    -- identical to the mission editor action X: SET COMMAND
    net.dostring_in('mission', '_G.a_set_command('..command_id..')')
end

local function message(txt, time)
    -- Show message
    trigger.action.outText(txt, time)
end

local function next_step(step, delay)
    -- Schedule the next step
    if (steps[step] ~= nil) then
        timer.scheduleFunction(steps[step], step + 1, timer.getTime() + delay)
    end
end

--[[
    Each table index is automaticaly incremented, the actions are anomymous functions that take the current step index as argument, which is used to invoke the next step after a time delay.
    Order is important. From first to last action. Which actions require a delay between them and the delay value takes some trial and error.
    The arguments for the a_cockpit_perform_clickable_action function are the same as for X: COCKPIT PERFORM CLICKABLE ACTION(), which is rather obscure and cockpit specific, but can be found in various on-line resources.
    or extracted from (for example) C:\Program Files\Eagle Dynamics\DCS World\Mods\aircraft\FA-18C\Cockpit\Scripts\clickabledata.lua
]]--
steps[#steps + 1] = function(step)
    message("Setup TCN 73X", 2)
    cockpit_action(25, 3003, 0) -- UFC, TCN (release)
    cockpit_action(25, 3025, 1) -- UFC, 7 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3025, 0) -- UFC Keyboard Pushbutton, 7 (release)
    cockpit_action(25, 3021, 1) -- UFC Keyboard Pushbutton, 3 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3012, 0) -- UFC Keyboard Pushbutton, 3 release
    cockpit_action(25, 3029, 1) -- UFC Keyboard Pushbutton, ENT (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3029, 0) -- UFC, ENT (release)
    cockpit_action(25, 3007, 1) -- UFC, ON/OFF (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    message("Setup ILS Channel 1", 2)
    cockpit_action(25, 3007, 0) -- UFC, ON/OFF (release)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3004, 1) -- UFC, ILS (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3004, 0) -- UFC, ILS (release)
    cockpit_action(25, 3007, 1) -- UFC, ON/OFF (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    message("Configure HDI", 2)
    -- ILS On
    cockpit_action(25, 3007, 0) -- UFC, ON/OFF (release)
    -- box TCN on HSI
    cockpit_action(35, 3015, 1) -- Left MDI, 5
    -- box ILS on left MDI HSI
    cockpit_action(35, 3014, 1) -- Left MDI, 4
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    message("Setting CRS to 334", 2)
    cockpit_action(35, 3007, -1) -- Course set switch (press)
    next_step(step, 3)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(35, 3007, 0) -- Course set switch (release)
    cockpit_action(25, 3021, 1) -- UFC Keyboard Pushbutton, 3 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3021, 0) -- UFC Keyboard Pushbutton, 3 (release)
    cockpit_action(25, 3021, 1) -- UFC Keyboard Pushbutton, 3 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3021, 0) -- UFC Keyboard Pushbutton, 3 (release)
    cockpit_action(25, 3022, 1) -- UFC Keyboard Pushbutton, 4 (press)
    next_step(step, 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3022, 0) -- UFC Keyboard Pushbutton, 4 (release)
    cockpit_action(25, 3029, 1) -- UFC Keyboard Pushbutton, ENT (press)    
    timer.scheduleFunction(steps[step], step + 1, timer.getTime() + 1)
    return nil
end

steps[#steps + 1] = function(step)
    cockpit_action(25, 3029, 0) -- UFC Keyboard Pushbutton, ENT (release)
    message("Ready: unpause and good luck!", 5)
    --This is the last action, no further timer calls.
    --timer.scheduleFunction(steps[step], step + 1, timer.getTime() + 1)
    return nil
end

-- Mission init
message("Start: setting landing configuration, wait for ready message!", 2)
set_command(816) -- Active pause on

-- Landing configuration
cockpit_action(5, 3001, 0)  -- Landing Gear Control Handle, Down
cockpit_action(5, 3009, 0)  -- Arresting Hook Handle, Down
cockpit_action(2, 3007, -1) -- FLAP Switch, Full
cockpit_action(5, 3004, -1) -- Anti Skip Switch, Off

-- Left MDI settup with HDI at 5nm
cockpit_action(35, 3028, 1) -- Left MDI PB 18
cockpit_action(35, 3028, 1) -- Left MDI PB 18
cockpit_action(35, 3012, 1) -- Left MDI PB 2 (select HDI)
cockpit_action(35, 3018, 1) -- Left MDI PB 8 (scale 20nm)
cockpit_action(35, 3018, 1) -- Left MDI PB 8 (scale 10nm)
cockpit_action(35, 3018, 1) -- Left MDI PB 8 (scale 5nm)

-- Start TCN, ILS and course configuration actions
cockpit_action(25, 3003, 1) -- UFC , TCN (press)

-- Comms
set_command(179) -- Main communications menu

-- Start first time delayed action
next_step(1, 1)

 


F18 carrier landing final approach configured.miz 24.11KB · 8次下载

Hello, could you tell me these functions _G.a_cockpit_perform_clickable_action(<) device id> , < button id> , < value> Where did ")) get it from? It feels much more convenient than in the ME trigger. Thank you very much!

Posted
3 hours ago, Qazplm said:

Hello, could you tell me these functions _G.a_cockpit_perform_clickable_action(<) device id> , < button id> , < value> Where did ")) get it from? It feels much more convenient than in the ME trigger. Thank you very much!

You can find the device_id, button_ID and which values they assume when clicked inside the file clickabledtata.lua. Every aircraft in DCS has this file, and normally it is inside the Cockpit folder. For the F-18 for instance is inside the DCS World>Mods>aircraft>FA-18C>Cockpit>Scripts folder.

Posted
26分钟前,SloppyDog说:

You can find the device_id, button_ID and which values they assume when clicked inside the file clickabledtata.lua. Every aircraft in DCS has this file, and normally it is inside the Cockpit folder. For the F-18 for instance is inside the DCS World>Mods>aircraft>FA-18C>Cockpit>Scripts folder.

Thank you for your answer. I already know this. I learned it from you! I mean to ask about this function Where is _G.a_cockpit_perform_clickable_action obtained and where can such functions be found?

_G.a_cockpit_perform_clickable_action

Posted
6小时前,SloppyDog说:

You can find the device_id, button_ID and which values they assume when clicked inside the file clickabledtata.lua. Every aircraft in DCS has this file, and normally it is inside the Cockpit folder. For the F-18 for instance is inside the DCS World>Mods>aircraft>FA-18C>Cockpit>Scripts folder.

  • I see. They come from mission in the LUA console. But I don't have a LUA console. How can I obtain these functions?
Posted
11 hours ago, Qazplm said:
  • I see. They come from mission in the LUA console. But I don't have a LUA console. How can I obtain these functions?

Oh well. The LUA console is mentioned in the manual, but we don't have access to it. It's only for DCS developers. Unfortunately. 

Posted

Hi, guys. I'm not familiar with the script and have a problem. I input

return _G.c_argument_in_range(142,0,0.1,"")

in the LUA console. It can return true or false, but how should I use it in the script?

if net.dostring_in('mission', 'return _G.c_argument_in_range(142,0,0.1,"") ') then

trigger.action.outText("very good! Please proceed to the next step" ,10 )

end

But it doesn't work

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...