Jump to content

How to set up toggle switches (a tutorial)


Recommended Posts

I tried messing around with the default.lua again and still no luck when using an ON-OFF toggle switch. When I keep the original .lua, it will recognize the ON position of the switch and it works in the sim, except for when I select OFF, obviously nothing happens, so I know the wiring and the switch and the board are fine and communicating, it has to be the coding of the .lua. I have tried what many others have supposedly used and worked, this line:

 

{down = iCommandAPUGeneratorPower, up = iCommandAPUGeneratorPower, name = _('KEN APU generator power'), category = _('Electrical power control panel')},

 

But when I go to assign the control in the game, the box to assign the control in the control settings is grayed out and it says "No Command available for this device". Any idea why it does that and says that? Guessing again it has something to do with the wording of the wording in the .lua line, but yet, putting in the  up = iCommandAPUGeneratorPower, has worked for others. ???? 

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to post
Share on other sites
  • Replies 859
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

For the launch bar maintained 2-position switch, this line works: {down = gear_commands.LaunchBarSw, up = gear_commands.LaunchBarSw, cockpit_device_id = devices.GEAR_INTERFACE, value_down = -1.0,

Foreword Hi all. I noticed that some people have had some trouble setting up their TM Warthog's toggle switches (myself included) in games apart from A-10C. Basically, when toggled to the ON sta

@Wildwind: Commands like "iCommand..." generally don't use arguments, and if you include any they are simply ignored. I created these new lines for your "default.lua": {down = 3004, cockpit_device_i

@Kenpilot:

Please provide a bit more detail:

1. Which aircraft?

2. Which game controller do you want to use for the APU Gen Power command?

3. Does the original (ON/OFF toggle) command work on that same game controller?

Having the info re 1. and 2. would allow people to try and reproduce your problem.

 

Also, some aircrafts have a configuration that adds complexity. Example: The Warthog A-10C

In the folder "...\Mods\aircraft\A-10C_2\Input\A-10C_2\joystick" it has not only the "default.lua" but also controller-specific versions of that file, like "Throttle - HOTAS Warthog.lua", "F16 MFD 1.lua" and others". Now if you create a command that you want to bind to a switch on the TM Warthog throttle for example, you must add the command not to "default.lua" but to "Throttle - HOTAS Warthog.lua". This might be the reason why you can't bind your command. Note: the files ending with "diff.lua" have nothing to do with the issue.

 

Anyway, your line of code will produce the same command when you switch from OFF to ON as when you switch from ON to OFF. This may seem to work at first, but can easily go out of sync. If you want to have a true 2-position command for a maintained ON/OFF switch, this line of code will do it:

{down = 3001, up = 3001, cockpit_device_id = 1 , value_down = 1.0, value_up = 0.0, name = _('APU Gen Power 2-Pos ON/OFF'), category = _('Electrical power control panel')},

 


Edited by LeCuvier
clarity

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to post
Share on other sites
6 hours ago, LeCuvier said:

@Kenpilot:

Please provide a bit more detail:

1. Which aircraft?

2. Which game controller do you want to use for the APU Gen Power command?

3. Does the original (ON/OFF toggle) command work on that same game controller?

Having the info re 1. and 2. would allow people to try and reproduce your problem.

 

Also, some aircrafts have a configuration that adds complexity. Example: The Warthog A-10C

In the folder "...\Mods\aircraft\A-10C_2\Input\A-10C_2\joystick" it has not only the "default.lua" but also controller-specific versions of that file, like "Throttle - HOTAS Warthog.lua", "F16 MFD 1.lua" and others". Now if you create a command that you want to bind to a switch on the TM Warthog throttle for example, you must add the command not to "default.lua" but to "Throttle - HOTAS Warthog.lua". This might be the reason why you can't bind your command. Note: the files ending with "diff.lua" have nothing to do with the issue.

 

Anyway, your line of code will produce the same command when you switch from OFF to ON as when you switch from ON to OFF. This may seem to work at first, but can easily go out of sync. If you want to have a true 2-position command for a maintained ON/OFF switch, this line of code will do it:


{down = 3001, up = 3001, cockpit_device_id = 1 , value_down = 1.0, value_up = 0.0, name = _('APU Gen Power 2-Pos ON/OFF'), category = _('Electrical power control panel')},

 

 

Hi LeCuvier, thanks for the response. 

1. A10C

2.  Groovy Game Gear GP-WIZ40

3. Yes, it does work on the game controller for the ON position only if I leave the .lua files default.

 

I only fly the A10C for right now and I'm not wanting to change anything with the Warthog HOTAS joystick nor the Throttle. I'm creating my own cockpit panels. I'm using maintained ON-OFF or ON-ON toggle switches, whichever will be easier to use for these controls for the A10-C. The controls that only have one button assignment for both ON and OFF functions, such as the Battery Power or APU GEN PWR Switches. 

 

I hope this helps. If you need any other information, please let me know. I will try your suggestion here in a little bit when I can get to my simpit. Thank you very much for helping!!

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to post
Share on other sites

I got it to work!!!! I thought the new .lua command line only had to go in to the keyboard default.lua. When I did that, it greyed out the control assignment box in the game settings for the APU GEN PWR assignment, and when I hovered over the box, it said "No command available for this device" I then re-read your response over and over again and I noticed you said something about the joystick .lua, which I never looked at or even thought it had anything to do with what I was trying to do because I wasn't trying to re-write anything for the Warthog Throttle or HOTAS joystick. I went in to the joystick file and found the "other" default.lua and entered the new command line in that defualt.lua file as well and that's what did it!! Not only did your command line work that you suggested, but I also tried the :

 

{down = iCommandAPUGeneratorPower, up = iCommandAPUGeneratorPower,  name = _('APU generator power'), category = _('Electrical power control panel')}, 

 

and it worked as well!

 

Thanks again for your help LeCuvier!!!! Days of frustration finally figured out!! 

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to post
Share on other sites

On to my next dilemma. I'm trying to wire a SP3T ON-ON-ON switch (6Poles) for the switches in the A10-C that actually have 3 separate control assignments, one for each position, such as the Lighting Panel switch for Position Lights that have the functions : FLASH-OFF-STEADY. I have been able to wire the switch to get the Top and Bottom ON positions to work, but I can't get the middle OFF position wire correctly. I have tried just about every wire combination that I have found online and nothing works for the game to recognize that middle position being ON. I'm attaching a copy of the data sheet. I have tried to wire it as it's shown, but the game still doesn't recognize the middle ON position when it's selected. I'm using a Groovy Game Gear GP-WIZ40 card.

 

If I can't get this to work, I have seen people use an ON-OFF-ON switch and just edit the .lua files. Anybody have a copy of their default.lua file they can send me or post on here so I can see the correct way to write it for it to work with an ON-OFF-ON switch? Thanks! 

SP3T Toggle Switch data sheet.JPG

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to post
Share on other sites

For a maintained 3-position switch ON/OFF/ON you only need 2 bindings:

{down = iCommandPlanePositionLightsFlash, up = = iCommandPlanePositionLightsOff, name = _('Position Lights FLASH/OFF'), category = _('Lighting Panel')},
{down = iCommandPlanePositionLightsSteady, up = = iCommandPlanePositionLightsOff, name = _('Position Lights STEADY/OFF'), category = _('Lighting Panel')},

It works on the basis that if neither FLASH nor STEADY is TRUE then OFF is TRUE.

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to post
Share on other sites

Here are all additions I made for the A-10C. I use only a subset, most were created to help other simmers.
 

{down = iCommandPlaneAHCPGUNPACArm, up = iCommandPlaneAHCPGUNSafe, name = _('GUN/PAC switch 3-Pos ARM/SAFE'), category = _('Armament HUD Control Panel')},
{down = iCommandPlaneAHCPGUNArm, up = iCommandPlaneAHCPGUNSafe,    name = _('GUN/PAC switch 3-Pos GUNARM/SAFE'), category = _('Armament HUD Control Panel')},
{down = iCommandPlaneAHCPLaserArm, up = iCommandPlaneAHCPLaserSafe, name = _('LASER switch 2-Pos ARM/SAFE'), category = _('Armament HUD Control Panel')},
{down = 3004, up = 3004, cockpit_device_id = 7, value_down = 1.0, value_up = -1.0, name = _('TGP switch 2-Pos ON/OFF'), category = _('Armament HUD Control Panel')},
{down = 3004, cockpit_device_id = 7, value_down = 1.0, name = _('TGP Power switch ON'), category = _('Armament HUD Control Panel')},
{down = 3004, cockpit_device_id = 7, value_down = -1.0, name = _('TGP Power switch OFF'), category = _('Armament HUD Control Panel')},
{down = iCommandPlaneAHCPIFFCCOn, up = iCommandPlaneAHCPIFFCCTest, name = _('IFFCC switch 2-Pos ON/TEST'), category = _('Armament HUD Control Panel')},
{down = iCommandPlaneAHCPMasterArm, up = iCommandPlaneAHCPMasterSafe,name = _('Master switch 3-Pos ARM/SAFE'), category = _('Armament HUD Control Panel')},
{down = iCommandPlaneAHCPMasterTrain, up = iCommandPlaneAHCPMasterSafe, name = _('Master switch 3-Pos TRAIN/SAFE'), category = _('Armament HUD Control Panel')},
{down = 3006, up = 3006, cockpit_device_id = 7 , value_down = 1.0, value_up = 0.0, name = _('AHCP HUD Mode 2-Pos DAY/NIGHT'), category = _('Armament HUD Control Panel')},

{down = 3007, up = 3007, cockpit_device_id = 49 , value_down = 1.0, value_up = 0.0, name = _('Emergency Flood Light 2-Pos DAY/NIGHT'), category = _('Electrical power control panel')},
{down = 3007, cockpit_device_id = 49 , value_down = 1.0, name = _('Emergency Flood Light DAY'), category = _('Electrical power control panel')},
{down = 3007, cockpit_device_id = 49 , value_down = 0.0, name = _('Emergency Flood Light NIGHT'), category = _('Electrical power control panel')},
{down = 3001, up = 3001, cockpit_device_id = 1 , value_down = 1.0, value_up = 0.0, name = _('APU Gen Power 2-Pos ON/OFF'), category = _('Electrical power control panel')},
{down = 3004, up = 3004, cockpit_device_id = 1 , value_down = 1.0, value_up = 0.0, name = _('AC Gen Left Power 2-Pos ON/OFF'), category = _('Electrical power control panel')},
{down = 3005, up = 3005, cockpit_device_id = 1 , value_down = 1.0, value_up = 0.0, name = _('AC Gen Right Power 2-Pos ON/OFF'), category = _('Electrical power control panel')},
{down = 3004, cockpit_device_id = 1 , value_down = 1.0, name = _('AC Gen Left Power ON'), category = _('Electrical power control panel')},
{down = 3004, cockpit_device_id = 1 , value_down = 0.0, name = _('AC Gen Left Power OFF'), category = _('Electrical power control panel')},
{down = 3005, cockpit_device_id = 1 , value_down = 1.0, name = _('AC Gen Right Power ON'), category = _('Electrical power control panel')},
{down = 3005, cockpit_device_id = 1 , value_down = 0.0, name = _('AC Gen Right Power OFF'), category = _('Electrical power control panel')},
{down = 3006, up = 3006, cockpit_device_id = 1 , value_down = 1.0, value_up = 0.0, name = _('Battery Power 2-Pos ON/OFF'), category = _('Electrical power control panel')},

{down = iCommandPlaneLGPLandLight, up = iCommandPlaneLGPLightsOff, name = _('Landing Lights ON/OFF'), category = _('Landing gear panel')},
{down = iCommandPlaneLGPTaxiLight, up = iCommandPlaneLGPLightsOff, name = _('Taxi Lights ON/OFF'), category = _('Landing gear panel')},
{down = 3029, pressed = 3029, cockpit_device_id = 38, value_down = 1.0, value_pressed = 0.0, name = _('Anti-Skid Button ON'), category = _('Landing gear panel')},
{down = 3028, pressed = 3028, cockpit_device_id = 38, value_down = 1.0, value_pressed = 0.0, name = _('Anti-Skid Button OFF'), category = _('Landing gear panel')},
{down = 3029, pressed = 3029,up = 3028, up = 3028, cockpit_device_id = 38, value_down = 1.0, value_pressed = 0.0, value_up = 1.0, value_up = 0.0, name = _('Anti-Skid 2-Pos ON/OFF'), category = _('Landing gear panel')}, -- heureka, this works!

{down = 3012, up = 3012, cockpit_device_id = 49, value_down = 1.0,    value_up = -1.0, name = _('Nose Light 2-Pos switch ON/OFF'), category = _('Lighting Panel')},
{down = 3004, up = 3004, cockpit_device_id = 49, value_down = 1.0,    value_up = -1.0, name = _('Accel & Compass Light 2-Pos Bright/DIM'), category = _('Lighting Panel')},
{down = 3013, up = 3013, cockpit_device_id = 49, value_down = 1.0,    value_up = -1.0, name = _('Signal Lights 2-Pos BRIGHT/DIM'), category = _('Lighting Panel')},
{down = iCommandPlanePositionLightsFlash, up = = iCommandPlanePositionLightsOff, name = _('Position Lights FLASH/OFF'), category = _('Lighting Panel')},
{down = iCommandPlanePositionLightsSteady, up = = iCommandPlanePositionLightsOff, name = _('Position Lights STEADY/OFF'), category = _('Lighting Panel')},

{down = 3001, up = 3001, cockpit_device_id = 75, value_down = 1.0,    value_up = 0.0, name = _('HMCS Power 2-Pos ON/OFF'), category = _('HMCS Power')},
{down = 3001, up = 3001, cockpit_device_id = 75, value_down = -1.0,    value_up = 0.0, name = _('HMCS Power 2-Pos BAT/OFF'), category = _('HMCS Power')},
{down = 3001, cockpit_device_id = 75, value_down = 1.0,    name = _('HMCS Power ON'), category = _('HMCS Power')},
{down = 3001, cockpit_device_id = 75, value_down = 0.0,    name = _('HMCS Power OFF'), category = _('HMCS Power')},
{down = 3001, cockpit_device_id = 75, value_down = -1.0,    name = _('HMCS Power BAT'), category = _('HMCS Power')},

{down = 3002, cockpit_device_id = 15, value_down = 1.0,    name = _('Elapsed Timer STRT/STP/RST'), category = _('Systems')},

 

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to post
Share on other sites
12 hours ago, LeCuvier said:

For a maintained 3-position switch ON/OFF/ON you only need 2 bindings:


{down = iCommandPlanePositionLightsFlash, up = = iCommandPlanePositionLightsOff, name = _('Position Lights FLASH/OFF'), category = _('Lighting Panel')},
{down = iCommandPlanePositionLightsSteady, up = = iCommandPlanePositionLightsOff, name = _('Position Lights STEADY/OFF'), category = _('Lighting Panel')},

It works on the basis that if neither FLASH nor STEADY is TRUE then OFF is TRUE.

I tried this and initially my settings/controls page was doing some weird things and then I figured out why... there are two = signs in the command lines and for some reason it was creating havoc in the setting pages. lol But I took one of them out in each line and it works perfectly with the ON/OFF/ON switch!! Thanks again LeCuvier! You're a life saver!!

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to post
Share on other sites
39 minutes ago, Kenpilot said:

I tried this and initially my settings/controls page was doing some weird things and then I figured out why... there are two = signs in the command lines and for some reason it was creating havoc in the setting pages. lol But I took one of them out in each line and it works perfectly with the ON/OFF/ON switch!! Thanks again LeCuvier! You're a life saver!!

I'm sorry about this, yes I put this together quickly and I didn't test as I usually do. But you figured it out. Great!

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to post
Share on other sites
On 12/16/2020 at 7:52 AM, Kenpilot said:

 

Yes, DCS recognizes the Groovy Game Gear Card. My ON-ON switch has 3 terminals.  I have a wire connected to the top (#1) termina of the switch and that wire goes to a block connector screw terminal, I then have a wire connected to the middle terminal (#2) of the switch that I connect to the GND terminal of the Groovy Game GP-WIZ40 card. Then I have a wire connected to the bottom terminal (#3) of the switch that is then connected to the same block connector, but under a different screw terminal. I have a jumper that connects all of the screw terminals on the block connector. I then have a wire that is connected under another screw terminal on the block connector that is then connected to the A input of the Groovy Game GP-WIZ40 card. Does that make sense? If not, I'll go take a picture. 

So looking at your card your ground to line in on switch. Should be center tab on switch(check your documentation for switch) top tab to it's own terminal on card and bottom tab to it's own terminal on card. Should show as button press up and different button press when down

Link to post
Share on other sites

Look out for "elce" commands. Some controls have them  like the f14 refuel probe . My 3 position switch is on off on so signal in up and down but none when in the middle so command inside of DCS is fuel all else  fuel fuselage,  and  fuel probe in elce fuel fuse.


Edited by Chickenbone72
Link to post
Share on other sites
16 hours ago, Chickenbone72 said:

So looking at your card your ground to line in on switch. Should be center tab on switch(check your documentation for switch) top tab to it's own terminal on card and bottom tab to it's own terminal on card. Should show as button press up and different button press when down

I think the problem with the ON-ON-ON switches that I have, aren't exactly true ON-ON-ON switches that is needed for this game. I think the middle ON position actually combines both the top and bottom ON positions. These switches are most commonly used for guitar pickup selector switches where it "blends" or "mixes" both neck and bridge pickup, so they're both technically ON at the same time. That doesn't work in this game  cause then it's trying to tell the game to activate two different functions at the same time. I could be wrong, but from what I've read, researched and checked with an ohm meter, the middle ON position is not a totally separate ON function so to speak.  The ON-OFF-ON switch along with LeCuvier's .lua command line works perfectly. Thanks for helping though chickenbone72!

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to post
Share on other sites

Two more questions:

 

1) How do we get the ALT SCE switch on the Armament HUD control panel of the A10-C to work using a maintained toggle switch? What kind of switch do we use and or what kind of command lines do we use in the .lua? The switch in the game has 3 separate function selections. BARO-DELTA-RADAR. I looked in your default.lua that you posted LeCuvier, but I didn't see anything for this switch, so I'm guessing we keep the .lua the same and use some sort of maintained switch that allows us to select each function? 

 

2) How do we get the HUD MODE DAY/NIGHT switch to work as well? Right now I have an ON-ON switch to choose between the functions, and just wired the DAY "ON" function to one GP-WIZ40 card and assigned it a button, and then wired the NIGHT "ON" function to a different GP-WIZ40 card and assigned it a button. This works, as you can assign a function in the game to two different controller buttons, but you can't assign a function to two different buttons on the same controller if I'm not mistaken? Or can you? Is there an easier way than how I am using this set up with the ON-ON switch and two different cards or is this the only way for this type of switch where there are two different functions for a switch but only one assignment? Thanks!!

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to post
Share on other sites

for 1) Use the same approach as for the position lights:

{down = iCommandPlaneAHCPAltSCEBaro, up = iCommandPlaneAHCPAltSCEDelta, name = _('ALT SCE switch BARO/DELTA'), category = _('Armament HUD Control Panel')},
{down = iCommandPlaneAHCPAltSCERadar, up = iCommandPlaneAHCPAltSCEDelta, name = _('ALT SCE switch RADAR/DELTA'), category = _('Armament HUD Control Panel')},

That one is easy because the stock file has three distinct comands which you can combine into two bindings.

for 2) That one requires looking into the "clickabledata.lua" to find the command number so we can "hijack" the command in the clickable cockpit. The resulting command line is actually included in my Thursday post:

{down = 3006, up = 3006, cockpit_device_id = 7 , value_down = 1.0, value_up = 0.0, name = _('AHCP HUD Mode 2-Pos DAY/NIGHT'), category = _('Armament HUD Control Panel')},

 

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to post
Share on other sites
1 hour ago, LeCuvier said:

for 1) Use the same approach as for the position lights:


{down = iCommandPlaneAHCPAltSCEBaro, up = iCommandPlaneAHCPAltSCEDelta, name = _('ALT SCE switch BARO/DELTA'), category = _('Armament HUD Control Panel')},
{down = iCommandPlaneAHCPAltSCERadar, up = iCommandPlaneAHCPAltSCEDelta, name = _('ALT SCE switch RADAR/DELTA'), category = _('Armament HUD Control Panel')},

That one is easy because the stock file has three distinct comands which you can combine into two bindings.

for 2) That one requires looking into the "clickabledata.lua" to find the command number so we can "hijack" the command in the clickable cockpit. The resulting command line is actually included in my Thursday post:


{down = 3006, up = 3006, cockpit_device_id = 7 , value_down = 1.0, value_up = 0.0, name = _('AHCP HUD Mode 2-Pos DAY/NIGHT'), category = _('Armament HUD Control Panel')},

 

Thanks again LeCuvier!! I figured you might have included the 3 position/function switch .lua but I guess I just didn't know exactly what I was looking for. Got it now. Thank you!!

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to post
Share on other sites

Lecuvier,

You've helped me in the past.. and I'm hoping you can help me now 🙂

On the BF-109 K4, I'm trying to build two new mappings for the guns/cannon.

The specific key commands in the controls setup are named, "SZKK 3 weapon control" and, "Wing Cannons".

Currently they offer an on, off, or toggle. 

What I'm trying to build is a on/else off function for both.

I can't find what naming convention they are using in the lua code to define these - and that's what's throwing me off.

Any advice?

thanks!!

Link to post
Share on other sites

These 2 lines of code provide the function for maintained ON/OFF switch input:

{down = device_commands.Button_32, up = device_commands.Button_32, cockpit_device_id = devices.FUSEBOX, value_down = 1.0, value_up = 0.0, name = _('SZKK3 Weapons Control 2-Pos ON/OFF'), category = _('Front Dash')},
{down = device_commands.Button_34, up = device_commands.Button_34, cockpit_device_id = devices.FUSEBOX, value_down = 1.0, value_up = 0.0, name = _('Wing Cannons Switch 2-Pos ON/OFF'), category = _('Front Dash')},

However, the wing cannon switch will not do anything useful as long as we don't have the option for the wing cannons.

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to post
Share on other sites
8 minutes ago, LeCuvier said:

These 2 lines of code provide the function for maintained ON/OFF switch input:


{down = device_commands.Button_32, up = device_commands.Button_32, cockpit_device_id = devices.FUSEBOX, value_down = 1.0, value_up = 0.0, name = _('SZKK3 Weapons Control 2-Pos ON/OFF'), category = _('Front Dash')},
{down = device_commands.Button_34, up = device_commands.Button_34, cockpit_device_id = devices.FUSEBOX, value_down = 1.0, value_up = 0.0, name = _('Wing Cannons Switch 2-Pos ON/OFF'), category = _('Front Dash')},

However, the wing cannon switch will not do anything useful as long as we don't have the option for the wing cannons.

I just figured that out about the wing cannon - LOL..

thank you so much sir for your time!!

 

cheers!

Link to post
Share on other sites
  • 2 weeks later...

Hi All,

 

Hoping you guys might be able to help me out as I'm really scratching my head here!

 

I had a read through this rather long thread, a fair bit of which seems to be somewhat obsolete! I've mapped a couple of my switches for the launch bar in the F18 and swapped the values round so my physical switch position would not be the opposite of the in game switch position. I did this in both the joystick and keyboard default.lua files, code as follows:

{	down = gear_commands.LaunchBarSw,	up = gear_commands.LaunchBarSw,	cockpit_device_id = devices.GEAR_INTERFACE,   value_down =  0.0,  value_up = 1.0, name = _('Launch Bar Control Switch - EXTEND/RETRACT'),	

When I first tried this, it worked. Now for some reason, the switch will only cycle when the physical switch is set to 'off', so it seems to now be acting like a push button. Any idea why this would be? Very odd that it worked at first but now doesn't. I've checked both default files and nothing has changed. Also, some of the other switches I changed are still working perfectly,

only launch bar and hook bypass seem to have a problem.

 

Thanks in advance for any insights!

 

  

 

Link to post
Share on other sites

For the launch bar maintained 2-position switch, this line works:

{down = gear_commands.LaunchBarSw, up = gear_commands.LaunchBarSw, cockpit_device_id = devices.GEAR_INTERFACE, value_down =  -1.0, value_up = 1.0,    name = _('Launch Bar Control 2-Pos Switch RETRACT/EXTEND'), category = {_('Left Vertical Panel')}},

 

  • Like 2

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to post
Share on other sites

Thanks LeCuvier, that fixed it! One more question if you don't mind. Some switches seem to need cycling a couple of times before they register in the game. Is that normal?

Anti-skid seems to do that, but it's set up differently to the launch bar switch:

 

{down = gear_commands.AntiSkidSw_EXT, cockpit_device_id = devices.GEAR_INTERFACE, value_down =  0.0, name = _('Anti Skid Switch - ON/OFF'),	category = {_('Left Vertical Panel')}},
{down = gear_commands.AntiSkidSw, cockpit_device_id = devices.GEAR_INTERFACE, value_down =  1.0, name = _('Anti Skid Switch - ON'),	category = {_('Left Vertical Panel')}},
{down = gear_commands.AntiSkidSw, cockpit_device_id = devices.GEAR_INTERFACE, value_down =  0.0, name = _('Anti Skid Switch - OFF'), category = {_('Left Vertical Panel')}},

 

Link to post
Share on other sites

The 3 lines you show represent 3 anti-skid commands. The 1st one is for one pushbutton and toggles between ON and OFF each time you push it.

The 2nd and 3rd lines are ON resp. OFF commands and require 2 pushbuttons.

If you want a command for use with a maintained ON/OFF switch, use this command: "Anti Skid Switch (special) - ON/OFF" in the category "Special for jostick"!

  • Like 1

LeCuvier

Windows 10 Pro 64Bit | i7-4790 CPU |16 GB RAM|SSD System Disk|SSD Gaming Disk| MSI GTX-1080 Gaming 8 GB| Acer XB270HU | TM Warthog HOTAS | VKB Gladiator Pro | MongoosT-50 | MFG Crosswind Pedals | TrackIR 5

Link to post
Share on other sites
  • 2 weeks later...

@LeCuvier

I'm getting closer to learning this stuff I promise... Unfortunately, I'm stumped again. I'm trying to tweak some bindings for the Ka-50 and I've tried copying some of your other code, but I'm stuck on this one:

 

{down = 3001, up = 3001, value_down = 1.0, value_up = 0, cockpit_device_id = 22, name = _('Jettison arm 2-Pos ON/OFF'), category = _('Ins Weapons Status and Control Panel PUI-800')},

 

I can map the switch in game, but it doesn't actually do anything.. I'm sure I'm missing something, but I've been looking at the clickable data and the command_defs and I can't figure it out.

I can't figure out the down 3001 part or if the cockpit device ID is correct?

 

Can you help me again 🙂

 

thanks!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...