Jump to content

How to set up toggle switches (a tutorial)


Recommended Posts

Here is a video showing the behaviour I am describing, I will try and attach the .lua file as well

 

 

.lua file now attached

 

Cheers

 

Les

Why are you messing with the file for the TM WH Throttle? Whatever is in that file will only work with the TM WH throttle.

 

I told you it's the "default.lua" because you want to use a button box.

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

Don't forget to back up the modified "deault.lua" file!

 

Remember that any update or Repair will restore the original file. If you only have the A-10C, then a simple backup copy of the modified file is probably ok. If you have multiple modified files it's preferrable to use a mod manager like JvGME or the newer OvGME.

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

  • 2 weeks later...
Is it possible to assign the (cheat) quickstart keypresses (using LWin+Home) to an on/off toggle switch? I cant find ref to in in the controls/keyboard lua?

Yes, certainly! There might be the odd module where ED forgot to add the command to the "default.lua" under "...\Mods\aircraft\Bf-109K-4\Input\Bf-109K-4\joystick" (using the Bf-109K-4 as an example).

For which aircraft did you try?

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

Hi LeCuvier,

 

 

I have one more request please..... (1 request.... 2 buttons :) )

 

 

On the FA18, the launch bar is a toggle switch... Can you define 2 entries; 1 for extend & 1 for retract?

 

 

On the AV8B, I have been trying to get the Master arm to act as 2 entries; Arm & Safe (I can sort of get it working but it wont reset to whatever the switch is set to at the start of a mission)

 

 

Thanks again...

 

 

Phil

Link to comment
Share on other sites

Hi LeCuvier,

 

 

I have one more request please..... (1 request.... 2 buttons :) )

 

 

On the FA18, the launch bar is a toggle switch... Can you define 2 entries; 1 for extend & 1 for retract?

 

 

On the AV8B, I have been trying to get the Master arm to act as 2 entries; Arm & Safe (I can sort of get it working but it wont reset to whatever the switch is set to at the start of a mission)

 

 

Thanks again...

 

 

Phil

F/A-18C launch bar, for use with 2 pushbuttons:

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

F/A-18C launch bar, for use with a maintained 2-position ON/OFF switch:

{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')}},

Regarding the AV88NA, I'm not sure I understand what your issue is. Please expand, and include the line of code you have created! I'm struggling with this: "---it wont reset to whatever the switch is set to at the start of a mission"


Edited by LeCuvier

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

Is it possible to assign the (cheat) quickstart keypresses (using LWin+Home) to an on/off toggle switch? I cant find ref to in in the controls/keyboard lua?

I now suspect that your term "toggle switch" refers to a maintained ON/OFF switch. Unfortunately "toggle switch" means different things to different people, and I thought you were referring to a switch with spring return to OFF.

If you want to use a maintained ON/OFF switch, do you want to trigger auto-start when switched to ON, and auto-stop when switched to OFF?

That can be achieved with a simple .lua edit. I can show how to do this, but first I want to be sure I know what you want to do.

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

F/A-18C launch bar, for use with 2 pushbuttons:

 

...

 

F/A-18C launch bar, for use with a maintained 2-position ON/OFF switch:

..

 

 

 

Thank you - perfect.. :thumbup:

 

 

F/A-18C launch bar, for use with 2 pushbuttons:

 

Regarding the AV88NA, I'm not sure I understand what your issue is. Please expand, and include the line of code you have created! I'm struggling with this: "---it wont reset to whatever the switch is set to at the start of a mission"

 

Maybe I'm missing something but the master arm switch for the AV8B is just a toggle... I would like to assign it to my master arm on/off switch.. with 2 distinct positions - "Master Arm - Safe" & "Master Arm - Arm"

 

I hope that makes sense?

 

Thanks again,

Phil

Link to comment
Share on other sites

.. I would like to assign it to my master arm on/off switch.. with 2 distinct positions - "Master Arm - Safe" & "Master Arm - Arm"

 

I hope that makes sense?

 

Thanks again,

Phil

That's already available out of the box. Look for "MasterArm ON else OFF" in category "Switch Abstractions"!

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

That's already available out of the box. Look for "MasterArm ON else OFF" in category "Switch Abstractions"!

 

 

Thank you.... set up now.... :thumbup:

 

 

Originally, I didn't fully understand that the config item meant 2 button positions...

 

 

 

Phil

Link to comment
Share on other sites

I now suspect that your term "toggle switch" refers to a maintained ON/OFF switch. Unfortunately "toggle switch" means different things to different people, and I thought you were referring to a switch with spring return to OFF.

If you want to use a maintained ON/OFF switch, do you want to trigger auto-start when switched to ON, and auto-stop when switched to OFF?

That can be achieved with a simple .lua edit. I can show how to do this, but first I want to be sure I know what you want to do.

You sir are a star - thats exactly what I want to achieve, a standard 2-pole on/off switch (not a momentary switch) for the quick start.

Link to comment
Share on other sites

...thats exactly what I want to achieve, a standard 2-pole on/off switch (not a momentary switch) for the quick start.

I'll show you how to do it for the Hornet. Based on this example, you should be able to do the others (only those of course that do have the auto-start).

The original "default.lua" has these 2 lines for separate auto start and auto stop commands via pushbuttons:

{    down = iCommandEnginesStart,                                                    name = _('Auto Start'),        category = _('Cheat')},
{    down = iCommandEnginesStop,                                                        name = _('Auto Stop'),        category = _('Cheat')},

We combine these into a single line:

{down = iCommandEnginesStart, up = iCommandEnginesStop,    name = _('Auto START/STOP'), category = _('Cheat')},

There is a catch though: if the switch is in the ON position at mission start it will execute the auto start, even if your mission starts with the engine running. It's therefore a good idea to have the switch in the OFF position before you start any mission.

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

You sir are a star - thats exactly what I want to achieve, a standard 2-pole on/off switch (not a momentary switch) for the quick start.

 

FYI, "2-pole" usually means 2 sets of contacts, not a switch with 2 positions - that's usually called "double throw".

 

So:

SPST = Single pole, single throw = a 2-wire on-off switch.

 

SPDT = Single pole, double throw = a 3-wire on-on switch.

These have 3 contacts, where a common line is connected to one or the other of the two other contacts.

 

SP3T = Single pole, 3 throw = a 3-wire on-off-on switch.

These have 3 contacts, where a common line is connected to one or the other of the two other contacts if the lever is moved to the sides, or disconnected if moved to the centre position.

These are sometimes called "SPDT centre-off".

 

Then you get

DPDT = Double pole, double throw = See SPDT, but there are two circuits.

 

DP3T = Double pole, double throw = See SP3T, but there are two circuits.

These are sometimes used as simple direction controls.

 

3PDT = three pole, double throw = See SPDT, but there are three circuits.

These are less common, but they do exist - I have some

 

 

Toggle and rocker switch descriptions usually list momentary (spring-loaded) contacts in brackets.

e.g. ON-(ON) Would mean it's double throw, sprung toward the left, so pushing to the right is momentary.

Another common one is (ON)-OFF-(ON). This would be sprung to return to the centre.

An example of this would be the A-10 canopy open/close switch.

 

 

SPST pushbutton switches are usually "normally open" - i.e. pressing the button completes the circuit. This is the default, so it usually isn't specified. it IS specified, though, if the switch is "normally closed", and they are available.

 

Double throw pushbuttons and microswitches have contacts marked "C", "NC" and "NO", meaning "Common", "Normally Closed" and "Normally Open" respectively.

In those cases, when the button is not pressed, "C" is connected to "NC". Then when pressed, "C" connects to "NO".

 

 

Sorry. That kind of snow-balled. ;)

Link to comment
Share on other sites

I'll show you how to do it for the Hornet. Based on this example, you should be able to do the others (only those of course that do have the auto-start).

The original "default.lua" has these 2 lines for separate auto start and auto stop commands via pushbuttons:

My default.lua for the Hornet does not have any mention of iCommandEnginesStart (or stop) - can I confirm location of the original default lua file to edit?
Link to comment
Share on other sites

My default.lua for the Hornet does not have any mention of iCommandEnginesStart (or stop) - can I confirm location of the original default lua file to edit?

It's in the game folder tree (not in "saved Games"!). On my system its here: "K:\Eagle Dynamics\DCS World OpenBeta\Mods\aircraft\FA-18C\Input\FA-18C\joystick".

The lines are very close to the beginning of the file:

local cockpit = folder.."../../../Cockpit/Scripts/"
dofile(cockpit.."devices.lua")
dofile(cockpit.."command_defs.lua")

local res = external_profile("Config/Input/Aircrafts/common_joystick_binding.lua")

join(res.keyCommands,{

---------------------------------------------
-- Cheat ------------------------------------
---------------------------------------------
{    down = iCommandEnginesStart,                                                    name = _('Auto Start'),        category = _('Cheat')},
{    down = iCommandEnginesStop,                                                        name = _('Auto Stop'),        category = _('Cheat')},

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 use the flaps up/down switch in the f14 as the VSL high/low and am trying to make them not toggle but turn off when moving the switch from down to center/up to center

 

im using the excellent ToggleSwitchesMod

skunk160 | Win10 PRO 64bit | i7-4770K 3.50 GHz | 32GB DDR3/1866MHz | GIGABYTE GeForce GTX 1080 x2 | Oculus Rift S | Virpil MongoosT-50CM2 | Virpil F-14B grip | Virpil 200m Curved Extension | PointCTRL | Delta Sim TM Slew | Sim Bandit AHCP | MFG Crosswind Pedals | //FOX2 Switch Boxes | RECARO SPG Seat | AuraSound AST-2B-4 Pro Bass Transducer x2

//FOXTWO Multi-Role Combat Pit Build http://forums.eagle.ru/showthread.php?t=134745

Link to comment
Share on other sites

I cannot help as I don't have the F-14, and decided not to buy it.

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

Add these 2 lines to your "default.lua" (or "Throttle - HOTAS Warthog.lua"):
{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')},

This is one of the weirdest mod I've ever done.

 

 

 

 

Something has changed in one of the updates for me.... this mod doesn't seem to be working anymore for the F/A 18....

 

 

Could you please take a look for me?

 

 

Thanks,

Phil

Link to comment
Share on other sites

dcs update / repair resets all default luas to...err...default. ive had to redo all my master switches.

Question is, can these files be put into saved games/dcsopenbeta and still work ok, to avoid being overwritten again in the future?

Link to comment
Share on other sites

dcs update / repair resets all default luas to...err...default. ive had to redo all my master switches.

Question is, can these files be put into saved games/dcsopenbeta and still work ok, to avoid being overwritten again in the future?

 

 

 

 

Yeah, I understand about resets/upgrades.... I always have a copy saved in order to copy the mods back in...

 

 

Problem is, the wizzy code given by LeCuvier doesn't work anymore...

 

 

Phil

Link to comment
Share on other sites

dcs update / repair resets all default luas to...err...default. ive had to redo all my master switches.

Question is, can these files be put into saved games/dcsopenbeta and still work ok, to avoid being overwritten again in the future?

you need to back the modified files up and restore them aftwer the update. The best solution for that is to use OvGME or the older JvGME.

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...