Jump to content

How to set up toggle switches (a tutorial)


Recommended Posts

Indeed. Maybe I should try that. And use the software of the device just for games that do not allow such setup, like star citizen for instance...

Though I guess this will not allow macros, like for instance flaps down then neutral again ^^

Favorite modules : Huey, F-86F, F14 and P-51D

Quest 2, RTX 3080, i7 10700K, 16 Gb of RAM, Pro Flight Trainer PUMA helicopter setup, Warthog HOTAS with two force sensitive stick, custom cockpit and a GS-Cobra dynamic seat.

Link to comment
Share on other sites

Can you do something like that for the Sabre?

 

Here is what my lua file looks like:

 

["keyDiffs"] = {
	["d431pnilunilcdnilvdnilvpnilvunil"] = {
		["added"] = {
			[1] = {
				["key"] = "JOY_BTN1",
			},
		},
		["name"] = "Landing Gear Down",
	},
	["d84pnilu85cdnilvdnilvpnilvunil"] = {
		["name"] = "Gun Fire",
		["removed"] = {
			[1] = {
				["key"] = "JOY_BTN1",
			},
		},
	},
},

Also, this is still true that when we enter then apply changes to the key config inside DCS all our "button released" info disappears? This is an issue ;)

 

Thanks

Favorite modules : Huey, F-86F, F14 and P-51D

Quest 2, RTX 3080, i7 10700K, 16 Gb of RAM, Pro Flight Trainer PUMA helicopter setup, Warthog HOTAS with two force sensitive stick, custom cockpit and a GS-Cobra dynamic seat.

Link to comment
Share on other sites

Hey guys,

 

I'm trying to set up the master arm switch in the M2000C but I'm getting nowhere.

 

Every time I edit the lua DCS removes the button assignment putting me back to square one.

 

Here is the original code:

 

["d283pnilunilcdnilvdnilvpnilvunil"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN24",

},

},

["name"] = "Master Arm Switch",

 

And the modified code:

 

["d283pnilu283cdnilvd1vpnilvu0"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN24",

},

},

["name"] = "Master Arm Switch",

 

Any ideas?

Thanks.

Link to comment
Share on other sites

Has anyone figure out a way to bind a ON-OFF, ON-ON switch to a toggle function like Landing Gear toggle or TGP On/off without the possibility of desynchronize it? Could this happen I if set up my switches through Helios? I haven't tried it...

My rig specs:

Intel Core i7 4770 @3.4Ghz // Corsair 16GB DDR3 // MoBo Asus Z87K // HDD 1TB 7200RPM // eVGA Nvidia GTX 760GT 2GB DDR5 // LG 3D 47" 1920x1080 // Thrustmaster Warthog HOTAS // Saitek Combat Pro Pedals // Thrustmaster MFD Cougar pack // PS3 Eye + FTNOIR

Link to comment
Share on other sites

drcarnage52, I found that if you modify the diff lua, it will remove it from assignment. It looks like the only way to do it is to modify the default.lua that was mentioned before (by me, to Hans/HMA.

 

@7rooper, no. It looks like you have to modify the default.lua file. But keeping track of it (manually or via JSGME) isn't too difficult. You can just put the modifications at the top of the default lua file.

hsb

HW Spec in Spoiler

---

 

i7-10700K Direct-To-Die/OC'ed to 5.1GHz, MSI Z490 MB, 32GB DDR4 3200MHz, EVGA 2080 Ti FTW3, NVMe+SSD, Win 10 x64 Pro, MFG, Warthog, TM MFDs, Komodo Huey set, Rverbe G1

 

Link to comment
Share on other sites

For the sabre you also have a gear down and gear up functions you can assign buttons too. So I do not use the gear on/off toggle. This is not that for all planes?

Favorite modules : Huey, F-86F, F14 and P-51D

Quest 2, RTX 3080, i7 10700K, 16 Gb of RAM, Pro Flight Trainer PUMA helicopter setup, Warthog HOTAS with two force sensitive stick, custom cockpit and a GS-Cobra dynamic seat.

Link to comment
Share on other sites

How to set up toggle switches (a tutorial)

 

1. The only lua to be edited is the default.lua.

The diff.lua only notes the differences between the default.lua and the changes made by the user.

2. Editing the default.lua has a precondition: a coded line for a switch state for on and a coded line for a switch state of off.

In most cases these two are written in the default.lua and should only be written in the same new line as shown earlier in the thread.

Sometimes these pre coded lines exist in the coding but are not written in the default.lua and can be found in either this thread or in trial and error.

3. If there is no code for on and off position but only toggle then one has to prepare one's switches before getting into the sim.

 

Editing or making toggle switches is quite easy...all it takes is to read the whole thread...

jgVplRQ.png

Link to comment
Share on other sites

But if when we enter the config then click ok, all those release button disappear, this is an issue, as it requires to do all this again if we have to change a setup, or to change setup only in the lua file, right?

Favorite modules : Huey, F-86F, F14 and P-51D

Quest 2, RTX 3080, i7 10700K, 16 Gb of RAM, Pro Flight Trainer PUMA helicopter setup, Warthog HOTAS with two force sensitive stick, custom cockpit and a GS-Cobra dynamic seat.

Link to comment
Share on other sites

Editing the deafault.lua in the toggle switch regards means you write a new line and name it with an add like "alternate" or "machupicchu" so you can discern it from the original command.

That command is then added to the options config as a new line.p to which you assign whatever switch you like.

jgVplRQ.png

Link to comment
Share on other sites

I don't understand. I mean, ok a new command, but the goal is to assign the "release button" to the gear up command, and the "press button" state to the gear down, for instance.

So, to assign those things to existing commands...

Favorite modules : Huey, F-86F, F14 and P-51D

Quest 2, RTX 3080, i7 10700K, 16 Gb of RAM, Pro Flight Trainer PUMA helicopter setup, Warthog HOTAS with two force sensitive stick, custom cockpit and a GS-Cobra dynamic seat.

Link to comment
Share on other sites

Usually you use the toggle switches for assigning switches and not buttons.

Each switch has two "states": On and Off.

On is when you close an electrical circle and off when you open it (which you an see in windows settings as actual light being turned on or off).

The issue is most commands in DCS are configured for the On state...eg when you move a switch up it goes into the On state>the software recognizes it and it is assigned.

Most commands i DCS don't recognize moving from On to Off and the reasoning is simplicity...to make assigning simpler to understand.

The Hog is different as it has commands for both sates of the switch in advance as part of working with the Warthog HOTAS.

So...if you have switches and you want to utilize both states of the switch as different actions/ states of the same switch...you make a new line/ option/ command in which you add two lines (with line commanding the off state and the other the On state) into one line.

You than go into options and assign the switch you want to that new "alternate" command.

Read, try and see how it works.

jgVplRQ.png

Link to comment
Share on other sites

By browsing the web I also found this thread:

http://forums.eagle.ru/showthread.php?t=80106&page=5

Unsure it still works or not...

 

Maybe another solution would be to use the included software manager (TARGET or saitek TPM one), assign all switches to keyboard shortcuts (like for instance ctrl-shift-1 for switch 1 down, ctrl-alt-1 for switch 1 up, and so on, then assign those new shortcuts to the things we want in game, this way we can have a single target/tpm profile to work with all planes in DCS, just by selecting the shortcuts we want from inside DCS in each plane configuration...

Favorite modules : Huey, F-86F, F14 and P-51D

Quest 2, RTX 3080, i7 10700K, 16 Gb of RAM, Pro Flight Trainer PUMA helicopter setup, Warthog HOTAS with two force sensitive stick, custom cockpit and a GS-Cobra dynamic seat.

Link to comment
Share on other sites

No...too much of a hazzle with TARGET. My goal is to build a completely functional cockpit with the least additional software possible. I'm still trying to get rid of Helios and now I use it for my potentiometers and a couple of gauges.

This is what an edited default.lua gives you:

jbAqWnf.jpg

The possibilty to create and name at your will new bindings but as long as some functions are coded as toggle in the sim there's nothing else I can do to avoid desynchronization. In the A-10C we have as much as half the functions programmed as toggles which is lame. I hope someday this will be patched but sometimes I feel like ED doesn't want to support cockpit builders and offer better options for VR instead. I wish ED put some attention to cockpit builders and offer, besides multiple states functions, the possibility to extract screens and gauges through an easy interface


Edited by 7rooper

My rig specs:

Intel Core i7 4770 @3.4Ghz // Corsair 16GB DDR3 // MoBo Asus Z87K // HDD 1TB 7200RPM // eVGA Nvidia GTX 760GT 2GB DDR5 // LG 3D 47" 1920x1080 // Thrustmaster Warthog HOTAS // Saitek Combat Pro Pedals // Thrustmaster MFD Cougar pack // PS3 Eye + FTNOIR

Link to comment
Share on other sites

Target is that hard to use? The Saitek one is quite easy, to tell that a switch in down state (button on) makes that and the switch in up state (button released) makes that.

 

And to have the same profile in all games and planes you just have to setup software so that switches do generic keystrokes, and program those keystrokes in the plane config or other game config...

 

Just another solution to not have to handle lua files and to avoid updates that will mess up files...

Favorite modules : Huey, F-86F, F14 and P-51D

Quest 2, RTX 3080, i7 10700K, 16 Gb of RAM, Pro Flight Trainer PUMA helicopter setup, Warthog HOTAS with two force sensitive stick, custom cockpit and a GS-Cobra dynamic seat.

Link to comment
Share on other sites

I don't understand. I mean, ok a new command, but the goal is to assign the "release button" to the gear up command, and the "press button" state to the gear down, for instance.

So, to assign those things to existing commands...

 

See in this way: in LUA you can create a new command line "Alternate machupichu landing gear" :D ON/OFF

but can't change the default assignment "Toggle landing gear"... for ON/OFF because the game reset this for his default when hit OK in Controls.

 

Using the fist way you end with both options.

 

OT - IL-2 CloD have both options for almost all commands, but if one day look at Bananas'Drama" will see allot of

"complicated commands, a mess, nightmarish, the worst game commands options, etc. etc*... then the "mongrel" IL-2 use the rule:

"Less keys is better" and have only "toggle" options... Trend for "the future" in flight games.

 

*Similar complains in Mig-21 forum, about landing gear commands.


Edited by Sokol1_br
Link to comment
Share on other sites

Target is that hard to use? The Saitek one is quite easy, to tell that a switch in down state (button on) makes that and the switch in up state (button released) makes that.

 

And to have the same profile in all games and planes you just have to setup software so that switches do generic keystrokes, and program those keystrokes in the plane config or other game config...

 

Just another solution to not have to handle lua files and to avoid updates that will mess up files...

 

 

Target is not that difficult to use. It's a preference, that's all. The other reason is that if you are building separate physical switches; not a full blown cockpit build, just some boxes of switches, it's easier to use lua files.

 

Again, give Target (there's a GUI version that's point and click) a try and see if it suits your needs.

hsb

HW Spec in Spoiler

---

 

i7-10700K Direct-To-Die/OC'ed to 5.1GHz, MSI Z490 MB, 32GB DDR4 3200MHz, EVGA 2080 Ti FTW3, NVMe+SSD, Win 10 x64 Pro, MFG, Warthog, TM MFDs, Komodo Huey set, Rverbe G1

 

Link to comment
Share on other sites

Hey team,

I've read whole thread and tried all methods I can understand but without luck. Seems like there was some changes since tutorials were posted.

I got no new line in settings if I added new modified line in LUA, and no effect if I added "up =" to existing one. Most likely I'm doing something wrong.

 

I'd like to assign Laser Pointer of Ka-50 to "RDR ALTM" toggle switch of my Warthog. I'd like to have Laser On on toggle on or off, instead current - Laser On on toggle On, Laser Off on toggle Off then On.

 

So would you mind to point - what exactly file should be edited and with which values?

 

Thank you in advance!

 

Edit: I've edit (added command up = command) every lua file containing word Laser - and now it's working. But still have no clue which file exactly required.


Edited by Necroscope

Всех убью, один останусь!

Link to comment
Share on other sites

I wonder, how works the warthog exactly? I mean, the switches of my TPM works like that: when the switch is down, it is as if a joystick button is pressed. If the switch is up, it is as if the joystick button is released.

 

Do the warthog works like that?

 

Thanks

Favorite modules : Huey, F-86F, F14 and P-51D

Quest 2, RTX 3080, i7 10700K, 16 Gb of RAM, Pro Flight Trainer PUMA helicopter setup, Warthog HOTAS with two force sensitive stick, custom cockpit and a GS-Cobra dynamic seat.

Link to comment
Share on other sites

Well, all you needed to do was adding the highlighted line in the default.lua in the path that can be seen in this image below

weuonWR.jpg

My rig specs:

Intel Core i7 4770 @3.4Ghz // Corsair 16GB DDR3 // MoBo Asus Z87K // HDD 1TB 7200RPM // eVGA Nvidia GTX 760GT 2GB DDR5 // LG 3D 47" 1920x1080 // Thrustmaster Warthog HOTAS // Saitek Combat Pro Pedals // Thrustmaster MFD Cougar pack // PS3 Eye + FTNOIR

Link to comment
Share on other sites

So, on my computer, the file to edit for the F86-F Sabre is this one:

C:\Program Files\Eagle Dynamics\DCS World\Mods\aircraft\F-86\Input\F-86F\joystick\default.lua

 

And here is an example of what I did, if this can help some...

 

-- Commands for switches
{pressed = iCommandPlaneFlapsOn,	up = iCommandPlaneFlapsOff,		value_pressed = 1,	value_up = 1,	name = _('Flaps Up/Down Switch TPM'),		category = _('Systems')},
{down = iCommandPlaneGearDown,	up = iCommandPlaneGearUp,			name = _('Landing Gear Up/Down Switch TPM'),			category = _('Systems')},
{down = hydro_commands.F86_CockpitDeviceCommand_FlightControl, up = hydro_commands.F86_CockpitDeviceCommand_FlightControl,	cockpit_device_id = devices.HYDRO_INTERFACE, value_down = 0, value_up = 1,	name = _('Flight Control Switch - ALTERNATE/NORMAL TPM'),	category = _('Left Side Panel')},
{down = electric_commands.F86_CockpitDeviceCommand_EngineMasterSw,	up = electric_commands.F86_CockpitDeviceCommand_EngineMasterSw,	cockpit_device_id = devices.ELEC_INTERFACE,	value_down = -1,	value_up = 1,	name = _('Engine Master Switch - ON/OFF TPM'),				category = _('Right Forward Console')},
{down = electric_commands.F86_CockpitDeviceCommand_BatteryStarterSw_EXT, up = electric_commands.F86_CockpitDeviceCommand_BatteryStarterSw_ITER,	cockpit_device_id = devices.ELEC_INTERFACE,	  value_down = -1, value_up = 1,  name = _('Battery-Starter Switch - UP/STARTER TPM'),  category = _('Right Forward Console')},

 

Dunno why the flaps is "pressed" and others are "down".

Favorite modules : Huey, F-86F, F14 and P-51D

Quest 2, RTX 3080, i7 10700K, 16 Gb of RAM, Pro Flight Trainer PUMA helicopter setup, Warthog HOTAS with two force sensitive stick, custom cockpit and a GS-Cobra dynamic seat.

Link to comment
Share on other sites

So, on my computer, the file to edit for the F86-F Sabre is this one:

C:\Program Files\Eagle Dynamics\DCS World\Mods\aircraft\F-86\Input\F-86F\joystick\default.lua

 

And here is an example of what I did, if this can help some...

 

-- Commands for switches
{pressed = iCommandPlaneFlapsOn,	up = iCommandPlaneFlapsOff,		value_pressed = 1,	value_up = 1,	name = _('Flaps Up/Down Switch TPM'),		category = _('Systems')},
{down = iCommandPlaneGearDown,	up = iCommandPlaneGearUp,			name = _('Landing Gear Up/Down Switch TPM'),			category = _('Systems')},
{down = hydro_commands.F86_CockpitDeviceCommand_FlightControl, up = hydro_commands.F86_CockpitDeviceCommand_FlightControl,	cockpit_device_id = devices.HYDRO_INTERFACE, value_down = 0, value_up = 1,	name = _('Flight Control Switch - ALTERNATE/NORMAL TPM'),	category = _('Left Side Panel')},
{down = electric_commands.F86_CockpitDeviceCommand_EngineMasterSw,	up = electric_commands.F86_CockpitDeviceCommand_EngineMasterSw,	cockpit_device_id = devices.ELEC_INTERFACE,	value_down = -1,	value_up = 1,	name = _('Engine Master Switch - ON/OFF TPM'),				category = _('Right Forward Console')},
{down = electric_commands.F86_CockpitDeviceCommand_BatteryStarterSw_EXT, up = electric_commands.F86_CockpitDeviceCommand_BatteryStarterSw_ITER,	cockpit_device_id = devices.ELEC_INTERFACE,	  value_down = -1, value_up = 1,  name = _('Battery-Starter Switch - UP/STARTER TPM'),  category = _('Right Forward Console')},

Dunno why the flaps is "pressed" and others are "down"

 

The "pressed" commands are for incremental switches like self reversible toggle switches and rotary encoders.

This combo method doesn't work for those "pressed" as you may realize if you notice that there's a line that states "value_up = 0".

If you want to control Flaps with a toggle switch edit this command instead

{down = iCommandPlaneFlaps, name = _('Flaps Up/Down'),	category = _('Systems')},

 

After you're done editing the default.lua, back it up!! and go to controls in DCS game and look for your customized command and bind the ON states for the switches switches. The OFF position will be automatically assigned to whatever command you chose when edited the default.lua, therefore it won't be visible in the controls menu but will work just fine during the simulation

My rig specs:

Intel Core i7 4770 @3.4Ghz // Corsair 16GB DDR3 // MoBo Asus Z87K // HDD 1TB 7200RPM // eVGA Nvidia GTX 760GT 2GB DDR5 // LG 3D 47" 1920x1080 // Thrustmaster Warthog HOTAS // Saitek Combat Pro Pedals // Thrustmaster MFD Cougar pack // PS3 Eye + FTNOIR

Link to comment
Share on other sites

But the way I programmed it works. When I put my switch down it lowers the flaps, when I put the switch up it raises the flaps.

 

I don't understand your modification.

 

Edit:

Oh and btw I have noticed something about switches... when we start the sim, the switch position has no importance, meaning the sim does not update in game controls according to those switches... BUT... if you move just ONE switch, the game then updates ALL switch position... this happened to me in a "takeoff" mission, I was on the runway, and I just checked my flap lever. I moved it, and suddenly the engine shut down, and I had to do the whole cold start operation, because I have switches for some critical cold start systems, and those systems, when off, cannot allow the plane to start ^^ So better check the switch position before the start of the mission ^^

 

Now, I have to figure out what I'll put as commands behind my switches...

I have a square 3x3 switches, on left column I have put gear/flaps/flight control (I try to mimic the real plane switch position with my switches), on right column I have put engine master switch/battery starter switch only, so I don't know yet what to put on middle column, and for the missing switch on right column, if anybody has a suggestion for the sabre...


Edited by harf4ng

Favorite modules : Huey, F-86F, F14 and P-51D

Quest 2, RTX 3080, i7 10700K, 16 Gb of RAM, Pro Flight Trainer PUMA helicopter setup, Warthog HOTAS with two force sensitive stick, custom cockpit and a GS-Cobra dynamic seat.

Link to comment
Share on other sites

For the mechanical sight caging of the sabre, the command in default LUA is:

{down = device_commands.Button_17,		cockpit_device_id = devices.A4_GUNSIGHT,	value_down = 1,			name = _('A-4 Sight Mechanical Caging Lever - ON/OFF'),							category = _('A-4 Sight')},

So, this is a on/off function. Wonder why the effect of the down thing is a button in this setup.

 

Now I wonder, is this possible to put a lever for this, with the lever up to uncage the sight, and the lever down to cage the sight?

 

Thanks

Favorite modules : Huey, F-86F, F14 and P-51D

Quest 2, RTX 3080, i7 10700K, 16 Gb of RAM, Pro Flight Trainer PUMA helicopter setup, Warthog HOTAS with two force sensitive stick, custom cockpit and a GS-Cobra dynamic seat.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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