Jump to content

How to set up toggle switches (a tutorial)


Recommended Posts

Demon, can't help with that one - not explored far enough. However, aFter your post, I did change the Value Up from -1 to 1 in the A-10C Seat Down command without any apparent effect. It still works exactly the same.

Link to comment
Share on other sites

To piggy back off of flyco, the test position on the three way inverter switch is a momentary toggle. So I switch it that position, release my finger and it returns to center. To give you an idea, this is my default.lua combo addition added directly to the file. My file is located at my custom directory of I:\DCS\Mods\aircrafts\A-10C\Input\A-10C\joystick\default.lua Combos seems to work best rather than changing the regular commands in case I want to use my mouse for some odd reason, say I have a short on my switch box and I just don't use it for a flight.

 

Electrical Panel:

{combos = {{key = 'JOY_BTN21'}}	, down = iCommandAPUGeneratorPower				, up = iCommandAPUGeneratorPower			, name = 'APU generator power'	        , category = 'Electrical power control panel'};
{combos = {{key = 'JOY_BTN24'}}	, down = iCommandEmergencyFlood					, up = iCommandEmergencyFlood				, name = 'Emergency Flood'		, category = 'Electrical power control panel'};
{combos = {{key = 'JOY_BTN20'}}	, down = iCommandBatteryPower					, up = iCommandBatteryPower			        , name = 'Battery power'		, category = 'Electrical power control panel'};
{combos = {{key = 'JOY_BTN22'}}	, down = iCommandElectricalPowerInverterSTBY                  	, up = iCommandElectricalPowerInverterOFF        	, name = 'Inverter STBY'		, category = 'Electrical power control panel'};
{combos = {{key = 'JOY_BTN23'}}	, down = iCommandElectricalPowerInverterTEST                  	, up = iCommandElectricalPowerInverterOFF        	, name = 'Inverter Test'	        , category = 'Electrical power control panel'};
{combos = {{key = 'JOY_BTN18'}}	, down = iCommandPowerGeneratorLeft				, up = iCommandPowerGeneratorLeft			, name = 'AC generator power left'	, category = 'Electrical power control panel'};
{combos = {{key = 'JOY_BTN19'}}	, down = iCommandPowerGeneratorRight        			, up = iCommandPowerGeneratorRight			, name = 'AC generator power right'	, category = 'Electrical power control panel'};

 

As stated in a different thread the switches I use are: APU Generator, Emergency Flood, Battery Power, and AC Gens left and right are each on their own SPST (On-Off) switch. Inverter STBY, TEST, and Off are on a single SPDT (On-Off-On) switch.

 

EDIT: Sniped on the first two sentences. :)


Edited by Hobo
Link to comment
Share on other sites

Demon, can't help with that one - not explored far enough. However, aFter your post, I did change the Value Up from -1 to 1 in the A-10C Seat Down command without any apparent effect. It still works exactly the same.

 

Thanks for trying. I have the issues in the UH-1H default.lua. Same here, nothing changes by changing those values. It is still unbelievable to me, that ED is not able to offer an update proof solution for assigning the switches. I mean there are so many pilots out there having a fully setup with real switches. If they have to go over it every time an update occures, I would go nuts. And honestly I have no patience any more to try & error out everything. There is nothing said in the manual at all about that stuff. I invested more than 500€ in that software and the very one thing which should work is the key assignment. If there is anyone outside there who know how to configure that switch thingy for 3-way and 2-way Switches (on - off - on or on -off Switch) than it would be really appriciate it. I dont play the sim anymore because I cannot configure my 124 Switches.

 

Thanks for reading.

 

Flyco: great job on the explaining for the A-10c. Unfortunately the Huey is a bit different. And thank god I backupped the default lua with all my changes coz that got over written by the update again. That really really annoys me.

 

Cheers,

 

Demon

[sIGPIC][/sIGPIC]

Founder of the -=VDS=-

:pilotfly:

Link to comment
Share on other sites

1.2.8 drove me nuts having to reprogram all my switches. Lucky for me it was not 124, I only had to deal with 24 switches. The combo commands is what I use, then I use JSGME with my configured default.lua saved so I don't have to worry about future overwrites.

 

Like I said in my previous post, the combo command works for my two way(SPST) (On-OFF) and three way(SPDT) (On-OFF-On) switches. I have other combo commands used for the other switches such as the AHCP and Fuel Panel.

Link to comment
Share on other sites

1.2.8 drove me nuts having to reprogram all my switches. Lucky for me it was not 124, I only had to deal with 24 switches. The combo commands is what I use, then I use JSGME with my configured default.lua saved so I don't have to worry about future overwrites.

 

Like I said in my previous post, the combo command works for my two way(SPST) (On-OFF) and three way(SPDT) (On-OFF-On) switches. I have other combo commands used for the other switches such as the AHCP and Fuel Panel.

 

Yes the combos work because they have a different structure. But all the others do not work... sigh but I am sure someone knows how to programm it. Tough enuff that a USER has to learn lua just setup his hardware. :(:doh:

 

I really love DCS but that really sucks...

 

Cheers

 

Demon

[sIGPIC][/sIGPIC]

Founder of the -=VDS=-

:pilotfly:

Link to comment
Share on other sites

What trouble are you having programing your switches?

 

-Info needed...

- what function are you trying to program?

- What type of switch are you trying to use (Actual toggle switch, momentary switch on joystick)?

  • Like 1
Link to comment
Share on other sites

What trouble are you having programing your switches?

 

-Info needed...

- what function are you trying to program?

- What type of switch are you trying to use (Actual toggle switch, momentary switch on joystick)?

 

I need to reconfigure the UH-1H and the F-15 lua's. All Toggle Switches. Rotary Switches work.

 

UH-1H:

practically all switches available in the Huey. the syntax is like:

 

{down = device_commands.Button_10, cockpit_device_id = devices.ELEC_INTERFACE, value_down = -1.0, name = 'Main generator ON/OFF Switch', category = 'Ins Overhead panel'},

 

Just as an example. If I want to toggle between on/of I would insert this into the argument:

value_up = 0.0,

 

Then we would have this term:

 

{down = device_commands.Button_10, cockpit_device_id = devices.ELEC_INTERFACE, value_down = -1.0, value_up = 0.0, name = 'Main generator ON/OFF Switch', category = 'Ins Overhead panel'},

 

In 1.2.7 it worked like that and I could toggle the switch up and down to turn it on and off. But in 1.2.8 It doesnt work that way anymore. I copied the default.lua in Mods/Aircraft.... and named like: Button Box Interface. Which gets correcly recognized by DCS. But none of the changes I made with {down = device_commands.Button_10, cockpit_device_id = devices.ELEC_INTERFACE, value_down = -1.0, value_up = 0.0, name = 'Main generator ON/OFF Switch', category = 'Ins Overhead panel'} worked how it supposed to work. I dont know if I explain it clear enough so you can help me, but any hint would be much appriciated.

 

Thanks so far

 

Demon

[sIGPIC][/sIGPIC]

Founder of the -=VDS=-

:pilotfly:

Link to comment
Share on other sites

Demon

 

{down = device_commands.Button_10, cockpit_device_id = devices.ELEC_INTERFACE, value_down = -1.0, value_up = 0.0, name = 'Main generator ON/OFF Switch', category = 'Ins Overhead panel'},

 

You told the program what the up value was, but you didn't tell it there was an up command.

 

The line should read as follows....

 

{down = device_commands.Button_10, up = device_commands.Button_10, cockpit_device_id = devices.ELEC_INTERFACE, value_down = -1.0, value_up = 0.0, name = 'Main generator ON/OFF Switch', category = 'Ins Overhead panel'},

Link to comment
Share on other sites

Ok guys,

I have done as flyco did and I get 2 lines in game setup, I setup the first switch and it saves changing the Diff.lua. next switch I try is seen by game but when i click ok it don't save the square remains blank and the diff.lua is not changed, if I delete first and do 2nd then it works but original won't save. it seems that it will only do 1 switch on each bu board, this is only ones i have changed buttons that are already up/down in lua work and save fine.

HELP LOL.

AMD A8-5600K @ 4GHz, Radeon 7970 6Gig, 16 Gig Ram, Win 10 , 250 gig SSD, 40" Screen + 22 inch below, Track Ir, TMWH, Saitek combat pedals & a loose nut behind the stick :thumbup:

Link to comment
Share on other sites

G00dnight, I have found the same problem on about 20% of case. I don't understand why, but you can solve it as follows.

 

First, go back to the 'Mods\aircrafts\A-10C\input\A-10C\joysticks\default.lua' and remove the additional 'up = section ...'. Then go to the relevant 'Saved Games' lua and in the line you are trying to change replace any command number after the 'u' with 'nil' (In practice you may find that DCS has already deleted this line because it couldn't understand it - that's OK). Then go into DCS Options>Controls and set the control as normal. The second line should have disappeared and the key should be stored OK.

 

Then go back to the defaullt.lua and re-insert the 'up = ...' section. Go back to the relevant Saved Games lua, find the relevant key entry and replace the 'unil' with 'uxxxx', where xxxx is the same 3 or 4 figure code that is shown after the 'd' earlier in the same line. Sve everything and t ry again. You should find that in DCS Options>Controls the double line is back, but one of them will have the button number inserted.

 

A bit messy, I know, but so far it's worked every time for me, and I have 7 Button Boxes and BU0836x, with about half populated with buttons and the other half with rotary encoder inputs.

 

On reflection, it would have been easier in the first place to copy each of the lines that I wanted to amend in the default file and comment out one of them. Then by amending the un-commented version, I could have switched easily between the 2 by deleting and un-deleting the comment (--) at the start of each line. That would have saved me a lot of time going back to correct faults I had made (usually, doubler or missing commas!)

 

Let me know how you get on.

 

Flyco

  • Like 1
Link to comment
Share on other sites

hi Flyco,

I gave up on it and went back to a mix of Helios and plain control setting in game. I have found I can do pretty much anything this way, the switches are a breeze to set and all the Rot's & Enc's are easily set in the game settings. if I have to do it all again I will keep in mind your workround as I would prefer to have it all in one.

BTW I only have 4 leo BU0836X boards but they are maxed out.

thanks for the help.rep inbound.

AMD A8-5600K @ 4GHz, Radeon 7970 6Gig, 16 Gig Ram, Win 10 , 250 gig SSD, 40" Screen + 22 inch below, Track Ir, TMWH, Saitek combat pedals & a loose nut behind the stick :thumbup:

Link to comment
Share on other sites

Demon

 

{down = device_commands.Button_10, cockpit_device_id = devices.ELEC_INTERFACE, value_down = -1.0, value_up = 0.0, name = 'Main generator ON/OFF Switch', category = 'Ins Overhead panel'},

 

You told the program what the up value was, but you didn't tell it there was an up command.

 

The line should read as follows....

 

{down = device_commands.Button_10, up = device_commands.Button_10, cockpit_device_id = devices.ELEC_INTERFACE, value_down = -1.0, value_up = 0.0, name = 'Main generator ON/OFF Switch', category = 'Ins Overhead panel'},

 

Many thanks, that did the JOB!!!!

 

Cheers,

 

Demon

[sIGPIC][/sIGPIC]

Founder of the -=VDS=-

:pilotfly:

Link to comment
Share on other sites

In order to make editing these lua files easier, I decided to build a DCS profiler.

With this tool it will be possible to assign functions to your controller like described in this topic.

 

Note: this is very much Work in Progress.

 

attachment.php?attachmentid=84427&stc=1&d=1372865026

 

Anyone got any idea when this will be available?

Link to comment
Share on other sites

Anyone got any idea when this will be available?

Seems to be a great question, but this threads over a year old. I wouldnt get hopes up, but would be nice to use something other than TARGET software...Im not even sure where to even start on programming my stick..

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

 

Well I just did what Warhog suggested I do for a 2 function switch and it worked without messing around with LUA file. I just used an ON/ON switch like he said. I placed two wires into one slot on the Bodnar, say B32, and one wire into the GND on the board. Now I have an ON/OFF function just like he said, so why all the messing with the LUA for a 2 position switch?

Link to comment
Share on other sites

Hi Dudester,

 

I don't know how you made it, but if it's working the way you're saying, I'm really glad for you. In my case it never worked as simple as you're saying.

To sum things up, I started building some panels in early 2012 and was inspired by Tigersharkbras thread at that moment. But config.lua file has already changed. Nevertheless, I could have my switches working fine with what I indicated in previous posts, I mean by modifying the "config.lua" file found in saveds games.

Since 128 version, this was no longer working, and as I said, I followed Cichlidfan's advice to modify the "default.lua" file since this file had the same structure and syntaxe than the former "config.lua" file I modified to get my GP WIZ working.

Without modifying the "default.Lua" file, I could not ever get a 2-way switche nor a 3-way switch to work properly just by only setting up these switches in the option panel. I tried since the 128 version of the sim came out but no way.

I will add that my switches are probably wired up in the same way as for the Leo card.

I probably miss something with the LeoBodnar interface you're mentioning but since I have a GP WIZ interface, I come to think that the software that comes along with this Leo card might allow so, knowing again that I might be completly wrong.

I'm completly speculative on this point since I don't have a Leobodnar card interface. But from what I have seen so far, you have to tweak a .lua file. And the new config.diff.lua file was way too far from my understanding.

So, I went to the straight and easiest way to do so in my case, i. e. just copy and past, from my old input.lua file, the relevent parts for the panels I have, into this default.lua.

Before doing so, I of course mapped my every switches position into the "option panel" of the sim, but without success if not modifying this default.lua file

Once again, because I was left with DCS, which doesn't recognize temporarly switches (except for the TM Hotas Warthog so far, which I never had problem with)

Has anything changed in that regard ? I don't know. What I know is that it didn't work so easily. So If you have a trick to make things simpler, share it with us please.

Best regards

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

@Laurius

 

Well it was Warhog that gave me the advice, but I'll do my best. The Leo bodner board I use is not a pulse board, it is a board that stays on and something Warhog told me DCS needs. It has buttons 1 to 32 and that's all the info you need to know about the board.

 

All I did to get a function for an ON OFF switch was use an ON ON switch. The switch I got has 3 terminals. I placed a wire on both sides of the switch (ON ON terminals) to one block connector. I then connected one wire coming out of the same block connector, so basically making two wires become one. I connected another wire to the middle terminal of the switch which is GND (Ground) and I was ready to place the wires into the Bodnar board. I placed the two wires I had made into one wire in a slot on in board (say slot B32) and I then just placed the GND into the GND of the board.

 

I then went into the options in the game and flicked the switch for battery. Which as you probably know has only one option in the option menu of the A10C Sim. This assigned a key and now when I switch it in the game it acts like an ON/OFF switch.

 

The only problem I ever got with this method was that when I clicked the switches fast they sometimes wouldn't be recognised. This was no biggy though because I would just put the switches in the sim to the same posion as my toggle switches and it was fine again. Anyways, it doesn't happen now because I just move the switches back and forth a bit slower now to give it time to recognized.

 

For a switch like the APU which has two function in the DCS options ON and OFF, I used the same ON/ON switch but wired it differently. I left out the block connector, so had a wire connected to both ON ON terminals and One wire for GND. I placed one wire in B29 and the other in B28, and then obviously I connected the other wire into GND. I then went into the options of DCS, I pressed the toggle up for ON and it gave me a Joy Button and then pressing it down gave me another Joy Button. Warhog gave me the advice and it's worked for me without messing with the LUA files so far. I am not sure if this is the way you are suppose to do it because I know nothing about this, but it's worked so I'm happy.


Edited by Dudester22
Link to comment
Share on other sites

rotary switch (not rotary encoder)

 

Can anyone tell me if it is possible to assign the individual modes of the PVI-master-mode switch in the shark to keys? i would like to assign a button on the stick to get in the edit-mode directly and then switch to an other mode with an other key.

Link to comment
Share on other sites

Hi Dudester,

 

I don't know how you made it, but if it's working the way you're saying, I'm really glad for you. In my case it never worked as simple as you're saying.

To sum things up, I started building some panels in early 2012 and was inspired by Tigersharkbras thread at that moment. But config.lua file has already changed. Nevertheless, I could have my switches working fine with what I indicated in previous posts, I mean by modifying the "config.lua" file found in saveds games.

Since 128 version, this was no longer working, and as I said, I followed Cichlidfan's advice to modify the "default.lua" file since this file had the same structure and syntaxe than the former "config.lua" file I modified to get my GP WIZ working.

Without modifying the "default.Lua" file, I could not ever get a 2-way switche nor a 3-way switch to work properly just by only setting up these switches in the option panel. I tried since the 128 version of the sim came out but no way.

I will add that my switches are probably wired up in the same way as for the Leo card.

I probably miss something with the LeoBodnar interface you're mentioning but since I have a GP WIZ interface, I come to think that the software that comes along with this Leo card might allow so, knowing again that I might be completly wrong.

I'm completly speculative on this point since I don't have a Leobodnar card interface. But from what I have seen so far, you have to tweak a .lua file. And the new config.diff.lua file was way too far from my understanding.

So, I went to the straight and easiest way to do so in my case, i. e. just copy and past, from my old input.lua file, the relevent parts for the panels I have, into this default.lua.

Before doing so, I of course mapped my every switches position into the "option panel" of the sim, but without success if not modifying this default.lua file

Once again, because I was left with DCS, which doesn't recognize temporarly switches (except for the TM Hotas Warthog so far, which I never had problem with)

Has anything changed in that regard ? I don't know. What I know is that it didn't work so easily. So If you have a trick to make things simpler, share it with us please.

Best regards

Laurius

 

Hi Laurius,

The messing around with Lua's are for people who also want to repurpose their panels for other games/sims. If you want to dedicate your panel to Warthog then sure, attaching both contacts of an On|On switch will work no problem. But if for example, you wanted to use that same switch for another game, and that game did not use a toggling mechanism like Warthog, then having 2 separate button presses might be required.

 

In short, it's all about how flexible you want your panel to be. If you want flexibility, you wire up each On|On switch as an individual button press. If you are happy to use it for just Warthog then wiring up an On|On switch to a single button press works fine.

 

My original panel concept and video was all about flexibility so that's why I still like to mess with Lua's.

 

Having said that, this whole diff file thing has got me stumped. I desparately want to use it rather than messing with the source Lua file but I simply can't get 3 position switches working using it.

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

Can someon help me.

 

I have tried to get a toggle switch a ON OFF ON and taking the exsample of the Electric panel I have need 3 different setting. One test one standby and one off. so how do I do this? I have set up the test and the satndby in DCS a-10 now I need the off

 

Here is what I have in the setting for my board

 

local diff = {

["keyDiffs"] = {

["d1074pnilunilcdnilvdnilvpnilvunil"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN2",

},

},

["name"] = "Inverter STBY",

},

["d1076pnilu1075cdnilvdnilvpnilvunil"] = {

["added"] = {

[1] = {

["key"] = "JOY_BTN3",

},

},

["name"] = "Inverter TEST",

},

 

Please can someone tell me how I make a off setting so when each neither of these are switched to it goes to the off setting?

Link to comment
Share on other sites

Hi Dudester & TigersharkBAS,

 

Many thanks to both of you for your inputs and explainations, really !!

Now, I think I understand !

Compared to you, the first difference I see is that for 2-positions switches, I only use single-throw-double-pole (STDP) ON-OFF switches. Ground being connected to the OFF position. I should perhaps replace them by ON-ON switches and follow your way for wiring them. I must say I was really not aware of that trick :D

That being said, and as you mentioned it TigersharkBAS, I still don't see how to manage this solution for 3-positions switches.

Understanding how the diff.lua file works in order to properly modify it would be surely a much better solution, like before 128 version. But in my case, that does not seem to be for tomorrow if I may say.

Anyway, I feel fine with this solution at the moment since I use these panels only for the A-10C. I keep preciously the original and the modified default.lua somewhere on my computer and I don't mind re-copying/re-pasting the modified one when an update of the sim comes out.

Just hoping it'll be a bit simpler in the future.

Once again thanks to you both :thumbup:

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

I have trried making a file for my Leo Bodnar circit board and I can get the dame thing to do it.

 

I am tring to make a swich for the power on in the a-10c and it has no off switch in the setup so I am trying to make it understand when the power if off the switch should sho0w as off. what am I doing wrong? First time doing anything like this can someone help me please

 

function layout()

return {

forceFeedback = {

trimmer = 1,

shake = 0.5,

swapAxes = false,

invertX = false,

invertY = false,

},

keyCommands = {

 

{combos = {{key = "JOY_BTN2"}, }, down = iCommandPlaneBatterypower, up = iCommandPlaneBatterypower/off, name = "Battery power/off", category = "Electric Power Control Panel"},

},

}

end

Link to comment
Share on other sites

Maybe someone could try this and post here if it works! Someone was helping me out and gave me this answer, so it's a big thanks to them if it works. I will continue to use ON ON switches for an ON OFF function because I think it's easier, but I have ordered some ON OFF ON switches to test this out. Please do reply if this works for someone though. Thanks!

 

 

For an On/Off/On switch we’ll look at lines 767,768,769, this is the GUNPAC switch, it has 3 positions. ARM/SAFE/GUNARM Now even though it’s a 3 position switch, we are only going to use two (2) buttons to make it work.

We are going to change line 767, and line 769, it is not necessary to alter line 768, since this is the SAFE position, (which will be the OFF position on our switch. Also, as with the ON/OFF switch we coded above for the battery, these lines as also ‘iCommand’ functions, so we don’t need to add values for down or up.

 

Line767 we are going to add, combos = {{key = 'JOY_BTN5'}}, to the beginning of the line, and up = iCommandPlaneAHCPGUNSafe, after the down command so the line looks like this…..

 

Line767 { combos = {{key = 'JOY_BTN5'}}, down = iCommandPlaneAHCPGUNPACArm, up = iCommandPlaneAHCPGUNSafe, name = 'GUN/PAC switch ARM', category = 'Armament HUD Control Panel'},

You’ll notice that for the UP command we are using the command information from Line 768 to code the OFF position of our switch.

 

Line768 {down = iCommandPlaneAHCPGUNSafe, name = 'GUN/PAC switch SAFE', category = 'Armament HUD Control Panel'},

 

Now for line 769, we use the same combos = {{key = 'JOY_BTN6'}}, command at the beginning of the line, and the same up = iCommandPlaneAHCPGUNSafe, command as in line 767, Again this will be the OFF position of our switch.

 

Line769 { combos = {{key = 'JOY_BTN6'}}, down = iCommandPlaneAHCPGUNArm, up = iCommandPlaneAHCPGUNSafe, name = 'GUN/PAC switch GUNARM', category = 'Armament HUD Control Panel'},

 

Now save these changes to your ButtonBox Interface.lua

 

I hope I haven’t lost you along the way. I know it’s a lot of information, but really its not. There are only 4 basic parts to the code you need to remember…

Combos = {{key = ‘JOY_BTN#}}, is the button number you wish to use

down (means the switch in in the ON position)

up (means the switch is in the OFF position)

Pressed (also means the switch is in the ON position, but usually refers to a momentary switch)

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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