Jump to content

A keybind "mod" for 2/3 position toggle switches


Recommended Posts

Posted

Hi

 

So I've discovered that if you change a code line for a keybind in the .lua from saying down to pressed, then that action is continually sent into the sim rather than just once momentarily it is when the code says down when that switch is set to on (at least in this example). As if you were physically holding the switch in the aircraft to the on position even though the solenoid was releasing it. 

This is only really going to be useful if you have fixed 2/3-position toggle switches, not momentary switches or buttons.  

 

So say for example, you wanted the AFC switch in the Harrier to automatically turn back on when the aircraft turns it off, you could change line 103 in  - xxx:\DCS World\Mods\aircraft\AV8BNA\Input\AV8BNA\joystick\default.lua

 

from 

{down = fcs_commands.Switch_AFC, cockpit_device_id = devices.FLIGHTCONTROLS, value_down = 1.0, name = _('Automatic Flight Control ON'), category = _('Stability Augmentation & Autopilot')},

 

to 

{pressed = fcs_commands.Switch_AFC, cockpit_device_id = devices.FLIGHTCONTROLS, value_pressed = 1.0, name = _('Automatic Flight Control ON'), category = _('Stability Augmentation & Autopilot')},

 

 

Perhaps even better for a toggle switch that only sends a button press when the switch is on, would be this line. Which when the joystick switch is set to on, the on command is continually sent, and when the switch is flipped to off, the off command is sent.

 

 

{pressed = fcs_commands.Switch_AFC, up = fcs_commands.Switch_AFC, cockpit_device_id = devices.FLIGHTCONTROLS, value_pressed = 1, value_up = 0.5, name = _('AFC Switch ON Pressed else off'), category = { _('Toggle Switches'), _('Stability Augmentation & Autopilot')}},

 

If you add this line, rather than use it to replace anything, you will have an additional binding called "AFC Switch ON Pressed else off"

 

Bind it in the usual way through the controls menu then when your toggle switch is set to on, the AFC will automatically re-engage anytime the aircraft turns it off. when you flip your switch to off, the AFC switch will turn off to the centre position. 

 

The SAAHS emergency disconnect will not turn the AFC off as it should.

  • Like 1
  • Thanks 3
  • Recently Browsing   0 members

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