Jump to content

How to set up toggle switches (a tutorial)


Recommended Posts

Hi,

...Something like showing a small text message?...

Thanks

No

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 comment
Share on other sites

I have listed the handle block of the handle, where the desired command is located, you need to configure the safety bracket to raise, lower (enable, disable).

This is the best I could do. The command is not really meant to be used like that. Play with it and see if it's useful for you. I have tried all possible variants and none really satisfied me.

{down = device_commands.Button_74, up = device_commands.Button_74, cockpit_device_id = devices.FUSEBOX, value_down = -1.0, value_up = 1.0, name = _('Safety Latch 2-Pos SAFE/ARM'), category = _('Stick')},

Good luck!

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 comment
Share on other sites

  • 3 weeks later...
I made an interesting discovery while messing about with input default.lua files the other day...

 

You can actually include the 'pressed' state with a line of code to combine all 3 input states into one binding.

 

Works very well with momentary toggles and buttons, or standard toggles that are programmed to send a 'pulse'. And especially useful for in-game switches with covers, you can combine the entire cover and switch actions into one binding.

 

Thank you for this great idea!

 

The following lines for the F-18 will toggle the switch and its cover and both will always stay in sync:

 

{down = ctrl_commands.GainSwCover,          pressed = ctrl_commands.GainSw,          up = ctrl_commands.GainSwCover,          cockpit_device_id = devices.CONTROL_INTERFACE, value_down =  1.0, value_pressed = 1.0, value_up = 0.0, name = _(' GAIN Switch+Cvr - NORM/CLOSE'),                             category = {_('Special For Joystick'), _('Left Console')}},
{down = ctrl_commands.SpinRecCover,         pressed = ctrl_commands.SpinRec,         up = ctrl_commands.SpinRecCover,         cockpit_device_id = devices.CONTROL_INTERFACE, value_down =  1.0, value_pressed = 1.0, value_up = 0.0, name = _(' Spin Recovery Switch+Cvr - NORM/OFF'),                      category = {_('Special For Joystick'), _('Right Console')}},
{down = engines_commands.LENG_FireSwCover,  pressed = engines_commands.LENG_FireSw,  up = engines_commands.LENG_FireSwCover,  cockpit_device_id = devices.ENGINES_INTERFACE, value_down =  1.0, value_pressed = 1.0, value_up = 0.0, name = _(' Left Engine Fire Warning Light Switch+Cvr - RELEASE/OFF'),  category = {_('Special For Joystick'), _('Left Console')}},
{down = engines_commands.RENG_FireSwCover,  pressed = engines_commands.RENG_FireSw,  up = engines_commands.RENG_FireSwCover,  cockpit_device_id = devices.ENGINES_INTERFACE, value_down =  1.0, value_pressed = 1.0, value_up = 0.0, name = _(' Right Engine Fire Warning Light Switch+Cvr - RELEASE/OFF'), category = {_('Special For Joystick'), _('Right Console')}},
{down = elec_commands.GenTieControlSwCover, pressed = elec_commands.GenTieControlSw, up = elec_commands.GenTieControlSwCover, cockpit_device_id = devices.ELEC_INTERFACE,    value_down =  1.0, value_pressed = 1.0, value_up = 0.0, name = _(' Generator TIE Control Switch+Cvr - NORM/RESET'),            category = {_('Special For Joystick'), _('Left Console')}},

 

I think these lines might be handy for some pit-builders. ;)

  • Like 1
Link to comment
Share on other sites

  • 5 weeks later...

Help needed please.

 

What am I missing? Warthog throttle. I want AA mode on/off with BTN16

 

My text looks nothing like OP's post. (below) If I can get over this one hurdle it will be clear to me.

 

["key"] = "JOY_BTN16",

},

},

["name"] = "Master Mode Button - A/A",

},

["d3001pnilu3001cd25vd1vpnilvu0"] = {

["added"] = {

[1] = {

 

.......................................................................................................................................

 

Op's text ....{combos = {{key = "JOY_BTN20"}, }, down = 3002, cockpit_device_id = 13, value_down = 0.3, name = "Ignition switch BOTH", category = "Front Switch Box"},

Link to comment
Share on other sites

...What am I missing?...

I think you are messing with the "...diff.lua"file that stores additions/deletions/changes to your control bindings.

Leave that file alone! If you want to add/modify commands, you need to edit the "default.lua" under "...Eagle Dynamics\DCS World OpenBeta\Mods\aircraft\FA-18C\Input\FA-18C\joystick".

However, the command for A/A mode does not work well with a maintained ON/OFF switch. It's designed to work with a pushbutton that returns to OFF when you release it. Every ON/OFF cycle toggles the A/A mode between ON and OFF.

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 comment
Share on other sites

...What am I missing?...

However, the command for A/A mode does not work well with a maintained ON/OFF switch. It's designed to work with a pushbutton that returns to OFF when you release it. Every ON/OFF cycle toggles the A/A mode between ON and OFF.

 

 

 

Thanks. For pointing me in the right direction

And yes not a good button choice for AA mode

Link to comment
Share on other sites

  • 2 weeks later...

I have made a simple button box with some on/off switches. I want one of the switches to toggle the Master Arm switch in the F18.

Got it to work with the following code, but sometimes the switch is reversed and I have to pause the game and put the switch in the right position.

I know there is a way to avoid this, but i can't get it to work..

 

{	down = SMS_commands.MasterArmSw_EXT, up = SMS_commands.MasterArmSw_EXT,		cockpit_device_id = devices.SMS,	value_down =  1.0, value_up = 0.0,		name = _('Master Arm Switch - ARM/SAFE'),	category = {_('Instrument Panel'), _('Master Arm Panel')}},

 

I have read the PDF and most of the posts in this topic, still having some trouble. Any help would be appreciated.

Link to comment
Share on other sites

@Think404: The command suffixed "_EXT" toggles (cycles) ON/OFF. Here is the line of code I use:

{down = SMS_commands.MasterArmSw, up = SMS_commands.MasterArmSw, cockpit_device_id = devices.SMS, value_down =  1.0, value_up = 0.0, name = _('Master Arm Switch 2-Pos ARM/SAFE'), category = {_('Instrument Panel'), _('Master Arm Panel')}},

This works with a maintained ON/OFF switch as expected.

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 comment
Share on other sites

Before I jump in with both feet I’m wondering if anyone has put together a utility to stream line this process? Would help with not needing to learn all this code. A steep learning curve for sure.

 

Thanks Menessis

It's not difficult. Download the document in this post https://forums.eagle.ru/showpost.php?p=2862001&postcount=214

and invest a little time!

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 comment
Share on other sites

Quick question. Is it possible to edit the lua file while the DCS is running? Alt Tab in and out to see if things are going the way you want/think.

Would save a lot of time loading the sim.

 

 

Thanks

Menessis

That would help a lot but it doesn't work. I believe that the software reads all .lua files when it starts and ignores changes you make afterwards.

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 comment
Share on other sites

Hmmmm Noob question #1

 

Well right off the jump it's playing games with me. For some reason after creating a new entry in the default.lua it will only let me map it to the rudder pedals and not the throttle?

I checked to make sure I wasn't in the pedals file.

 

 

Any thoughts?

 

 

Thanks

Menessis

Link to comment
Share on other sites

Some modules have dedicated .lua files for specific game controllers. For example, the FW-190D has a file "Throttle - HOTAS Warthog.lua". In that case, the "default.lua" will apply to all game controllers except the TM WH throttle. And any command that you want to bind to a switch on the TM WH throttle must be added to the file "Throttle - HOTAS Warthog.lua". I think that's stated in the tutorial document. If that does not solve the problem, which aircraft gives you the problem?

PS: Ignore the .diff.lu files in that context!

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 comment
Share on other sites

Well that sounds like it could be the problem. I’m in the Huey at the moment.

 

This thread must be like a full time job for you LeCuvier. Thanks

 

 

Edit:

Got home and had a look at this again.

 

 

Menessis


Edited by Menessis
Link to comment
Share on other sites

OK I just had a second look at this. I tried to edit the Throttle-HOTAS Wartgog.lua but the new entry did not show up in game. I then did a test and just added "test" to the description and that did not show up in game either.

 

 

I had used the line from CrashO thread #326 but I don't see any mention as to what file they are editing there.

 

 

Thanks

Menessis


Edited by Menessis
Link to comment
Share on other sites

...I had used the line from CrashO thread #326 but I don't see any mention as to what file they are editing there.

Menessis

This is the line in CrashO's post 326:

{down = device_commands.Button_8, up = device_commands.Button_8,  cockpit_device_id = devices.WEAPON_SYS,  value_down = 1.0, value_up =  -1.0, name = _('Armament OFF/ARMED'), category =  _('Armament System')}                       

This line cannot work, because it's not terminated with a comma (","). If you look at the examples in my tutorial, you will see that every line ends with a comma.

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 comment
Share on other sites

OK so for a recap.

 

I had to go back and restore the original Default.lua. Then go into the Throttle - HOTAS Warthog.lua and then I started getting results.

 

 

And yes I did see the missing comma. So Im wondering if I needed to restore the other or it was just coincidence that I got it going at that point.

 

 

I also find that it's not synchronized with switch position in the pit even though I have that option turned on. More testing!

 

 

 

Menessis

Link to comment
Share on other sites

...

I also find that it's not synchronized with switch position in the pit even though I have that option turned on...

The synchronization at mission start works better when the switch is in the ON position. But even so, it's far from perfect and on some aircrafts it works better than on others. Sometimes, when you cycle one switch ON/OFF/ON, it will update also the other switches in the cockpit.

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 comment
Share on other sites

  • Recently Browsing   0 members

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