Jump to content

How to set up toggle switches (a tutorial)


Recommended Posts

Well Lino ...I checked the UH-1H's default.lua thourohly, checked how the specified switch works in game and tried different ways of messing with the lua fle but it's a no go for me.

The switch is not programmed to go to a specified location/ state, such as Arm, or Safe or Off.

Instead, the switch is programmed to go up to the next position (which ever it is) or go down to the next position (which ever it is).

The same goes for the programming of the clickable mouse.

In order to use the method specified in this thread one needs the original default.lua to specify certain valued states for the switch (which are absent here).

Is there a walk around?

Yes and I think an easy one as well, but I personally don't have the know how.

Since each specific state of the switch (Off or Safe or Arm) means a certain value in some other lua, or script, within DCS World, then all one needs is to find those 3 values and the iCommands that they activate and just write down 3 new lines to those 3 states within the default.lua.

Again..., writing down "I think" means just that and I might as well be speaking nonsense lol.


Edited by POLARIS1
  • Like 1

jgVplRQ.png

Link to comment
Share on other sites

That switch is indeed annoying. Programming it in Target is no better.

ASUS ROG Maximus VIII Hero, i7-6700K, Noctua NH-D14 Cooler, Crucial 32GB DDR4 2133, Samsung 950 Pro NVMe 256GB, Samsung EVO 250GB & 500GB SSD, 2TB Caviar Black, Zotac GTX 1080 AMP! Extreme 8GB, Corsair HX1000i, Phillips BDM4065UC 40" 4k monitor, VX2258 TouchScreen, TIR 5 w/ProClip, TM Warthog, VKB Gladiator Pro, Saitek X56, et. al., MFG Crosswind Pedals #1199, VolairSim Pit, Rift CV1 :thumbup:

Link to comment
Share on other sites

Well Lino ...I checked the UH-1H's default.lua thourohly, checked how the specified switch works in game and tried different ways of messing with the lua fle but it's a no go for me.

The switch is not programmed to go to a specified location/ state, such as Arm, or Safe or Off.

Instead, the switch is programmed to go up to the next position (which ever it is) or go down to the next position (which ever it is).

The same goes for the programming of the clickable mouse.

In order to use the method specified in this thread one needs the original default.lua to specify certain valued states for te switch (which are absent here).

Is there a walk around?

Yes and I think an easy one as well, but I personally don't have the know how.

Since each specific state of the switch (Off or Safe or Arm) means a certain value in some other lua, or script, within DCS World, then all one needs is to find those 3 values and the iCommands that they activate and just write down 3 new lines to those 3 states within the default. Lua.

Again..., writing down "I think" means just that and I might as well speaking nonsense lol.

 

That is exactly my conclusion, Polaris. Thank you very much for all your efforts. Rep inbound. I stay tuned to this.

 

That switch is indeed annoying. Programming it in Target is no better.

 

You are right, TARGET never was an option.


Edited by Lino_Germany

Kind regards,

 

Lino_Germany

Link to comment
Share on other sites

ok, thanks Polaris!

i make slow progress in setting up my profile again...this new system really sucks in my view...

anyway, i dont seem to be able, to give my throttle switches actual values...meaning, that they dont operate just like toggle switches, but that for example the forward position is really only forward position...

i tried for example, to set the "LASTE" three way switch on the warthog throttle, to operate my landing gear in the P51...

position foward "PATH", should be landing gear up,middle position "ALT/HDG" should be landing gear down and aft postion "ALT" should toggle the landing lights on....

now i came up with this:

{down = device_commands.Button_4, up = device_commands.Button_3, cockpit_device_id = devices.CONTROL_SYSTEM, value_down = 0.1, value_up = 0.2, name = 'Alternate Landing Gear Up/Down', category = 'Systems'},

 

...and this seems to partially work, except, that when i start a mission, and have the switch on the wrong position(air spawn, and switch in middle position).when i then push the switch into forward position, the landing gear will still go down.but only at the first switch of the lever....after that, it seems to recognize the correct positions.because as i then switch it back to middle position, it will not retract the landing gear again, but waits until i push it back into forward position....any clue why its doing this at the first toggle of the switch?

Link to comment
Share on other sites

DavidRed...you're welcome :)

 

As for your switch current problem...

1. The is no separate command for landing gear up or for landing gear down.

It's a rotary command between the two states...the same command does the opposite of the current state (eg down when up and up when down).

2. In the command you attached you wrote one command meant for landing gear, which is derived from one system cockpit_device_id = devices.CONTROL_SYSTEM and category category = 'Systems, with landing lights which is derived from a different system cockpit_device_id = devices.LIGHT_SYSTEM and category category = 'Environment System.

Each switch is given a number/ ID within a specific system.

For example...switch 4 in system X does one thing and switch 4 in system y does something utterly different.

 

By the way...I try to keep the same certain buttons do the exact certain actions in all planes to keep it simple.

One of those rare actions which can be kept all around is toggle landing gear which I keep on my left throttle button with lever (lever + button gear up or gear down).

Somehow it doesn't work with the UH-1H ;)


Edited by POLARIS1

jgVplRQ.png

Link to comment
Share on other sites

  • 2 weeks later...
OK i used this set up with 1.2.6 and 1.2.7 it worked fine i have a full cockpit built for A10C but with 1.2.8 it dont work : ( very frusterated any advice ????? thanks

 

They have changed the format, and file extension, of saved profiles. The only way to make the edits work now is to edit the actual default lua files in the sim.

ASUS ROG Maximus VIII Hero, i7-6700K, Noctua NH-D14 Cooler, Crucial 32GB DDR4 2133, Samsung 950 Pro NVMe 256GB, Samsung EVO 250GB & 500GB SSD, 2TB Caviar Black, Zotac GTX 1080 AMP! Extreme 8GB, Corsair HX1000i, Phillips BDM4065UC 40" 4k monitor, VX2258 TouchScreen, TIR 5 w/ProClip, TM Warthog, VKB Gladiator Pro, Saitek X56, et. al., MFG Crosswind Pedals #1199, VolairSim Pit, Rift CV1 :thumbup:

Link to comment
Share on other sites

so i would have to start with a clean 1.2.8 defolt profile???? because i tried to move my 1.2.7 stuff and that as i found out too late dont work lol and is there a way to get the original 1.2.8 imput lua files i didnt save mine:(

Link to comment
Share on other sites

ok does anyone have a sample of how to edit input LUA scripts for toggle switches???? for example i maped a switch button 9 for gear down how do i script it so it also brings gear up when i flip switch up insted of me sicling the switch up than down to bring gear up here is exmpl. of what im talking about..........

 

["d431pnilunilcdnilvdnilvpnilvunil"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN9",

},

},

["name"] = "Landing Gear Down",

},

Link to comment
Share on other sites

@ Zodiac

 

I was in the same boat as you one week ago and I followed Cichlidfan's advice.

Don't bother with "input.lua" as the new structure is completly different as mentioned before and still obscure (to me, at least).

 

Hoping this will help you for the panels you have : http://forums.eagle.ru/showpost.php?p=2066020&postcount=105

 

By the way, you might have to do a repair of DCS World before doing anything else, in order to recover the orginal files in C:\user\your username\config\input\aircraft...

 

Cheers

Laurius

Asus P8Z68 Deluxe, Intel Core i7-2600K (3.4 GHz), Corsair Vengeance 2x4096 Mo DDR3 1866 MHz, SSD 120 Go Vertex 2, EVGA GeForce GTX 970 FTW ACX 2.0 4Go (04G-P4-2978-KR), TM HOTAS Warthog #03797 (MB replaced), Saitek Combat Pro Rudder, TrackIR 5, TM Cougar MFDs with Lilliput 8" UM 80

Link to comment
Share on other sites

Please forgive my ignorance with respect to .lua files and all of the re-coding you are all having to, do but I have a question that may sound rather dumb from your perspectives.

 

I have a bunch of panels for my cockpit and all I ever did to install them was go to the options page under A10C and change or add the button numbers in the columns for each controller/command. I always assumed they made the changes to the lua file so I didn't have to. And it was always really easy to do so why would I want to change the lua file itself when the options page would do it for me?

 

The degree of importance you all are applying to this problem leads me to believe I am missing something that I should be addressing.

Regards

John W

aka WarHog.

 

My Cockpit Build Pictures...



John Wall

 

My Arduino Sketches ... https://drive.google.com/drive/folders/1-Dc0Wd9C5l3uY-cPj1iQD3iAEHY6EuHg?usp=sharing

 

 

WIN 10 Pro, i8-8700k @ 5.0ghz, ASUS Maximus x Code, 16GB Corsair Dominator Platinum Ram,



AIO Water Cooler, M.2 512GB NVMe,

500gb SSD, EVGA GTX 1080 ti (11gb), Sony 65” 4K Display

VPC MongoosT-50, TM Warthog Throttle, TRK IR 5.0, Slaw Viper Pedals

Link to comment
Share on other sites

Hi Warhog,

 

you're doing it partially right but the problem is that with 2 or 3 position switches are not made momentary in the sim.

That's why, before 128 version, we had to slitghtly modify the config/input .lua file corresponding to the card (in my case GP-WIZ) your panel is connected to.

Since the 128 came out, the structure of this input file's completlty changed. For a specific switch (2 or 3 positions) you have to add the opposite command to make this switch temporarily.

 

Here's an example for a 2 positions switch, such as the EMER FLOOD on the Electical Power Panel :

 

{down = iCommandEmergencyFlood, name = "Emergency flood", category = "Electrical power control panel"},

{combos = {{key = "JOY_BTN2"}}, down = iCommandEmergencyFlood, up = iCommandEmergencyFlood, name = "Emergency flood", category = "Electrical power control panel"},

 

You have to add the command in bold characters to make this switch temporarily after having assigned this desired swith to its function in the sim "controls" panel. Now, by doing so in the Default.lua, instead of in the config\input\... found in c:\user\your username\saved game\config\input\....you can't go wrong.

 

Here's another example for a 3-positions switch, such as the Master Arm switch, found on the AHCP :

 

{down = iCommandPlaneAHCPMasterArm, name = "Master switch ARM", category = "Armament HUD Control Panel"},

{combos = {{key = "JOY_BTN21"}}, down = iCommandPlaneAHCPMasterArm, up = iCommandPlaneAHCPMasterSafe, name = "Master switch ARM", category = "Armament HUD Control Panel"},

{down = iCommandPlaneAHCPMasterSafe, name = "Master switch SAFE", category = "Armament HUD Control Panel"},

{down = iCommandPlaneAHCPMasterTrain, name = "Master switch TRAIN", category = "Armament HUD Control Panel"},

{combos = {{key = "JOY_BTN22"}}, down = iCommandPlaneAHCPMasterTrain, up = iCommandPlaneAHCPMasterSafe, name = "Master switch TRAIN", category = "Armament HUD Control Panel"},

 

Always add modifiers to the considered switch when its initial position is the "OFF" or "SAFE" state.

 

With hopes that this helps you !

Cheers

Laurius


Edited by Laurius

Asus P8Z68 Deluxe, Intel Core i7-2600K (3.4 GHz), Corsair Vengeance 2x4096 Mo DDR3 1866 MHz, SSD 120 Go Vertex 2, EVGA GeForce GTX 970 FTW ACX 2.0 4Go (04G-P4-2978-KR), TM HOTAS Warthog #03797 (MB replaced), Saitek Combat Pro Rudder, TrackIR 5, TM Cougar MFDs with Lilliput 8" UM 80

Link to comment
Share on other sites

Hey Laurius so i did a repair on DCS and got original files for 1.2.8 i also use the GP-Wiz 40 cards and i bean stering at this for so long that im seeing codes everywhere lmao but still no dice. I maped my battery switch in game and it works for the ON posittion but not for OFF i dont see the Defoult LUA files that u are talking about im sure im missing something...... in my config imput files i only have the diff.lua files i dont see anything like what we used to for 1.2.7 codes

Link to comment
Share on other sites

@Zodiac,

 

As Einherjer said, try to look in X:\DCS World\mods\aircraft\A-10C\inputs\A-10C\joystick. X being the storage device where your DCS World program is saved, not the "saved game" directory found in Y:\user\your user name\saved game\config\input... which you're apparently still looking at... Y being the storage device for Windows, System and so on.

There, (in X:\DCS world....) you'll find the default.lua file. That's the file you need to modify, and you'll quickly see that its structure is the same as for the GP-WIZ you used to know, which is still stored in the Y:\user\you user name\DCS\config\input... but with a new extension .diff.lua since 128 version, and you absolutly want to modify, which is not the way to follow.

Once you've found this "default.lua" file, I think you'll make it.

If you've repaired DCS World, keep on searching for the "default.lua" but don't do anything before saving what you intend to modify. That's a basic but important rule here

 

Laurius

 

PS : In my case, Windows and everything system related in C:\ (SSD drive) and my DCS world is in D:\ (traditional HDD)

Asus P8Z68 Deluxe, Intel Core i7-2600K (3.4 GHz), Corsair Vengeance 2x4096 Mo DDR3 1866 MHz, SSD 120 Go Vertex 2, EVGA GeForce GTX 970 FTW ACX 2.0 4Go (04G-P4-2978-KR), TM HOTAS Warthog #03797 (MB replaced), Saitek Combat Pro Rudder, TrackIR 5, TM Cougar MFDs with Lilliput 8" UM 80

Link to comment
Share on other sites

Laurius you was right i was looking in saved games lol oopppssss!!!!!!! and thank you for all your help just one more question now that i found the right file in C:\DCS World\mods\aircraft\A-10C\inputs\A-10C\joystick.............. do i just copy and paste the files from saved games/impots?????? againe sorry for being slow lol if you could go in to a bit more detail how to get the WIZ diff.lua files in to the C:/"default.lua" thanks : )

Link to comment
Share on other sites

I am still a bit confused as to what to put in the LUA file for an A10C. I am trying to get just an On Off toggle switch to work with the Battery power switch, but I'm not sure what to write in the LUA to make this work for the A10C. Can you just copy and paste me a line to put in the LUA file to get this to work? Then I would be able to work out my other switches from there. Thanks!

Link to comment
Share on other sites

I believe that I have found a way of making 3 and 2 position toggle switches operate in a more useful way within DCS World 1.2.8.I do not claim to understand fully how it works, but it does (so far!).Please forgive me if I am a little long-winded in this post, but I do think it's worth explaining my method and suggested changes in some detail - both to get improvements or suggestions from more knowledgeable readers, and to encourage others to experiment. I will just deal with the A-10C, but the same principle should apply to all other aircraft.

 

Before continuing I will put in a plug for a very useful, free lua editor - ScITE.Not only does this allow editing but it also automatically displays different elements (keywords, variables, comment etc) in different colours, indents the text to make understanding easier, and applies an element of syntax checking before allowing you to save an amended lua file.This makes it safer than notebook etc.You can download it from http://www.scintilla.org or http://www.lua.org and it can also be used with other scripting languages.

 

My DCS cockpit is enhanced by 5 Leo Bodnar Buttonboxes and 2 BU0863X boards, which drive a wide variety of additional panels (Electrics, AHCP, Fuel, TACAN, ILS, Radios, Landing Gear Etc).I had spent some hours modding my Saved Games joystick .lua files to make them work - including various 3 position switches (e.g. Inverter Test/Off/Stby), and making 2 position switches operate both on and off.Consequently I was very frustrated, like many others, when the new 'diff.lua' system trashed much of my set-up.

 

I began by exploring the structure of the DCS World folders and files, reading this forum, and trying various changes to see what effect they had.As a result, I have concluded that the 'diff.lua' files (in '...Saved Games\DCS\Config\A-10C\joystick\') represent changes solely to the default file, and that these changes are made and amended within Options>Controls within the game.The default file to which these changes are applied appears to be 'DCS World\Mods\aircrafts\A-10C\Input\A-10C\joystick\default.lua'.This is the file used for all generic or non-recognised joysticks; the recognised joysticks (Joystick - HOTAS Warthog , F16 MFD 1, etc) all have their own lua files to use as the default.I have been unable to identify the purpose of the several other default.lua files sprinkled throughout the DCS directory or of the base_keyboard_binding.lua and base_joystick_binding.lua.

 

I experimented initially by copying the DCS provided 'CH PRO PEDALS USB.lua' and renaming it 'Saitek Pro Flight Rudder Pedals.lua'.I got that name by looking at what DCS had called my pedals in the Options>Controls, and deleting the serial number which followed it i.e. {56AB.....D34}.A quick look at the file showed that no further changes were required within this file.

 

By now a little bolder, I made 2 copies of the 'DCS World\Mods\aircrafts\A-10C\Input\A-10C\joystick\default.lua' file, and renamed them as 'Button Box Interface.lua' and 'BU0836X Interface.lua'; again I got these two names from looking at what they were called in 'Options>Controls' with the serial numbers deleted.I strongly recommend that you check what DCS calls your own interface devices and rename copies of default.lua accordingly, putting them in the joystick directory with the original default.lua.Even if you do decide not to rename your amended file I strongly urge you to save a backup of the original default.lua before you start amending it.DCS does not seem to worry about various additional files in this directory (for example I have a spare named 'blank.lua' as an additional backup.

 

Having created 2 new 'default' files (Button Box Interface.lua and BU0836X Interface.lua) in DCS World\Mods\aircrafts\A-10C\Input\A-10C\joystick\, the next thing I did was to amend these by deleting all the assignments they contained (carried over from the original default.lua).Just go through each line and amend any that start with {combos = .........} by deleting everything up to the word 'pressed' or 'up'.In my version they are lines 15-23, 204, 205, 266, 1013-1016.This will stop the system trying to assign the POV, Btn1 - Btn5, and Axes X, Y, Z and JOY_SLIDER1 to every joystick on your system. (This is where the SciTE, with its colour coding and search facility is very useful - just search for 'combos').

 

The first new facility is to make a 3-position toggle switch activate 3 inputs.I will use as an example the Electrical Panel Inverter Switch, which I have wired up with the central contact to ground and the two ON contacts to 2 input on your joystick interface (in my Case a Button Box or BU0836X).In your newly created file (which I will call MyDeviceDefault.lua) you need to find the 2 lines that operate the Inverter to TEST and STBY.In my case these are lines 433 and 435.If you look at these lines it may become clear why I have chosen these as my example - half the job is already done!These lines are:

 

433{down = iCommandElectricalPowerInverterSTBY,name =

'Inverter STBY', cate...etc}

434{down = iCommandElectricalPowerInverterOFF, name =

'Inv....etc}}

435{down = iCommandElectricalPowerInverterTEST,up =

iCommandElectricalPowerInverterOff, name = 'Invert........}

 

For some reason the TEST line (Line 435) does not need amending since it already has a section assigning an action to up/OFF, whereas the STBY line (433) does not.To remedy this simply copy from Line 435 the section

' ,up = CommandElectricalPowerInverterOff'

and paste it in line 433 immediately after the section

'down = iCommandElectricalPowerInverterSTBY'.

Take care to get it exactly correct, spaces don't seem to matter in most cases but commas certainly do.

 

Because it is so easy to make small syntax errors, I test the amended file (MyDeviceDefault.lua) after every 2 or 3 changes, rather than get to the end of 30 or so and find that it doesn't work.In the latter case I would have to go through every change to try and find my error.

 

To test it, save 'MyDeviceDefault.lua.' and then start DCS.Go to Options>Controls and in the column for the interface you are programming assign the Up selection of your toggle switch to 'Inverter STBY', and the Down position to 'Inverter TEST'.You will notice that there are 2 lines labelled 'Inverter STBY', but you can only add an assignment to one of them.This is a result of your modifying the default file.Strangely the 'Inverter TEST' line (the one which already had an up option) is not duplicated.I confess to not understanding why this is so.

 

If you do not get these results it suggests that you have probably made an error in modifying 'MyDevicedefault.lua'.However, if you are successful, exit Controls, fly the aircraft, and confirm that the switch now works as required.Once you have done that save a backup copy of your new .diff.lua so that you do not lose all your successful work to date if you mess it up with a later amendment.The new diff.lua should look something like this:

 

local diff = {

["keyDiffs"] = {

["d1074pnilu1075cdnilvdnilvpnilvunil"] = {

["added"] = {

[1] = {

["key" = "JOY_BTN11"],

},

},

["name"] = "Inverter STBY",

},

},

}

return diff

 

That's it.Now assign all the rest of your 3 position switches, checking that they work at regular intervals.

 

The final mod is to configure on/off switches, where DCS has not provided a separate input method for each. I will use the APU Gen Power switch, which on my set-up is a wired as a simple on/off switch.

 

Of course it will work without any modification, but will require you to move the switch to On and then back to Off in order to either switch on or switch off the aircraft device.Following this mod the aircraft switch will toggle back and forth every time the physical switch is moved.The only problem arises when the two are out of sequence..This can be quickly remedied by selecting Pause, operating the physical switch once (while the aircraft is not looking!), and then un-pausing.The switches should now be synchronised.

 

As before, we modify our new 'MyDeviceDefault.lua', remembering to save any changes at regular intervals for safety.Go to the line below:

 

432{down = iCommandAPUGeneratorPower, name = 'APU

generator power', .... etc

 

and modify it to read

 

432{down = iCommandAPUGeneratorPower,up =

iCommandAPUGeneratorPower, name = 'APU generator power', .... etc

 

That's it.Save it, start DCS, go to Options>Control, assign a switch input to the APU Generator Power line, check that it works in flight, and exit.The 'MyDeviceDefault.diff.lua' will have been modified.

Finally, one extra advantage in making new MyDeviceDefault.lua files, is that future updates will not over-write them as they might for the default.lua.Thus any changes made should survive updates - until DCS change the whole system again!

Link to comment
Share on other sites

I believe that I have found a way of making 3 and 2 position toggle switches operate in a more useful way within DCS World 1.2.8.I do not claim to understand fully how it works, but it does (so far!).Please forgive me if I am a little long-winded in this post, but I do think it's worth explaining my method and suggested changes in some detail - both to get improvements or suggestions from more knowledgeable readers, and to encourage others to experiment. I will just deal with the A-10C, but the same principle should apply to all other aircraft.

 

Before continuing I will put in a plug for a very useful, free lua editor - ScITE.Not only does this allow editing but it also automatically displays different elements (keywords, variables, comment etc) in different colours, indents the text to make understanding easier, and applies an element of syntax checking before allowing you to save an amended lua file.This makes it safer than notebook etc.You can download it from www.scintilla.org or www.lua.org and it can also be used with other scripting languages.

 

My DCS cockpit is enhanced by 5 Leo Bodnar Buttonboxes and 2 BU0863X boards, which drive a wide variety of additional panels (Electrics, AHCP, Fuel, TACAN, ILS, Radios, Landing Gear Etc).I had spent some hours modding my Saved Games joystick .lua files to make them work - including various 3 position switches (e.g. Inverter Test/Off/Stby), and making 2 position switches operate both on and off.Consequently I was very frustrated, like many others, when the new 'diff.lua' system trashed much of my set-up.

 

I began by exploring the structure of the DCS World folders and files, reading this forum, and trying various changes to see what effect they had.As a result, I have concluded that the 'diff.lua' files (in '...Saved Games\DCS\Config\A-10C\joystick\') represent changes solely to the default file, and that these changes are made and amended within Options>Controls within the game.The default file to which these changes are applied appears to be 'DCS World\Mods\aircrafts\A-10C\Input\A-10C\joystick\default.lua'.This is the file used for all generic or non-recognised joysticks; the recognised joysticks (Joystick - HOTAS Warthog , F16 MFD 1, etc) all have their own lua files to use as the default.I have been unable to identify the purpose of the several other default.lua files sprinkled throughout the DCS directory or of the base_keyboard_binding.lua and base_joystick_binding.lua.

 

I experimented initially by copying the DCS provided 'CH PRO PEDALS USB.lua' and renaming it 'Saitek Pro Flight Rudder Pedals.lua'.I got that name by looking at what DCS had called my pedals in the Options>Controls, and deleting the serial number which followed it i.e. {56AB.....D34}.A quick look at the file showed that no further changes were required within this file.

 

By now a little bolder, I made 2 copies of the 'DCS World\Mods\aircrafts\A-10C\Input\A-10C\joystick\default.lua' file, and renamed them as 'Button Box Interface.lua' and 'BU0836X Interface.lua'; again I got these two names from looking at what they were called in 'Options>Controls' with the serial numbers deleted.I strongly recommend that you check what DCS calls your own interface devices and rename copies of default.lua accordingly, putting them in the joystick directory with the original default.lua.Even if you do decide not to rename your amended file I strongly urge you to save a backup of the original default.lua before you start amending it.DCS does not seem to worry about various additional files in this directory (for example I have a spare named 'blank.lua' as an additional backup.

 

Having created 2 new 'default' files (Button Box Interface.lua and BU0836X Interface.lua) in DCS World\Mods\aircrafts\A-10C\Input\A-10C\joystick\, the next thing I did was to amend these by deleting all the assignments they contained (carried over from the original default.lua).Just go through each line and amend any that start with {combos = .........} by deleting everything up to the word 'pressed' or 'up'.In my version they are lines 15-23, 204, 205, 266, 1013-1016.This will stop the system trying to assign the POV, Btn1 - Btn5, and Axes X, Y, Z and JOY_SLIDER1 to every joystick on your system. (This is where the SciTE, with its colour coding and search facility is very useful - just search for 'combos').

 

The first new facility is to make a 3-position toggle switch activate 3 inputs.I will use as an example the Electrical Panel Inverter Switch, which I have wired up with the central contact to ground and the two ON contacts to 2 input on your joystick interface (in my Case a Button Box or BU0836X).In your newly created file (which I will call MyDeviceDefault.lua) you need to find the 2 lines that operate the Inverter to TEST and STBY.In my case these are lines 433 and 435.If you look at these lines it may become clear why I have chosen these as my example - half the job is already done!These lines are:

 

433{down = iCommandElectricalPowerInverterSTBY,name =

'Inverter STBY', cate...etc}

434{down = iCommandElectricalPowerInverterOFF, name =

'Inv....etc}}

435{down = iCommandElectricalPowerInverterTEST,up =

iCommandElectricalPowerInverterOff, name = 'Invert........}

 

For some reason the TEST line (Line 435) does not need amending since it already has a section assigning an action to up/OFF, whereas the STBY line (433) does not.To remedy this simply copy from Line 435 the section

' ,up = CommandElectricalPowerInverterOff'

and paste it in line 433 immediately after the section

'down = iCommandElectricalPowerInverterSTBY'.

Take care to get it exactly correct, spaces don't seem to matter in most cases but commas certainly do.

 

Because it is so easy to make small syntax errors, I test the amended file (MyDeviceDefault.lua) after every 2 or 3 changes, rather than get to the end of 30 or so and find that it doesn't work.In the latter case I would have to go through every change to try and find my error.

 

To test it, save 'MyDeviceDefault.lua.' and then start DCS.Go to Options>Controls and in the column for the interface you are programming assign the Up selection of your toggle switch to 'Inverter STBY', and the Down position to 'Inverter TEST'.You will notice that there are 2 lines labelled 'Inverter STBY', but you can only add an assignment to one of them.This is a result of your modifying the default file.Strangely the 'Inverter TEST' line (the one which already had an up option) is not duplicated.I confess to not understanding why this is so.

 

If you do not get these results it suggests that you have probably made an error in modifying 'MyDevicedefault.lua'.However, if you are successful, exit Controls, fly the aircraft, and confirm that the switch now works as required.Once you have done that save a backup copy of your new .diff.lua so that you do not lose all your successful work to date if you mess it up with a later amendment.The new diff.lua should look something like this:

 

local diff = {

["keyDiffs"] = {

["d1074pnilu1075cdnilvdnilvpnilvunil"] = {

["added"] = {

[1] = {

["key" = "JOY_BTN11"],

},

},

["name"] = "Inverter STBY",

},

},

}

return diff

 

That's it.Now assign all the rest of your 3 position switches, checking that they work at regular intervals.

 

The final mod is to configure on/off switches, where DCS has not provided a separate input method for each. I will use the APU Gen Power switch, which on my set-up is a wired as a simple on/off switch.

 

Of course it will work without any modification, but will require you to move the switch to On and then back to Off in order to either switch on or switch off the aircraft device.Following this mod the aircraft switch will toggle back and forth every time the physical switch is moved.The only problem arises when the two are out of sequence..This can be quickly remedied by selecting Pause, operating the physical switch once (while the aircraft is not looking!), and then un-pausing.The switches should now be synchronised.

 

As before, we modify our new 'MyDeviceDefault.lua', remembering to save any changes at regular intervals for safety.Go to the line below:

 

432{down = iCommandAPUGeneratorPower, name = 'APU

generator power', .... etc

 

and modify it to read

 

432{down = iCommandAPUGeneratorPower,up =

iCommandAPUGeneratorPower, name = 'APU generator power', .... etc

 

That's it.Save it, start DCS, go to Options>Control, assign a switch input to the APU Generator Power line, check that it works in flight, and exit.The 'MyDeviceDefault.diff.lua' will have been modified.

Finally, one extra advantage in making new MyDeviceDefault.lua files, is that future updates will not over-write them as they might for the default.lua.Thus any changes made should survive updates - until DCS change the whole system again!

 

Many thanks for that clear instruction. One question bothers me still: there are also buttons, which work like this:

 

{down = device_commands.Button_3, up = device_commands.Button_3, cockpit_device_id = devices.SYS_CONTROLLER, value_down = 1.0, name = 'Caution Panel Test/Reset Switch Reset', category = 'Pedestal'},

 

When I now try to amend that by adding the value_up = 0.0 right after the value_down term nothing happens. Any idea how that works? I thought it is like that for a 3-way switch:

Psitions:

Up = 1.0

middle = 0.0

down = -1.0

 

But there are also values of 0.4, 0.6 etc. I think that is seen with rotaries switches.

 

Can someone clearify that to me please coz I am still not able to programm my Button Boxes correctly. Many thanks in advance.

 

Cheers

 

Demon

[sIGPIC][/sIGPIC]

Founder of the -=VDS=-

:pilotfly:

Link to comment
Share on other sites

For some reason the TEST line (Line 435) does not need amending since it already has a section assigning an action to up/OFF, !

 

The reason is because [Line 435] acts as a momentary switch, and not a standard toggle. Those lines act as an On/Off/Mom toggle switch

Link to comment
Share on other sites

  • Recently Browsing   0 members

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