Jump to content

How to set up toggle switches (a tutorial)


Recommended Posts

Hi,

I cannot reasonably state to know what exactly I am doing while tampering with the lua-files here, however:

I want to program the warthog-throttle in a way that BTN29 gives me a behaviour like the throttle of the Fw190:

When the throttle is pulled over the notch towards IDLE (BTN29 activated) the engine should be CUTOFF, when pulled over the notch towards increasing throttle, it should trigger 'Throttle to start'.

According to the HOWTO I inserted a line into the default.lua:

 

{combos = {{key = 'JOY_BTN29'}}, cockpit_device_id = devices.ENGINE_SYSTEM, down = device_commands.Button_1, value_down = 1.0, up = device_commands.Button_2, value_up = 0.0, name = _('Engine CUTOFF'), category = _('Engine Control')},

 

Obviously, it didn't work. Any hints?

 

Regards,

flankerrider

You didn't tell for which airplane, so I can only provide a general answer. The contact on the WH throttle closes when you pull the throttle back to the OFF position. It is not a "Start" but a "Cutoff" switch.

Further, you want to produce a "Start" command when the throttle is pushed "over the notch" to IDLE and a "Stop" command when the throttle is pulled back to the OFF position.

So for the FW-190 I have added this line to the "Throttle - HOTAS Warthog.lua":

{down = iCommandLeftEngineStop, up = iCommandLeftEngineStart, name = _('Throttle 2-Pos. OFF/IDLE'), category = _('Engine Control')},

For the Bf-109 it's:

{down = device_commands.Button_6, up = device_commands.Button_6, cockpit_device_id = devices.ENGINE_CONTROLS, value_down = 1.0, value_up = 0.0, name = _('Engine Cut-Off 2-Pos. ON/OFF'), category = _('Fuel System Controls')},

These lines provide new binding options which you must bind in Options --> Controls.

Note: for some aiplanes you don't need to customize; just select the right binding option.

If you tell me for which airplane you want to do customize, hopefully I have that module and then I can find out what works. If you actually want the answer for the FW-190 then the first code example above will work for you.


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

Hi LeCuvier,

 

Thanks for the exhaustive answer; very much appreciated! Actually, in the headline, I stated that I was looking for a solution for the FW190D, but you guessed it anyhow. And thanks for the code also for the Bf109.

I'll program the Warthog.lua and the default.lua right away...

 

flankerrider

flankerrider


CPU | AMD Ryzen 5900X | Gigabyte B550 Aorus Elite | NVIDIA GeForce GTX 1080 Graphics | ASUS 1080 | Storage | Crucial_CT1050MX300SSD1 (1TB, SATA600, 2.5", SSD, OPAL, SED) | SAMSUNG MZVPV512HDGL-00000 (512.1GB, PCIe3x4/NVMe, M.2, SSD, SED) Wheelbase | Fanatec Clubsport V2 Wheels | Fanatec Podium Classic | Fanatec Clubsport Pedals V2 | Fanatec ClubSport Shifter SQ V 1 Monitor | LG 2560x1080 VR Headset | HP Reverb VR1000 2nd batch | TM Warthog HOTAS | MFG Crosswind Pedals | Recaro-seat (ex-Lancia) | MonsterTech Rig |

Link to comment
Share on other sites

  • 2 weeks later...

Hi guys,

 

Thanks to this thread I manged to setup regular toggle switches without problems.

 

However I have now a new challenge :

 

I would like a button (so short press of a joystick button) to open the map when I click it once (F10) and then go back to F1 view when I click it the second time ? It is possible to do this by editing .lua ?

 

I don't want to change the function of the button using autokey or something else. because it is also used to show the map in another sim. But in this other sim, map is open and closed by pressing the same button, and this otehr sim has much less customization of controls than DCS.

Link to comment
Share on other sites

Hi guys,

 

Thanks to this thread I manged to setup regular toggle switches without problems.

 

However I have now a new challenge :

 

I would like a button (so short press of a joystick button) to open the map when I click it once (F10) and then go back to F1 view when I click it the second time ? It is possible to do this by editing .lua ?

 

I don't want to change the function of the button using autokey or something else. because it is also used to show the map in another sim. But in this other sim, map is open and closed by pressing the same button, and this otehr sim has much less customization of controls than DCS.

 

I don.t see a way to achieve this by editing the .lua file. It should be possible to display the F10 view by pressing and holding the pushbutton, and going back to F1 view when you release it.

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

Hi,

 

has someone a solution for the Mirage/Hawk Radio/Ils/Tcn frequencies ?

i would prefer a solution by a rotary to increase/decrease values ...

 

have someone an example for i.e. for one frequency or preset knob ... my ideas are gone :(

 

best regards

Alf


Edited by caponi

too much ...

 

 

Link to comment
Share on other sites

Hi guys,

 

Thanks to this thread I manged to setup regular toggle switches without problems.

 

However I have now a new challenge :

 

I would like a button (so short press of a joystick button) to open the map when I click it once (F10) and then go back to F1 view when I click it the second time ? It is possible to do this by editing .lua ?

 

I don't want to change the function of the button using autokey or something else. because it is also used to show the map in another sim. But in this other sim, map is open and closed by pressing the same button, and this otehr sim has much less customization of controls than DCS.

 

I have a Theater Map glance command I use that's close to what you're after. But, it'll display the F10 map only while you hold the button down. Once you release it the view will switch back to cockpit.

 

{down = iCommandViewAWACS, up = iCommandViewCockpit, name = _('F10 theater map GLANCE'), category = { _('Toggle Switches'), _('View')}},

 

I've set it to appear in the "View" category and a "Toggle Switches" category that I use for my other toggles.

(JTF-1) Yomo | 55th FS

 

JTF-1 Discord

 

 

Asus Prime Z370 MB // Intel i7 8086k @ 5GHz // 32GB DDR4 3200 // RTX 2080ti // Virpil FSSB3 Lighting, Cougar Throttle with USB mod, T-50 Base + Warthog HOTAS, custom collective // Thrustmaster TPR // Vipergear v2 ICP // 3xCougar MFDs // a bunch of DIY Button Boxes // Oculus Rift

 

Link to comment
Share on other sites

Hi,

 

has someone a solution for the Mirage/Hawk Radio/Ils/Tcn frequencies ?

i would prefer a solution by a rotary to increase/decrease values ...

 

have someone an example for i.e. for one frequency or preset knob ... my ideas are gone :(

 

best regards

Alf

Hallo Alf,

I don't fly my M2000 at all, but out of curiosity I looked into your question. The good news: it's possible to change the channel/frequency settings with switch inputs by making additions to the "default.lua", based on what you find in "clickabledata.lua".

The bad news: The way these multi-position switches in the cockpit are programmed you need one pushbutton for every switch position. Here is what I added to my "default.lua" for testing:

-- additions HWF 08-MAY-2018
-- VOR/ILS works in principle but frequency display does not update correctly
{down = 3616, cockpit_device_id = 24, value_down = 0.1, name = _('VOR/ILS Frequency Whole 1'), category = _('Frequencies')},
{down = 3616, cockpit_device_id = 24, value_down = 0.2, name = _('VOR/ILS Frequency Whole 2'), category = _('Frequencies')},
{down = 3616, cockpit_device_id = 24, value_down = 0.3, name = _('VOR/ILS Frequency Whole 3'), category = _('Frequencies')},
{down = 3616, cockpit_device_id = 24, value_down = 0.4, name = _('VOR/ILS Frequency Whole 4'), category = _('Frequencies')},
{down = 3616, cockpit_device_id = 24, value_down = 0.5, name = _('VOR/ILS Frequency Whole 5'), category = _('Frequencies')},
{down = 3616, cockpit_device_id = 24, value_down = 0.6, name = _('VOR/ILS Frequency Whole 6'), category = _('Frequencies')},
--TACAN Tens works
{down = 3623, cockpit_device_id = 23, value_down = 0.076923, name = _('TACAN Channel Tens 1st'), category = _('Frequencies')},
{down = 3623, cockpit_device_id = 23, value_down = 0.153846, name = _('TACAN Channel Tens 2nd'), category = _('Frequencies')},
{down = 3623, cockpit_device_id = 23, value_down = 0.230769, name = _('TACAN Channel Tens 3rd'), category = _('Frequencies')},
{down = 3623, cockpit_device_id = 23, value_down = 0.307692, name = _('TACAN Channel Tens 4th'), category = _('Frequencies')},
_Radio frequencies
{down = 3440, cockpit_device_id = 19, value_down = 0.1, name = _('U/VHF 100 MHz Select 1'), category = _('Frequencies')},
{down = 3440, cockpit_device_id = 19, value_down = 0.2, name = _('U/VHF 100 MHz Select 2'), category = _('Frequencies')},
{down = 3440, cockpit_device_id = 19, value_down = 0.3, name = _('U/VHF 100 MHz Select 3'), category = _('Frequencies')},
{down = 3440, cockpit_device_id = 19, value_down = 0.4, name = _('U/VHF 100 MHz Select 4'), category = _('Frequencies')},

You see that all switch positions are are defined as absolute values, not as increment/decrement. Therefore it is not possible to create a command that would increment/decrement by one position at a time.

Notes:

1. while it's possible to change the position of the VOR wholes, the display does not update in all positions

2. in the cockpit the UVHF 100 MHz can only cylcle through 1...3. With the mod you could actually set it to 4 which might cause unpredictable results.

 

My conclusions:

It's not possible/practical to dedicate so many buttons just for frequency/channel selection. So one has to make these settings by clicking in the cockpit

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

That's what I found out ... :(

I feared it and take one or the other work around :cry:

 

it is anoying to have 40 fix buttons for 2 * 20 presets in 2 rotaries

 

Could someone help us from ED ?

 

what is the interface for these clockwise/counterclockwise things ?

 

thx in advance ...

too much ...

 

 

Link to comment
Share on other sites

Ive used the expertise here before for switching solutions. I cant seem to find the default.lua files now iv gone to 2.5 and 2.5OB. I need to tweak the AV8 Master Arm switch... Help please

The file location is unchanged in 2.5.0 and 2.5.1:

"...\Eagle Dynamics\DCS World OpenBeta\Mods\aircraft\AV8BNA\Input\AV8BNA\joystick"

 

Edit: Just had a look and it's disapppointing that RAZBAM hasn't provided an option to bind a maintained 2-position switch to Master Arm.

And you have to look into several .lua files to collect the information for creating this command option. This works for me:

{down = 3287, up = 3287, cockpit_device_id = 29, value_down = 1, value_up = 0, name = _('Master Arm 2-Pos ARM/SAFE'), category = _('Armament Control')},

Just tested and it operates the switch up and down.

 

Edit #2: I had tested in Open Beta 2.5.1. and copied the default.lua to 2.5.0, and guess what: It didn't work! The reason is that the cockpit_device_id has changed. In 2.5.0 you have to use 28 instead of 29.

This is because in 2.5.1 a new device ID has been inserted after 24. This means that any mod that uses device ID's higher than 24 are not compatible between the two versions ARRRRGH!

And I see that the device "AUTOSTART" has been added and the related control bindings are available but not working. I could not find the required file "Macro_sequencies.lua" under ...\Cockpit\Scripts, so that is WIP.


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

hmmmmm... My default.lua looks different (hence me thinking I was in the wrong place.) My directory structure is a little different as I chose to install 2.5.1Open beta in a diff drive from the Eagle Dynamics Directory. eg

D:\DCS World OpenBeta\Mods\aircraft\AV8BNA\Input\AV8BNA\joystick

 

The code in my default.lua looks like this:

 

{down = iCommandSwitchMasterArm, name = _('Master Arm Switch'), category = _('Armament Control')},

 

I cant seem to find similar code to what you posted in any of my folders...? Have I screwed up by changing the default installation directory ??

Occulus Rift i7-7700 3.6Ghz 16GB Ram 1080Ti 11GB SSDx2

Link to comment
Share on other sites

 

I cant seem to find similar code to what you posted in any of my folders...? Have I screwed up by changing the default installation directory ??

I added this line! Because...

You indicated you wanted to tweak the AV8B Master Arm switch. I assumed you wanted it to work as a maintained ON/OFF switch like in the cockpit.

That's what my added line does.

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

I added this line! Because...

You indicated you wanted to tweak the AV8B Master Arm switch. I assumed you wanted it to work as a maintained ON/OFF switch like in the cockpit.

That's what my added line does.

 

Thanks. I just didnt recognise the code as the only ones i edited were on the UH1H and FW190 which 'look' a bit different...

 

Anyhow, that suggestion didnt work for me, but I trolled back through the forum and re-discovered your link to "how to edit control bindings". In there I found this (new since I last read) and it works perfectly with the AV8 in 2.5

 

Orig Code: {down = iCommandSwitchMasterArm, name = _('Master Arm Switch'), category = _('Armament Control')},

 

New Code: {down = iCommandSwitchMasterArm, up = iCommandSwitchMasterArm, name = _('Master Arm 2-Pos ARM/SAFE'), category = _('Armament Control')}, -- use with ON/OFF switch

Occulus Rift i7-7700 3.6Ghz 16GB Ram 1080Ti 11GB SSDx2

Link to comment
Share on other sites

@vortexringstate:

Yes that method works on some airplanes but it has sometimes produced a situation where my switch was ON while the cockpit showed it OFF and vice versa. Depends on the situation at mission start.

The code I proposed earlier works for 2.5.1.

For 2.5.0 you have to use a different device ID (28 instead of 29):

{down = 3287, up = 3287, cockpit_device_id = 28, value_down = 1, value_up = 0, name = _('Master Arm 2-Pos ARM/SAFE'), category = _('Armament Control')},

That method is more "robust". But if the other one works for you - fine!

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

Allow another 'beginner'-question inbetween: Do you guys use the default.lua's to configure your HOTAS completely?

In other words: If I create default.lua's adapted to my HOTAS and replace the original ones, does that relieve me completely from configuring in the game with the options menu?

 

flankerrider

flankerrider


CPU | AMD Ryzen 5900X | Gigabyte B550 Aorus Elite | NVIDIA GeForce GTX 1080 Graphics | ASUS 1080 | Storage | Crucial_CT1050MX300SSD1 (1TB, SATA600, 2.5", SSD, OPAL, SED) | SAMSUNG MZVPV512HDGL-00000 (512.1GB, PCIe3x4/NVMe, M.2, SSD, SED) Wheelbase | Fanatec Clubsport V2 Wheels | Fanatec Podium Classic | Fanatec Clubsport Pedals V2 | Fanatec ClubSport Shifter SQ V 1 Monitor | LG 2560x1080 VR Headset | HP Reverb VR1000 2nd batch | TM Warthog HOTAS | MFG Crosswind Pedals | Recaro-seat (ex-Lancia) | MonsterTech Rig |

Link to comment
Share on other sites

Allow another 'beginner'-question inbetween: Do you guys use the default.lua's to configure your HOTAS completely?

In other words: If I create default.lua's adapted to my HOTAS and replace the original ones, does that relieve me completely from configuring in the game with the options menu?

 

flankerrider

No, The additions we make to the "default.lua" provide additional command options. These must be bound to buttons/switches etc. just like the stock options.

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

One question.

I´m trying to set the L-39 "landing switch" to the Warthog Pinkie in the throttle.

 

Something like this:

{down = iCommandPlane_SpotSelect_switch, value_down = 1.0, value_up = 0.0, name = _('3pos Spotlight Switch - LANDING'), category = {_('Systems')}},

{down = iCommandPlane_SpotSelect_switch, value_down = -1.0, value_up = 0.0, name = _('3pos Spotlight Switch - Taxi'), category = {_('Systems')}},

 

The original LUA:

 

{down = iCommandPlane_SpotSelect_switch, value_down = 1.0, name = _('Spotlight Switch - LANDING'), category = {_('Systems')}},

{down = iCommandPlane_SpotSelect_switch, value_down = -1.0, name = _('Spotlight Switch - TAXI'), category = {_('Systems')}},

{down = iCommandPlane_SpotSelect_switch, value_down = 0.0, name = _('Spotlight Switch - OFF'), category = {_('Systems')}},

 

 

But doesn´t work. Any ideas?

Link to comment
Share on other sites

One question.

I´m trying to set the L-39 "landing switch" to the Warthog Pinkie in the throttle.

 

Something like this:

{down = iCommandPlane_SpotSelect_switch, value_down = 1.0, value_up = 0.0, name = _('3pos Spotlight Switch - LANDING'), category = {_('Systems')}},

{down = iCommandPlane_SpotSelect_switch, value_down = -1.0, value_up = 0.0, name = _('3pos Spotlight Switch - Taxi'), category = {_('Systems')}},

 

The original LUA:

 

{down = iCommandPlane_SpotSelect_switch, value_down = 1.0, name = _('Spotlight Switch - LANDING'), category = {_('Systems')}},

{down = iCommandPlane_SpotSelect_switch, value_down = -1.0, name = _('Spotlight Switch - TAXI'), category = {_('Systems')}},

{down = iCommandPlane_SpotSelect_switch, value_down = 0.0, name = _('Spotlight Switch - OFF'), category = {_('Systems')}},

 

 

But doesn´t work. Any ideas?

This looks correct. Are you sure you added these lines to the file "Throttle - HOTAS Warthog.lua" and not to "default.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

Yes. The "off position" doesn´t seem to work.

The switch doesn´t go to the middle.

Yes, of course I overlooked that your lines miss the statement "up = iCommandPlane_SpotSelect_switch,".

I added these 2 lines and they work:

{down = iCommandPlane_SpotSelect_switch, up = iCommandPlane_SpotSelect_switch, value_down = 1.0, value_up = 0.0, name = _('Spotlight 3-Pos Switch - LANDING/OFF'), category = {_('Systems')}},
{down = iCommandPlane_SpotSelect_switch, up = iCommandPlane_SpotSelect_switch, value_down = -1.0, value_up = 0.0, name = _('Spotlight 3-Pos Switch - TAXI/OFF'), category = {_('Systems')}},

Not so familiar with the L-39, but what I see is: Taxi position lights ON, middle position lights OFF, Landing position lights ON very bright.

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 weeks later...

My attempt at mapping the AV8 Airbrake to my HOTAS toggle failed. What I am trying to achieve is: Extend Airbrake when I hold the switch, then retract when it is released.

 

Orig Code:

{down = iCommandPlaneAirBrake, name = _('Airbrake TOGGLE'), category = _('HOTAS')},

{down = iCommandPlaneAirBrakeOn, name = _('Airbrake ON'), category = _('HOTAS')},

{down = iCommandPlaneAirBrakeOff, name = _('Airbrake OFF'), category = _('HOTAS')},

 

My failed coding:

{down = 3491, up = 3491, cockpit_device_id = 28, value_down = 1, value_up = 0, name = _('Speedbrake TOGGLE'), category = _('HOTAS')},

and

{down = iCommandPlane_HOTAS_AirBrakeOn, up = iCommandPlane_HOTAS_AirBrakeOff, name = _('Speed Brake Toggle 2'), category = _('HOTAS')},

 

(The Device ID for DCS 2.5 is 27, and 2.5beta is 28 )

 

I successfully worked it for the A10 using:

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

 

I know Im close....

Occulus Rift i7-7700 3.6Ghz 16GB Ram 1080Ti 11GB SSDx2

Link to comment
Share on other sites

I know Im close....

You are. Try this :)

{down = iCommandPlaneAirBrakeOn, up = iCommandPlaneAirBrakeOff, name = _('Airbrake ON/OFF'), category = _('HOTAS')},

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

You are. Try this :)

{down = iCommandPlaneAirBrakeOn, up = iCommandPlaneAirBrakeOff, name = _('Airbrake ON/OFF'), category = _('HOTAS')},

 

 

Franky has beat me to it. I was going to post the same thing...

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

Works well, thank you !

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

  • Recently Browsing   0 members

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