Jump to content

How to set up toggle switches (a tutorial)


Recommended Posts

Maybe someone could try this and post here if it works!

 

Dudester22 it works, I wouldn't have said so unless I had tried.

 

The following lines are right from my BU0836X Main Interface.lua file...

 

--LandingLight Control

{ combos = {{key = "JOY_BTN1"}}, down = device_commands.Button_12, up = device_commands.Button_12, cockpit_device_id = devices.NAVLIGHT_SYSTEM, value_down = 1.0, value_up = 1.0, name = 'Landing light On/Off', category = 'Ins Collective Stick'},

 

{ combos = {{key = "JOY_BTN7"}}, down = device_commands.Button_7, up = device_commands.Button_7, cockpit_device_id = devices.NAVLIGHT_SYSTEM, value_down = 1.0, value_up = 0.0, name = 'Landing light Extend', category = 'Ins Collective Stick'},

{down = device_commands.Button_7, cockpit_device_id = devices.NAVLIGHT_SYSTEM, value_down = 0.0, name = 'Landing light Stop', category = 'Ins Collective Stick'},

{ combos = {{key = "JOY_BTN6"}}, down = device_commands.Button_7, up = device_commands.Button_7, cockpit_device_id = devices.NAVLIGHT_SYSTEM, value_down = -1.0, value_up = 0.0, name = 'Landing light Retract', category = 'Ins Collective Stick'},

 

And I've never had a problem with it.

Link to comment
Share on other sites

@DeJohn

 

I have know doubt your method will work, but there are that many people posting in this thread, I thought it best to give them what you gave me and see for themselves it works. I only told them to report back there findings so it convinces others who keep posting with similar problems. :thumbup:

Link to comment
Share on other sites

  • 2 weeks later...

I have a question regarding rotary buttons like ADI pitch trim.

The icommand seems to be screwed so i can't use the default binding i would like to use something like this : down = 3001, cockpit_device_id = 47, value_down = -0.1

but it sets the position of the ADI knob not changing from the previous value.

As someone any clue to do a rotary using cockpit_device_id?

Link to comment
Share on other sites

  • 2 weeks later...

Did the configuration files change at some point for the P-51D? I was trying to set up a switch as described in the first post, but when I open the Throttle - HOTAS Warthog lua it doesn't have anything with this format:

 

{down = 3002, cockpit_device_id = 100, value_down = 1, name = "Kneeboard Previous Page", category = "Kneeboard"}

 

 

Now, it only has this:

 

["d3011pnilunilcd5vd0vpnilvunil"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN23",

},

},

["name"] = "Mixture IDLE CUT OFF",

},

 

Does anyone know how I can get switches that I can toggle ON/OFF with this format? Is the [1] the "down" state of the button?

Intel i5-2500k @ 4.4GHz w/ H70 liquid cooler, ASRock PRO3-M Z68 Mobo, 32G 1600Mhz Mushkin RAM, EVGA GTX970 4GB , OCZ Agility 3 128g SSD, SanDisk 240g SSD, Win7 64-bit

--Twitch: http://www.twitch.tv/livingfood --

Link to comment
Share on other sites

Did the configuration files change at some point for the P-51D? I was trying to set up a switch as described in the first post, but when I open the Throttle - HOTAS Warthog lua it doesn't have anything with this format:

 

{down = 3002, cockpit_device_id = 100, value_down = 1, name = "Kneeboard Previous Page", category = "Kneeboard"}

 

 

Now, it only has this:

 

["d3011pnilunilcd5vd0vpnilvunil"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN23",

},

},

["name"] = "Mixture IDLE CUT OFF",

},

 

Does anyone know how I can get switches that I can toggle ON/OFF with this format? Is the [1] the "down" state of the button?

 

It should be in the ["d3011pnilunilcd5vd0vpnilvunil"] part.

My guess is that it should be something like this:

d = down

p = pressed

u = up

cd = cockpit_device

vd = value_down

vp = value_pressed

vu = value_up

 

The ["added"] block contains all key definitions for this particular function, with an index always starting at [1].

 

I'm still figuring out how this works though, and when I find out I'll try and redo the application I started working on earlier in this thread.

Dutch Flanker Display Team | LLTM 2010 Tiger Spirit Award
Link to comment
Share on other sites

Spent all evening trying to figure out the new control assignments, but it seems to be impossible now to have actions bound to the releasing of a button.

 

What I'm trying to do for example is this (in the FC3 aircraft):

 

["d147pnilu148cdnilvdnilvpnilvunil"] = {
 ["added"] = {
   [1] = {
     ["key"] = "JOY_BTN7",
   },
   [2] = {
     ["key"] = "JOY_BTN8",
   },
 },
 ["name"] = "Airbrake",
},

 

Note the alterations in the first line:

 

["d147pnilu148cdnilvdnilvpnilvunil"] = {

 

In theory, this should enable me to have the airbrake open when I push the airbrake switch on my throttle forward or backward, and retract again when I return it to its neutral position.

Something like this in the previous versions:

 

{combos = {{key = 'JOY_BTN7'}}, down = iCommandPlaneAirBrakeOn, up = iCommandPlaneAirBrakeOff, name = 'Airbrake', category = 'Systems'},

 

Instead, all this does is disable the switch altogether, the assignment is also gone from the DCS controls window.

 

Am I missing something obvious here, or is it really not possible anymore?

Dutch Flanker Display Team | LLTM 2010 Tiger Spirit Award
Link to comment
Share on other sites

I think I've sorted this, works for me anyway. Its not a straight forward as the old LUA's but easy once you do it a few times.

 

Its a bit of a different process for 2 and 3 position switches.

 

This is for the A-10C but also works for UH-1 and P-51 and should work for all aircraft

 

3 position

 

["d1374pnilu1375cdnilvdnilvpnilvunil"] = {
  ["added"] = {
   [1] = {
    ["key"] = "JOY_BTN30",
   },
  },
  ["name"] = "Master switch ARM",
 },
 ["d1376pnilu1375cdnilvdnilvpnilvunil"] = {
  ["added"] = {
   [1] = {
    ["key"] = "JOY_BTN29",
   },
  },
  ["name"] = "Master switch TRAIN",

 

The original code was just d1374 for ARM and d1376 for TRAIN. This one is fairly straight forward, same as old system. UP obviously becomes u1375. For me, as I have a homebuilt panel, this switch has 3 positions. ARM-OFF-TRAIN

 

2 Position

 

["d1387pnilu1387cdnilvdnilvpnilvunil"] = {
  ["added"] = {
   [1] = {
    ["key"] = "JOY_BTN21",
   },
  },
  ["name"] = "HUD Mode switch Day/Night",

 

Even easier d1387 was original, I just added u1387

 

The P-51 was a bit different for a 3 position switch

 

["d3001pnilu3001cd15vd0.2vpnilvu0.1"] = {
  ["added"] = {
   [1] = {
    ["key"] = "JOY_BTN17",
   },
  },
  ["name"] = "Supercharger switch HIGH",
 },
 ["d3001pnilu3001cd15vd0vpnilvu0.1"] = {
  ["added"] = {
   [1] = {
    ["key"] = "JOY_BTN16",
   },
  },
  ["name"] = "Supercharger switch AUTO",

 

The original P-51 was:

 

["d3001pnilunilcd15vd0.2vpnilvunil"] = {
  ["added"] = {
   [1] = {
    ["key"] = "JOY_BTN17",
   },
  },
  ["name"] = "Supercharger switch HIGH",
 },
 ["d3001pnilunilcd15vd0vpnilvunil"] = {
  ["added"] = {
   [1] = {
    ["key"] = "JOY_BTN16",
   },
  },
  ["name"] = "Supercharger switch AUTO",

 

As you will see, unlike the A-10C the switch has the same number for both positions, 3001. In this case the switch position is changed with value up/down commands (vu/vd)

 

First of all add 3001 as the u value (u3001)

 

Then if you look at supercharger high the vd is 0.2

Supercharger auto vd is 0, so it follows that the centre position is 0.1 as in my version up the page

 

For KaspeR32, this my my config for mixture idle cut-off

 

["d3011pnilu3011cd5vd0.2vpnilvu0.1"] = {
  ["added"] = {
   [1] = {
    ["key"] = "JOY_BTN28",
   },
  },
  ["name"] = "Mixture EMERGENCY FULL RICH",
 },
 ["d3011pnilu3011cd5vd0vpnilvu0.1"] = {
  ["added"] = {
   [1] = {
    ["key"] = "JOY_BTN27",
   },
  },
  ["name"] = "Mixture IDLE CUT OFF",

 

Hope this helps and makes sense :music_whistling:

BU0836X Interface {039A3D60-AA12-11e3-8001-444553540000}.diff.lua

Wise men speak because they have something to say; Fools because they have to say something.

Plato

Link to comment
Share on other sites

 

Hope this helps and makes sense :music_whistling:

 

Hey dannyg,

 

Thanks for the lengthy reply!

 

That helps very much!

 

I do have another question though. For a switch like the P-51 fuel booster, is there a specific "up" state? For example, when I had the switch working, it was the same command to flip the switch up, and flip the switch down. So if I started the game, and clicked it with my mouse, and then hit the switch on my joystick, it would be working the opposite way.

 

Do some switches (fuel booster) just have 1 command that can be called for both states and that's it?

 

Thanks again for posting!

Intel i5-2500k @ 4.4GHz w/ H70 liquid cooler, ASRock PRO3-M Z68 Mobo, 32G 1600Mhz Mushkin RAM, EVGA GTX970 4GB , OCZ Agility 3 128g SSD, SanDisk 240g SSD, Win7 64-bit

--Twitch: http://www.twitch.tv/livingfood --

Link to comment
Share on other sites

Thanks for the lengthy reply!

 

Always a pleasure to help where I can

 

 

["name"] = "Fuel Booster",
 },
 ["d3007pnilu3007cd15vd1vpnilvu0"] = {
  ["added"] = {
   [1] = {
    ["key"] = "JOY_BTN2",
   },

 

For me with my button box, and the same for a 2 position joystick button, you would do as before and add u3007.

 

I dont have the original lua but i added 0 to vu I think as opposed to nil.

If not I added 1 to vd.

 

If its just a 1 button press on a joystick then you shouldn't have to touch to LUA, just assign as normal through the options menu in game.

Wise men speak because they have something to say; Fools because they have to say something.

Plato

Link to comment
Share on other sites

  • 2 weeks later...

So, i'm trying to do this with the slider on the X55 (it works like a toggle, on when fwd, off when aft) to map it to work the airbrakes of FC3 aircraft properly. However, I cannot for the life of me find the data to enter into the .diff file for D and U. I tried looking up the default input files in the DCS/mods folder, but those files appear incomplete, having data on only commands specific to each aircraft. Where are the common FC3 default commands stored???

Link to comment
Share on other sites

  • 2 weeks later...

hello , i tried yesterday to add a on and off switch for the Battery "on off" on my Warthog throttle in place of the APU switch..Button number 25 .

 

I had "u3016 "and "vu1" at the end of the line concerned in diff.lua of user\aved games\etc..

 

That seemd to be simple as this is a 2 way switch .. no results at all :( .in game i had to reassign th 25 BTN.

 

Do i miss something ? Has someone created .lua editor to configure on and off switches ?

 

Need help because i am planing to build panels for the huey and the first step to do this is to understand how to turn on and off switch .

 

Thx helping ..

Link to comment
Share on other sites

The command-combinations can only be changed to combinations which are found among the modules default commands. The default behavior otherwise is for DCS to remove configurations it doesn't recognize in the diff.lua-files, which is why you have to re-assign that button.

 

You can apply this mod and you'll be able to configure switch-controls that way.

 

I haven't verified any specific battery-commands but most switches with values will take 0 for the neutral position, so 2-way switches are often configured as "vd1" and "vu0" with the same command-number.

Link to comment
Share on other sites

Thank you for responding , i am not at all familiar with .lua so if i understand what you say ( hope so ) , the method is :

 

- apply the mod otherwise copy / past the Data.lua in Scripts\Input\. wich allow modification to be done and accepted directly in diff.lua.

 

-modified throttle warthog diff.lua with vu , vd , etc.. .

 

And that ' s all ?

 

hope that will work,

 

i will try this this evening .

Link to comment
Share on other sites

That works ! Thks again !!:thumbup:

 

The only things ( apparently there is no solution ) is to match the position of the physical switch from the controller with the virtual one from the sim ( in my case Huey) before or during the flight (using pause :)), that is not a big deal anyway !

 

Merci Beaucoup

Link to comment
Share on other sites

That works ! Thks again !!:thumbup:

 

The only things ( apparently there is no solution ) is to match the position of the physical switch from the controller with the virtual one from the sim ( in my case Huey) before or during the flight (using pause :)), that is not a big deal anyway !

 

Merci Beaucoup

I have been looking in LUA to see if dealing with this switch position initialization is possible, like for the Warthog HOTAS. It seems that it's a function inside the input.dll that manages that but is only available for "official" hotas so impossible to use it with our hown home-made devices.

Maybe whe should ask ED to open this function to other devices.

Link to comment
Share on other sites

So, i'm trying to do this with the slider on the X55 (it works like a toggle, on when fwd, off when aft) to map it to work the airbrakes of FC3 aircraft properly. However, I cannot for the life of me find the data to enter into the .diff file for D and U. I tried looking up the default input files in the DCS/mods folder, but those files appear incomplete, having data on only commands specific to each aircraft. Where are the common FC3 default commands stored???

They are stored in the "base_joystick_binding.lua" file. (Can't remember exactly where in the main game dir it resides right now - my work computer unfortunately doesn't have DCSW installed...)

 

To get airbrakes working as you say on the X55 and, in my case, the Cougar Throttle, the easiest is to simply add an "Air brake hold" command to the list in the configuration panel. Like this (not sure about the specific iCommand spelling as I'm writing this from memory):

 

{down = iCommandPlaneAirBrakeOn, up = iCommandPlaneAirBrakeOff, name = 'Air brake hold', category = 'Systems'},

 

Then you can simply bind this to any button(s) you want to keep pressed to have air brakes deployed in the configuration panel.

 

Ideally, additional commands should probably be included in its own mod, as described here:

http://forums.eagle.ru/showpost.php?p=2060773&postcount=40

Link to comment
Share on other sites

  • 3 weeks later...

What is wrong here? I tried this so many times i have double vision.

I had this working on my previous install, but didn't save it.

 

{down = iCommandPlaneGearUp, name = 'Landing Gear Up', category = 'Systems'},
{down = iCommandPlaneGearDown, name = 'Landing Gear Down', category = 'Systems'},
{combos = {{key = "JOY_BTN26"}}, down = iCommandPlaneGearDown, up = iCommandPlaneGearUp, name = 'Landing Gear Down', category = 'Systems'},

I did exactly the same for airbrake switch and it worked. At least to me it looks the same. I noticed that it assigns the same button for all of mine controllers, but I can delete working one, but not this one.:helpsmilie:

Link to comment
Share on other sites

Ok found this thread after coming back to my home cockpit after a half a year. So my cockpit has 4 GPWIZ devices and one Bu386 controller. Since upgrading my DCS to 1.2.10 all my old files don't work...well sort of. momentary push buttons work ok, but those that I modified with an Up statement don't work.

 

So looking at this thread I have a couple questions. Seems like I should be adding Up commands in the device.lau for the aircraft (mods/aircraft/A10C)..is that correct?

 

I understand the DIFF file method as well and seems that might be easier. But the question is where do you get the command number?

 

Like for: d1376pnilu1375cdnilvdnilvpnilvunil

 

How did he know that 1376 is what he wants for down and 1375 is what he wants for up? Is there a master list somewhere I can find the numbers from?

 

I have about 150 buttons to program so I want to make sure I get a good understanding of this before I start.

Coder - Oculus Rift Guy - Court Jester

Link to comment
Share on other sites

  • 3 weeks later...

Ive tried to set a two way switch for the Mig-21Bis.

Whats wrong with my syntax? My changes in red.

 

["keyDiffs"] = {
	["d3121pnilu[color="Red"]3121[/color]cd14vd1vpnilvu[color="red"]-1[/color]"] = {
		["added"] = {
			[1] = {
				["key"] = "JOY_BTN20",
			},
		},
		["name"] = "Gears Up",

[sIGPIC][/sIGPIC]

 

We are looking for Swedish members!

http://www.masterarms.se

Link to comment
Share on other sites

Ive tried to set a two way switch for the Mig-21Bis.

Whats wrong with my syntax? My changes in red.

 

["keyDiffs"] = {
	["d3121pnilu[color="Red"]3121[/color]cd14vd1vpnilvu[color="red"]-1[/color]"] = {
		["added"] = {
			[1] = {
				["key"] = "JOY_BTN20",
			},
		},
		["name"] = "Gears Up",

 

Try renaming the command something different, like "Gears Toggle" if "Gears Up" is the original name. Also make sure the value isn't 0 and not -1. I don't have the module, so I can't check for you.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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