Jump to content

Modding the speedbrake "speed brake OUT/ IN"


Go to solution Solved by Zabuzard,

Recommended Posts

Posted

I have a cougar throttle from Thrustmaster with an inbuild slider for the speedbrake.

I want to extend the speedbrake full when pushing the slider forward (works with "speed brake out (hold)).When pushing the slider aft I want the speedbrake to extend as long as I push the slider aft (it is springloaded). When I release it (and the slider goes into the center position) the speedbrake should retract.

So I need something like a 2-switch-springload command "speed brake OUT/ IN" I think

I just found something similar with "speed brake IN/ STOP (3-way)" but could not find the code of it in the defauld.lua of the keyboard folder.

This is the code for the speedbrake I found:

"    -- Pilot Speed Brake Switch: maintaining IN, maintaining STOP, and momentary OUT
    switch_3_springloaded_down('Speed Brake', { 'Out', 'Stop', 'In' }, { '[Aft]', '[Forward]' }, device_commands.CONTROLSURFACES_BrakeExtendRetract, device_commands.CONTROLSURFACES_BrakeStep, device_commands.CONTROLSURFACES_BrakeToggle, device_commands.CONTROLSURFACES_Brake_AXIS, bind_templates.speedbrake(), { binds = {
        pos_neg_1 = { combos = combo('B', 'LCtrl') },
        pos_0 = { combos = combo('B', { 'RAlt' }) },
        pos_1 = { combos = combo('B', 'LShift') },
        next = { combos = combo('B') },
    } }),"

But where is the code für the "speed brake IN/ STOP (3-way)" and what should the code look like to make that "speed brake OUT/ IN" I need.

Thanks for helping

 

Posted

Thats a point, yes🙂

I'm not only flying the F4e but F16 an F18 too. So I use to let the basic controls similar due to the muscule memory. In addition to that it feels more intuitive for me to bind the center of the slider with "speedbrake in". 

Switching the slider forward to extend the speedbrake full, swithing back to center retract them. Sliding the springloaded backwards extends the speedbrake as long as I hold it and retracts it when leting it go back to the center (just to slow down a bit due not to overshoot for example).

When somebody may help me where I can find the code of "speedbrake-In/stop", may be I can figure out a script of "speedbrake-out/in"

Posted
7 hours ago, L39Tom said:

I'm not only flying the F4e but F16 an F18 too. So I use to let the basic controls similar due to the muscule memory. 

They all work the same. F-14/15 too.

7 hours ago, L39Tom said:

In addition to that it feels more intuitive for me to bind the center of the slider with "speedbrake in". 

Fair enough, you want it to be a car brake. 😊 Was just curious like I wrote.

Hopefully someone can help you. 🤞🏻

Cheers! 

Posted

Can someone summarize in simple terms what you want?

You have a physical 3-way switch as hardware, right? Like, it has 3 positions IRL?

And you want which of them to do what exactly and which of them should be springloaded?

  • Like 1
Posted
Can someone summarize in simple terms what you want?

You have a physical 3-way switch as hardware, right? Like, it has 3 positions IRL?

And you want which of them to do what exactly and which of them should be springloaded?
He wants to have sprung position as it is, while middle position as retract, and non-sprung as fully extended. Basically he wants to pump the sprung position as a car brake and use the non sprung as the handbrake/park.

Sent from my SM-A536B using Tapatalk


Posted (edited)

So:

* IRL Forward (springloaded to center): Extend
* IRL Center: Retract
* IRL Aft (not springloaded): Extend

Then you are missing a position to hold the speedbrake at the current position and it can either go extend or retract. Did I get this right, is that what you want?

Edited by Zabuzard
Posted
So:
* IRL Forward (springloaded to center): Extend
* IRL Center: Retract
* IRL Aft (not springloaded): Extend
Then you are missing a position to hold the speedbrake at the current position and it can either go extend or retract. Did I get this right, is that what you want?
I believe that's what he wants, except that on the Warthog and Cougar aft, not forward, is spring loaded to center.

Sent from my SM-A536B using Tapatalk


  • Like 1
  • Solution
Posted

Fair, so the same but the other way around 🙂

So the way this works is, if you check the bind_dsl.lua file you can find the code for the function being used here (switch_3_springloaded_down). It first forwards to another function (switch_3) which sets up the following binds (in the typical DCS syntax that you might know from other aircraft):

local binds = {
    pos_neg_1 = { name = _(name .. ' - ' .. pos_neg_1_name), value_down = -1, down = command_id_position },
    pos_0 = { name = _(name .. ' - ' .. pos_0_name), value_down = 0, down = command_id_position },
    pos_1 = { name = _(name .. ' - ' .. pos_1_name), value_down = 1, down = command_id_position },
    pos_3_way_up = { name = _(name .. ' - ' .. pos_1_name .. '/' .. pos_0_name .. ' (3-way up)'), value_down = 1, value_up = 0, down = command_id_position, up = command_id_position },
    pos_3_way_down = { name = _(name .. ' - ' .. pos_neg_1_name .. '/' .. pos_0_name .. ' (3-way down)'), value_down = -1, value_up = 0, down = command_id_position, up = command_id_position },
}

Then it may add inc/dec binds to the mix:

binds.dec = { name = _(name .. ' - ' .. dir_dec), value_down = -1, down = command_id_inc_dec }
binds.inc = { name = _(name .. ' - ' .. dir_inc), value_down = 1, down = command_id_inc_dec }

A "next" bind:

binds.next = { name = _(name .. ' - [Next]'), value_down = 1, value_up = 0, down = command_id_next, up = command_id_next }

And an axis bind:

binds.axis = { name = _(axis_prefix .. name .. ' (Switch)'), action = command_id_axis, category = { axis_categories.switch } }

Finally it gets back to the previous function which has the override for the springloading:

local springload_override = { binds = {
    pos_neg_1 = { name = _(name .. ' - ' .. pos_neg_1_name .. ' (Hold)'), value_up = 0, up = command_id_position },
    pos_3_way_down = { remove = true },
} }

On the C++ side the command being used here is 

device_commands.CONTROLSURFACES_BrakeExtendRetract

So thats the command that those binds send, they send it to the device:

devices.CONTROLSURFACES

The value being send over that command indicates the position for the switch. -1 means switch down (in this case the in-game AFT, i.e. extend). 0 is switch center (in-game center, i.e. stop). +1 means switch up (in-game FORWARD, i.e. retract).

In the LUA value_down is the value send when holding down the keybind and value_up is the value send when releasing the keybind (this is what makes springloading work).

Functionally the binds you want are both identical as the springloading comes from your IRL equipment anyways. So what you want is a bind that sends value 1 (extend) on value_down and value -1 (retract) on value_up. You would then bind this to both of your IRL positions (AFT and FORWARD).

Long story short, try adding this line to your default.lua:

{
  name = _('Speed Brake - Out/In (3-way up and down)'),
  down = device_commands.CONTROLSURFACES_BrakeExtendRetract, up = device_commands.CONTROLSURFACES_BrakeExtendRetract,
  value_down = -1, value_up = 1,
  cockpit_device_id = devices.CONTROLSURFACES,
  category = { categories.flight_controls, categories.throttle }
},

This is the ordinary DCS syntax for binds, a bit easier to use for small additions 🙂 

  • Like 1
Posted

@Zabuzard Thanks! I'll look into this myself for other stuff, and other modules.

@L39Tom Hopefully this is the info you need!
Are you using Quaggles? If not. Because of these hacks needs to be put into the core, they need to be applied after every patch, and might break IC in MP. Quaggles fixes this. You can store the settings in Saved Games, though you need to apply the Quaggles file after every update, (best with a mod manager), while it doesn't break IC. Munkwolf has also made a ton of "missing" keybinds you can add.
Cheers!

Sent from my SM-A536B using Tapatalk

  • Like 1
Posted

Sorry for expressing myself so unclearly, MAXsenna made it clearer.

@Zabuzard you made my day, thank you very much. I will test it as soon as I can.

@MAXsenna yes I put it into the core game folder. As I mentioned I moded the default.lua files for the F16 an F18 before. The CougarThrotte is build with a 3way switch. Forward (not springloaded), Center and Aft (springloaded). So it is all the way around as IRL - you mentioned it.

I really appreciate that you helped me, even with my really 'special' problem

Cheers

  • Like 1
Posted
1 hour ago, L39Tom said:

The CougarThrotte is build with a 3way switch. Forward (not springloaded), Center and Aft (springloaded). So it is all the way around as IRL - you mentioned it.

Yeah, I know. I have a couple. Even my girlfriend has one. 😉 It's the same on the new one and the Warthog. 

1 hour ago, L39Tom said:

yes I put it into the core game folder. As I mentioned I moded the default.lua files for the F16 an F18 before.

You really should have a look at Quaggles Keybind Injector and Munkwolf's Keybind Repository. Then you only need to push one file with a mod manager after a DCS update, and keep all your personal modifications in Saved Games. I can highly recommend it! 👍🏻

Cheers! 

  • Recently Browsing   0 members

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