Jump to content

How to set up toggle switches (a tutorial)


Recommended Posts

this work only with Throttle - Hotas Warthog???Cause i have an BU0836X and i want to make the same there

No, the subjects we discuss here apply to all game controllers.

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to comment
Share on other sites

Ι went to C:\Users\Constantinos\Saved Games\DCS\Config\Input\UH-1H\joystick

 

and i see only Hotas X profile not BU0836X profile.Any one can help?

You define your control bindings under Options/Controls and save. Then you will see the saved profile for your game controller

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to comment
Share on other sites

Thanks so much for the great resource. I have a slight issue though when I open my \Saved Games\DCS.openbeta\Config\Input\FA-18C_hornet\joystick\Throttle- HOTAS Warthog.diff.lua it looks nothing like what all is posted here. Instead my code looks like:

 

["added"] = {

[1] = {

["key"] = "JOY_BTN27",

},

},

["name"] = "RADAR Switch - OPR",

},

 

Am I opening the wrong file?

Link to comment
Share on other sites

Am I opening the wrong file?

Yes certainly. You do not want to edit these files under "...Saved Games\...\Config\Input\..."!

The files like "default.lua" are under (for example) "X:\Eagle Dynamics\DCS World\Mods\aircraft\FA-18C\Input\FA-18C\joystick".

And it's only the ".lua" - not the ".diff.lua"!

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to comment
Share on other sites

  • 3 weeks later...

How to set up toggle switches (a tutorial)

 

Would there be a way to map VR Zoom to a toggle switch? When the switch is up zoom is on. Switch in down position zoom off.

 

Or a single button for that matter? Press the button once VR Zoom on. Press again = off.

 

I find it impossible to see the meatball when using a rift


Edited by Alligin
Link to comment
Share on other sites

I have added this to Config\Input\UiLayer\joystick\default.lua and to Config\Input\UiLayer\keyboard\default.lua :

 

{down = iHeadTrackerZoomToggle															, value_down = 1.0						, name = _("VR Zoom IN")				, category = vr},
{down = iHeadTrackerZoomToggle															, value_down = 0.0						, name = _("VR Zoom OUT")				, category = vr},

 

I didn't try in VR yet but it works in the Controls Edition window

Zip - VEAF :pilotfly:

 

If you want to learn, talk and fly with french-speaking friends, the Virtual European Air Force is here for you ! Meet us on our Discord and our forum

If you're a mission creator, you may want to check the VEAF Mission Creation Tools (and its GitHub repository) a set of open-source scripts and tools that make creating a dynamic mission a breeze !

Link to comment
Share on other sites

I have added this to Config\Input\UiLayer\joystick\default.lua and to Config\Input\UiLayer\keyboard\default.lua :

 

 

 


{down = iHeadTrackerZoomToggle, value_down = 1.0, name = _("VR Zoom IN"), category = vr},

{down = iHeadTrackerZoomToggle, value_down = 0.0, name = _("VR Zoom OUT"), category = vr},

 

 

 

I didn't try in VR yet but it works in the Controls Edition window

 

 

 

Thanks.

I’ll give that a try at the weekend

Link to comment
Share on other sites

  • 1 month later...

Lecuvier,

 

Any chance you could convert these to work as 2/3 position switches. In other words allow a three position switch to use "off" in the middle"?

 

{down = device_commands.GEAR_Strut, 		cockpit_device_id = devices.GEARHOOK, value_down = -1, name = _('-Nose Strut Compression Switch KNEEL'), category = { _('-MODIFICATIONS')}},
{down = device_commands.GEAR_Strut, 		cockpit_device_id = devices.GEARHOOK, value_down = 0, name = _('-Nose Strut Compression Switch OFF'), category = { _('-MODIFICATIONS')}},
{down = device_commands.GEAR_Strut, 		cockpit_device_id = devices.GEARHOOK, value_down = 1, name = _('-Nose Strut Compression Switch EXTEND'), category = { _('-MODIFICATIONS')}},

Link to comment
Share on other sites

Thanks so much for the great resource. I have a slight issue though when I open my \Saved Games\DCS.openbeta\Config\Input\FA-18C_hornet\joystick\Throttle- HOTAS Warthog.diff.lua it looks nothing like what all is posted here. Instead my code looks like:

 

["added"] = {

[1] = {

["key"] = "JOY_BTN27",

},

},

["name"] = "RADAR Switch - OPR",

},

 

Am I opening the wrong file?

 

yes, i asked that as a feature request. to be able to map actions to button release. but not many votes to it while this topic gets bigger. i don't know if it is still possible with the saved games folder file, the code is different. if you find the needle in the haystack then you will read that you need to go the main game folder.

:pilotfly:

i7-920, 12 GB DDR3 1600, Gigabyte x58 ud3r, Gigabyte GTX 970 OC, 2x500GB SSD+1x250ssd, TrackIR 5 clip, screen 42 inches, and 21 inches, Thrustmaster Warthog throttle and stick,t500rs,th8 shifter, Saitek Pro throttle, x controller, G11 keys

Link to comment
Share on other sites

Lecuvier,

 

Any chance you could convert these to work as 2/3 position switches. In other words allow a three position switch to use "off" in the middle"?

 

{down = device_commands.GEAR_Strut, 		cockpit_device_id = devices.GEARHOOK, value_down = -1, name = _('-Nose Strut Compression Switch KNEEL'), category = { _('-MODIFICATIONS')}},
{down = device_commands.GEAR_Strut, 		cockpit_device_id = devices.GEARHOOK, value_down = 0, name = _('-Nose Strut Compression Switch OFF'), category = { _('-MODIFICATIONS')}},
{down = device_commands.GEAR_Strut, 		cockpit_device_id = devices.GEARHOOK, value_down = 1, name = _('-Nose Strut Compression Switch EXTEND'), category = { _('-MODIFICATIONS')}},

 

for which module is that?


Edited by stefaanadriansens

:pilotfly:

i7-920, 12 GB DDR3 1600, Gigabyte x58 ud3r, Gigabyte GTX 970 OC, 2x500GB SSD+1x250ssd, TrackIR 5 clip, screen 42 inches, and 21 inches, Thrustmaster Warthog throttle and stick,t500rs,th8 shifter, Saitek Pro throttle, x controller, G11 keys

Link to comment
Share on other sites

Lecuvier,

 

Any chance you could convert these to work as 2/3 position switches. In other words allow a three position switch to use "off" in the middle"?

 

{down = device_commands.GEAR_Strut,         cockpit_device_id = devices.GEARHOOK, value_down = -1, name = _('-Nose Strut Compression Switch KNEEL'), category = { _('-MODIFICATIONS')}},
{down = device_commands.GEAR_Strut,         cockpit_device_id = devices.GEARHOOK, value_down = 0, name = _('-Nose Strut Compression Switch OFF'), category = { _('-MODIFICATIONS')}},
{down = device_commands.GEAR_Strut,         cockpit_device_id = devices.GEARHOOK, value_down = 1, name = _('-Nose Strut Compression Switch EXTEND'), category = { _('-MODIFICATIONS')}},

 

 

Try this:

{down = device_commands.GEAR_Strut, up = device_commands.GEAR_Strut, cockpit_device_id = devices.GEARHOOK, value_down = -1, value_up = 0, name = _('-Nose Strut Compression Switch KNEEL/OFF'), category = { _('-MODIFICATIONS')}},
{down = device_commands.GEAR_Strut, up = device_commands.GEAR_Strut, cockpit_device_id = devices.GEARHOOK, value_down = 1, value_up = 0, name = _('-Nose Strut Compression Switch EXTEND/OFF'), category = { _('-MODIFICATIONS')}},

I could not test because I don't know what aircraft it's for (and if it's the Mig-19, I don't have that anyway). But it should work.

Edit: I had the commands KNEEL and EXTEND reversed. Corrected now.


Edited by LeCuvier

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to comment
Share on other sites

yes, i asked that as a feature request. to be able to map actions to button release. but not many votes to it while this topic gets bigger. i don't know if it is still possible with the saved games folder file, the code is different. if you find the needle in the haystack then you will read that you need to go the main game folder.

Not sure what the question or message is here. I answered Legendofdino's question on 14-JAN-2019.

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to comment
Share on other sites

Try this:

{down = device_commands.GEAR_Strut, up = device_commands.GEAR_Strut, cockpit_device_id = devices.GEARHOOK, value_down = -1, value_up = 0, name = _('-Nose Strut Compression Switch KNEEL/OFF'), category = { _('-MODIFICATIONS')}},
{down = device_commands.GEAR_Strut, up = device_commands.GEAR_Strut, cockpit_device_id = devices.GEARHOOK, value_down = 1, value_up = 0, name = _('-Nose Strut Compression Switch EXTEND/OFF'), category = { _('-MODIFICATIONS')}},

I could not test because I don't know what aircraft it's for (and if it's the Mig-19, I don't have that anyway). But it should work.

Edit: I had the commands KNEEL and EXTEND reversed. Corrected now.

 

works great!

thanks!!

Link to comment
Share on other sites

BIG THANK YOU!!! For such a useful post. I was able to assign speedbrake to one button (push to activate) in all of my modules.

 

But I was looking for a way to stop Updater to overwrite original "default.lua" files in Mods folder. Just wanted to keep it all "maintenance free". Just wanted updater to update all files in Mods/input folders without deleting my custom keybinds.

 

And I think I found an easy, quick solution.

 

I'm using Logitech x-56. This example is for A10-c module. You have to do the same for every module you want to add custom keybinds.

 

Created new .lua file in Mods/aircraft/A-10C/input/A-10C/joystick and called it "Saitek Pro Flight X-56 Rhino Throttle.lua" (the name has to be the same as DCS world using). And put this text into it, where the middle line are Your custom keybinds. Make sure there is the correct path to "default.lua" file in the first line (has to be different for each module).

 

---------------------------------------------------------------------------------------------------

local res = external_profile("Mods/aircraft/A-10C/Input/A-10C/joystick/default.lua")

 

join(res.keyCommands,{

 

{down = iCommandPlane_HOTAS_SpeedBrakeSwitchAft, up = iCommandPlane_HOTAS_SpeedBrakeSwitchForward, name = _('HOTAS Speed Brake Switch CUSTOM'), category = _('HOTAS')},

 

})

 

return res

---------------------------------------------------------------------------------------------------

 

The situation is a bit more complicated if You are using hotas already included in default profiles, eg: "Joystick - HOTAS Warthog.lua" or "Throttle - HOTAS Warthog.lua" as i believe these files are overwritten with an update.

 

In this situation, You can rename Your controller in the registry. And create .lua file with a new name. And change the first line with "YourController.lua" instead odf "default.lua.

 

Sorry for my english, and please do not hesitate to ask if You have any questions.

 

Thanks.


Edited by jarekzegarek
Link to comment
Share on other sites

Yes, this method works well as long as DCS World has no controller-specific files. However, it's not a problem for most of us anyway as we use OvGME to back out the modded files before an update and reinstate them afterwards.

 

And that works not only for the default.lua but also for other modified files.

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to comment
Share on other sites

LeCuvier,

 

Your ongoing support is greatly appreciated. I've been building button boxes and just when I think I get the lua programming figured out I hit another wall. You've helped me in the past with the A-10c and I need your help again :)

I'm trying to program the lua for the following switch options to be used with my button box so I'm guessing I need to be changing the Keyboard lua file:

what I need for the A-10C:

 

anti collision 2 way: On, else off

accel and comp 2 way: on, else off

signal lights 2 way: Bright, else dim

nose illum 2 way: on, else off

 

I can't quite seem how to get a dedicated on/off versus just a toggle switch state?

 

I think I can reverse engineer the rest of my switches if I get samples of these.

 

thanks again LeCuvier!!


Edited by epolta
content
Link to comment
Share on other sites

@epolta: I will do a few tonight, will continue tomorrow.

1. Landing/Taxi Light:

-- Landing/Taxi Lights 3-Position

{down = iCommandPlaneLGPLandLight, up = iCommandPlaneLGPLightsOff, name = _('Landing Lights ON/OFF'), category = _('Landing gear panel')},
{down = iCommandPlaneLGPTaxiLight, up = iCommandPlaneLGPLightsOff, name = _('Taxi Lights ON/OFF'), category = _('Landing gear panel')},

2. Anti-Skid: I cannot make it work

3, Master Arm

{down = iCommandPlaneAHCPMasterArm, up = iCommandPlaneAHCPMasterSafe,name = _('Master switch 2-Pos ARM/SAFE'), category = _('Armament HUD Control Panel')},

4. GunPac 3-position:

{down = iCommandPlaneAHCPGUNPACArm, up = iCommandPlaneAHCPGUNSafe, name = _('GUN/PAC switch 3-Pos ARM/SAFE'), category = _('Armament HUD Control Panel')},
{down = iCommandPlaneAHCPGUNArm, up = iCommandPlaneAHCPGUNSafe,    name = _('GUN/PAC switch 3-Pos GUNARM/SAFE'), category = _('Armament HUD Control Panel')},

Now it seems that you have changed your wishlist while I was testing. Does that mean you don't need the items on your original list any more?

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to comment
Share on other sites

LeCuvier,

So sorry! after I posted I started playing around some more and found a few others you had done for me in the past. I got those working so I edited the list (shortened it a bit). Once again I apologize if I wasted your time. As always, thanks so much for helping!!!

Link to comment
Share on other sites

I could provide these 3 commands:

{down = 3012, up = 3012, cockpit_device_id = 49, value_down = 1.0,    value_up = -1.0, name = _('Nose Light 2-Pos switch ON/OFF'), category = _('Lighting Panel')},
{down = 3004, up = 3004, cockpit_device_id = 49, value_down = 1.0,    value_up = -1.0, name = _('Accel & Compass Light 2-Pos Bright/DIM'), category = _('Lighting Panel')},
{down = 3013, up = 3013, cockpit_device_id = 49, value_down = 1.0,    value_up = -1.0, name = _('Signal Lights 2-Pos BRIGHT/DIM'), category = _('Lighting Panel')},

Note:

I verified that the 3 switches respond to my button box switches. However I could not see the nose lighting. Also I did not test the signal lights function as it only changes the brightness of the warning lights. I did see the accelerometer and compass light changes.

 

The anti-collision light and anti-skid switches seem to work only in toggle mode. In "clickabledata.lua" they use the function type "electrically_held_switch" and they have 2 command codes each. The 3 commands I could change use the function type "default_2_position_tumb".

The anti-collision light switch is clearly not a mechanically maintained ON/OFF switch. It's electrically interlocked with the pinky switch. It does not stay in the ON position if the pinky switch is OFF. So you should use a pushbuton for this type of commands.

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to comment
Share on other sites

  • 2 months later...

I made an interesting discovery while messing about with input default.lua files the other day...

 

You can actually include the 'pressed' state with a line of code to combine all 3 input states into one binding.

 

Works very well with momentary toggles and buttons, or standard toggles that are programmed to send a 'pulse'. And especially useful for in-game switches with covers, you can combine the entire cover and switch actions into one binding.

 

A few examples from my own files:

 

Mi-8 Fuel Shutoff Valve Switches & Covers

{down=3009, pressed=3001, up=3009, cockpit_device_id=devices.FUELSYS_INTERFACE, value_down=1, value_pressed=1, value_up=0,				name=_('Left Shutoff Valve Switch & Cover - OPEN ► ON ► CLOSE'),			category=_('[11] Centre Overhead Panel - Fuel System')},
{down=3009, pressed=3001, up=3009, cockpit_device_id=devices.FUELSYS_INTERFACE, value_down=1, value_pressed=0, value_up=0,				name=_('Left Shutoff Valve Switch & Cover - OPEN ► OFF ► CLOSE'),			category=_('[11] Centre Overhead Panel - Fuel System')},
{down=3010, pressed=3002, up=3010, cockpit_device_id=devices.FUELSYS_INTERFACE, value_down=1, value_pressed=1, value_up=0,				name=_('Right Shutoff Valve Switch & Cover - OPEN ► ON ► CLOSE'),			category=_('[11] Centre Overhead Panel - Fuel System')},
{down=3010, pressed=3002, up=3010, cockpit_device_id=devices.FUELSYS_INTERFACE, value_down=1, value_pressed=0, value_up=0,				name=_('Right Shutoff Valve Switch & Cover - OPEN ► OFF ► CLOSE'),			category=_('[11] Centre Overhead Panel - Fuel System')},

 

You can also combine down & pressed on their own and flick 2 switches simultaneously...

 

Mi-8 Batteries 1 & 2

{down=device_commands.Button_3,pressed=device_commands.Button_2,cockpit_device_id=devices.ELEC_INTERFACE,value_down=1,value_pressed=1, 	name=_('Battery 1+2 Switches - ON'),										category=_('[06] Right Side Panel')},
{down=device_commands.Button_3,pressed=device_commands.Button_2,cockpit_device_id=devices.ELEC_INTERFACE,value_down=0,value_pressed=0, 	name=_('Battery 1+2 Switches - OFF'),										category=_('[06] Right Side Panel')},

 

This ability opens up an extra level of flexibility that I was previously unaware of. And can be used quite creatively to to better utilize button and switch real-estate.

 

F/A-18C Parking Brake, twist & Pull in one pulsed action

{down=gear_commands.EmergParkHandleSelectPark,pressed=gear_commands.EmergParkHandleOnOff,up=gear_commands.EmergParkHandleSelectPark,cockpit_device_id=devices.GEAR_INTERFACE,value_down=1.0,value_pressed=-1.0,value_up=0.0,name=_('Emergency/Parking Brake Handle [3 Action Special] - CCW+Pull'),category=_('[13] Front Left - Vertical Panel')},

 

I hope some of you find this useful.

 

Cheers,

Brick.

9700k@5.2Ghz | GTX 1080ti | 32gb Ram@3200Mhz | 512gb M.2 NVME SSD

Oculus Rift S | VKB GF Pro Mk.II+MCG Pro (rotary wing) | BRD DS-Raven (fixed wing) | MFG Crosswind V2 | Jetseat+SSA/SSM | SimLab GT1 80/20 Rig | NLR Motion Platform V3 | Quad Bass Shaker Setup

DIY Control Panels: 'White Rhino' Throttle | UFC | MFBB Left | MFBB Right | MFBB Centre | WEP-TECH ACP | HYD-MECH LDG | SYS-ELEC | AN/ARC Radio

Link to comment
Share on other sites

Very interesting discovery, I'm sure I will use this!

Thanks for publishing!

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to comment
Share on other sites

  • Recently Browsing   0 members

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