Jump to content

2 position switch requests


Dave317

Recommended Posts

Would it be possible to use 2 position toggle switches much like the 3 position ones that has already been implemented? What I would like to do is map the master arm and fbw g limit switch to 2 position toggle switches on my warthog.

Link to comment
Share on other sites

It would be nice if the controls configuration UI let you set this up. It'd be a bit silly for every switch to have to have two definitions to support both toggling-when-pressed and toggle-when-pressed-or-released behaviour. :(

 

Anyway, you can (mostly) do it yourself fairly easily. I say "mostly" because not every control lets you specify the state you want it to be in; some of them (like the ones you're interested in) only seem capable of toggling. You can still do what you want, but it's easy to end up with them desynced (i.e. your physical switch is 'up', virtual control is 'down'). In SP you can fix that easily by pausing the game, flipping your switch, and then resuming.

 

The bindings are configured in your DCS world installation folder under Mods\aircraft\M-2000C\Input\M-2000C\joystick. Make a backup of the default.lua (in case you break it) or even better, make a JSGME folder for your changes so they're easy to re-apply after updates (but the controls are often updated while the module is in development, so you'll want to check if anything useful has been added or changed instead of blindly replacing it with your customised version).

 

You'll see the controls are generally defined as:

 

{down = something, name = ..., category = ...}

But some of them, especially the existing 3-pos switch abstractions, also have an "up = ..." parameter. This is the key to doing what you want: the "down = ..." command is performed when the button is pressed, and the "up = ..." is performed when the button is released. You'll also see quite a few have "value_up" and "value_down" parameters, which apply a particular value to the "up" or "down" command target. However, some controls just ignore the value_ parameters. This applies to the master arm and G-limiter switch. You can still make them toggle on button release by specifying the same command for the "up = ..." parameter.

 

So for master arm, take the existing line:

 

{down = iCommandSwitchMasterArm, name = _('Master Arm TOGGLE'), category = _('Weapons Management')},

and duplicate it to your own custom control - I suggest putting it right at the start of the file, immediately on the line following "join(res.keyCommands,{":

 

{down = iCommandSwitchMasterArm, name = _('Custom: Master Arm ON, else OFF'), category = _('Weapons Management')},

and then adjust the logic to match what you want. Since this can only be toggled, it's pretty simple: just make it apply the same command when it is release ("up = ...") as it does when it is pressed ("down = ..."):

 

{down = iCommandSwitchMasterArm, up = iCommandSwitchMasterArm, name = _('Custom: Master Arm ON, else OFF'), category = _('Weapons Management')},

The G-limiter switch can be duplicated into something like:

 

{down = iCommandPlaneCobra, up = iCommandPlaneCobra, name = _('Custom: FBW G-Limiter Mode A/A, else CHARGES'), category = _('Flight Control')},

 

You might also want to adjust the category to put them all together in the controls configuration dialog; maybe make a new Custom category by specifying "category = _('Custom')" for each of them.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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