Jump to content

On/off switches


Recommended Posts

Using a Warthog that has a number of single throw switches. These are fine to bind to 'on' or toggle controls but the off function is not seen as a command so can't be bound.

SPAD.neXt supports these as bindable on/off events for FS2020, is there anything similar or a way to bind a single throw switch to both on and off binds in DCS?

 

Link to comment
Share on other sites

Some modules have an on otherwise off bind for some functions but typically not. I use Joy2Key to map on and off to separate keys, it can also be done in the TM TARGET software and other third party tools like Joystick Gremlin. I believe that on otherwise off binds can be added by editing the controller lua files but that is getting a bit advanced for me!

  • Like 1

AMD 5800X3D · MSI 4080 · Asus ROG Strix B550 Gaming  · HP Reverb Pro · 1Tb M.2 NVMe, 32Gb Corsair Vengence 3600MHz DDR4 · Windows 11 · Thrustmaster TPR Pedals · VIRPIL T-50CM3 Base, Alpha Prime R. VIRPIL VPC Rotor TCS Base. JetSeat

Link to comment
Share on other sites

There are a couple of fellows who have the skills to make Lua's for those switches but I haven't seen them on recently.  I'll look for one of their posts and PM a request.  Of course if they don't have the Module we're out of luck.

Otherwise Joy2Key as Baldrick suggests.

  • Like 1

[sIGPIC][/sIGPIC]

i7 10700K OC 5.1GHZ / 500GB SSD & 1TB M:2 & 4TB HDD / MSI Gaming MB / GTX 1080 / 32GB RAM / Win 10 / TrackIR 4 Pro / CH Pedals / TM Warthog

Link to comment
Share on other sites

My Joy2Key mappings for the TM Throttle. I don't use a keyboard for controls so I am free to use all the keystrokes for my throttle. This is a relatively simple approach. I just use the option in Joy2Key to have a keystroke on press and another on release,

 

Throttle Joy2Key.png

  • Like 1

AMD 5800X3D · MSI 4080 · Asus ROG Strix B550 Gaming  · HP Reverb Pro · 1Tb M.2 NVMe, 32Gb Corsair Vengence 3600MHz DDR4 · Windows 11 · Thrustmaster TPR Pedals · VIRPIL T-50CM3 Base, Alpha Prime R. VIRPIL VPC Rotor TCS Base. JetSeat

Link to comment
Share on other sites

2 hours ago, Baldrick33 said:

I believe that on otherwise off binds can be added by editing the controller lua files but that is getting a bit advanced for me!

I just did that yesterday for the NVS switch. Here's a mini tutorial what I did for this switch, hopefully you guys can make it work for other switches that you need.

Word of caution to all: create a backup of your controller configuration before starting. But if you screw anything up really bad, DCS Repair will fix it for you. 🙂

So, here we go.

First, we're looking for the proper input file. It should be one of these:

-- Pilot:
C:\Program Files\Eagle Dynamics\DCS World OpenBeta\Mods\aircraft\AH-64D\Input\AH-64D_PLT\joystick\default.lua

-- CPG:
C:\Program Files\Eagle Dynamics\DCS World OpenBeta\Mods\aircraft\AH-64D\Input\AH-64D_CPG\joystick\default.lua

These files can be opened and edited with Notepad, but editors like Notepad++ (available for free) work a bit better and offer more comfort.

Open the default.lua input files in your preferred text editor. Next, locate the commands we're interested in. For the AH-64D, the commands are likely to be identical in both files, because the cockpits are almost identical in terms of keybinds.

I wanted to map the NVS NORM and OFF positions to a two-way switch on my Warthog base:

image.png

So, searching the above mentioned Lua files for "NVS" yields these results, among others:

------------------------------------------------
-- NVS Mode Panel ------------------------------
------------------------------------------------
{	down = electric_commands.NVS_MODE_KNOB_ITER,													cockpit_device_id = devices.ELEC_INTERFACE,		value_down =  1.0,					name = _('PLT NVS MODE Switch - Up'),				category = {_('Left Console'), _('NVS Mode Panel')}},
{	down = electric_commands.NVS_MODE_KNOB_ITER,													cockpit_device_id = devices.ELEC_INTERFACE,		value_down = -1.0,					name = _('PLT NVS MODE Switch - Down'),				category = {_('Left Console'), _('NVS Mode Panel')}},
{	down = electric_commands.NVS_MODE_KNOB_EXT,														cockpit_device_id = devices.ELEC_INTERFACE,		value_down =  1.0,					name = _('PLT NVS MODE Switch - FIXED'),			category = {_('Left Console'), _('NVS Mode Panel')}},
{	down = electric_commands.NVS_MODE_KNOB_EXT,														cockpit_device_id = devices.ELEC_INTERFACE,		value_down =  0.0,					name = _('PLT NVS MODE Switch - NORM'),				category = {_('Left Console'), _('NVS Mode Panel')}},
{	down = electric_commands.NVS_MODE_KNOB_EXT,														cockpit_device_id = devices.ELEC_INTERFACE,		value_down = -1.0,					name = _('PLT NVS MODE Switch - OFF'),				category = {_('Left Console'), _('NVS Mode Panel')}},
{	down = hydraulic_commands.TailWheelUnLock_EXT,	up = hydraulic_commands.TailWheelUnLock_EXT,	cockpit_device_id = devices.HYDRO_INTERFACE,	value_down =  1.0,	value_up = 0.0,	name = _('TAIL WHEEL Pushbutton - LOCK/UNLOCK'),	category = {_('Left Console'), _('NVS Mode Panel')}},

Awesome, that sounds like exactly what I'm looking for.

The lines for NVS_MODE_KNOB_ITER are probably the "one step up" and "one step down" iterators, I don't care about those.

The three lines NVS_MODE_KNOB_EXT look great, because they're labeled "FIXED", "NORM" and "OFF". Exactly what I'm looking for. Personally, I'm not interested in the FIXED position, that leaves me with the two lines for NORM and OFF.

These switches only react to the down position, so "when the button is pressed on the controller". I want to add "when the button is released" to the mix, known as the "up" command.

Merging the two lines I care about into a single, new line with both the up and down commands looks like this:

---------------------------------------------
-- Controller Overrides ---------------------
---------------------------------------------
{ down = electric_commands.NVS_MODE_KNOB_EXT, up = electric_commands.NVS_MODE_KNOB_EXT, cockpit_device_id = devices.ELEC_INTERFACE, value_down = 0.0, value_up = -1.0, name = _('PLT NVS MODE Switch - NORM<>OFF'), category = {_('Left Console'), _('NVS Mode Panel')}},

And that's it. Personally, I add these blocks near the top of the file so I can easily see what I've added.

Save the default.lua.

Now let's fire up DCS and assign the keybind to the switch we want to map:

image.png

Works like a charm. 🙂

Final word of caution: during updates, DCS overwrites these files without asking you about it, so you need to re-apply this fix after every update. Best to make backups of the original files and of the modified ones, so you can just copy and paste your modifications when ED changes the default.lua.

Note, if there's a way to modify these files in Saved Games, that would be marvelous, but last I checked these modifications still had to go to the installation directory.

Note, as far as I'm aware this does not break the multiplayer integrity check, but do keep in mind that it's a modification to the game's base files.

Note, I'll be posting this to a thread of its own so it doesn't get buried, so don't wonder when you read the same sermon again in another place. 😉

  • Like 1
  • Thanks 1
Link to comment
Share on other sites


	- Collective searchlight switch
137	{	down = hotas_commands.FLIGHT_SEARCHLIGHT_SW_UP,	up = hotas_commands.FLIGHT_SEARCHLIGHT_SW_UP,	cockpit_device_id = devices.HOTAS_INPUT,	value_down =  1.0,	value_up = 0.0,	name = _('Searchlight Switch - ON/OFF'),		category = {_('Collective Stick'), _('Flight Grip'), _('HOTAS'), _('Abstraction')}},

	- External light Panel
241	{	down = extlights_commands.NavLights_EXT,	up = extlights_commands.NavLights_EXT,		cockpit_device_id = devices.EXTLIGHTS_SYSTEM,	value_down =  1.0,	value_up = 0.0, name = _('Navigation Lights Switch - BRIGHT/OFF'),	category = {_('EXT LT/INTR LT Panel'), _('Abstraction')}},
	{	down = extlights_commands.NavLights_EXT,	up = extlights_commands.NavLights_EXT,		cockpit_device_id = devices.EXTLIGHTS_SYSTEM,	value_down = -1.0,	value_up = 0.0, name = _('Navigation Lights Switch - DIM/OFF'),		category = {_('EXT LT/INTR LT Panel'), _('Abstraction')}},

501	{	down = extlights_commands.AntiCollLights_EXT,	up = extlights_commands.AntiCollLights_EXT,	cockpit_device_id = devices.EXTLIGHTS_SYSTEM,	value_down =  1.0,	value_up = 0.0, name = _('Anti-Collision Lights Switch - WHT/OFF'),	category = {_('EXT LT/INTR LT Panel'), _('Abstraction')}},
	{	down = extlights_commands.AntiCollLights_EXT,	up = extlights_commands.AntiCollLights_EXT,	cockpit_device_id = devices.EXTLIGHTS_SYSTEM,	value_down = -1.0,	value_up = 0.0, name = _('Anti-Collision Lights Switch - RED/OFF'),	category = {_('EXT LT/INTR LT Panel'), _('Abstraction')}},

	- Rotor Brake Switch
535	{	down = hydraulic_commands.Rotor_Brake_Sw_EXT,	up = hydraulic_commands.Rotor_Brake_Sw_EXT,	cockpit_device_id = devices.HYDRO_INTERFACE,	value_down =  1.0,	value_up = 0.0,	name = _('Rotor Brake Switch - OFF/BRK'),		category = {_('Left Console'), _('Power Lever Quadrant'), _('Abstraction')}},
	{	down = hydraulic_commands.Rotor_Brake_Sw_EXT,	up = hydraulic_commands.Rotor_Brake_Sw_EXT,	cockpit_device_id = devices.HYDRO_INTERFACE,	value_down = -1.0,	value_up = 0.0,	name = _('Rotor Brake Switch - LOCK/BRK'),		category = {_('Left Console'), _('Power Lever Quadrant'), _('Abstraction')}},

Line# Create a new category named "Abstraction"

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

  • Recently Browsing   0 members

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