Jump to content

Toggle Switches & toggle guards


Afterburn

Recommended Posts

I did some searches on the forum and can't find an answer with regards to BS. I have a "pit" with a bunch of toggles and momentary switches designed for A10. I purchased BS a while ago but just now installed.

 

I want to assign a toggle (when flipped on) so it flips up the guard in game, turns on the switch, and flips the guard down, similar to the battery switches on start-up. Any way to do this using a single toggle?

 

Thanks!

Link to comment
Share on other sites

Many thanks for the replies!

 

For a bit more info, I have all my switches working in a-10, including 2 & 3-way toggles, rotaries, etc. That seemed easy enough (and I also used that specific video for inspiration...thanks tigersharkbas!)

 

When I got into the toggles for Black Shark, I discovered many have guards to open before the toggle will actuate. Without having a microswitch on each physical cover (seems a bit extreme), how would one flip a single toggle up and have the game interpret this as battery 1 cover open, battery 1 on, battery 1 cover closed? Maybe I'm over-complicating... I have no idea where to configure macros as I'm using a GP-Wiz40 that acts as a joystick, not a keyboard controller.

 

I assume many, many people have cockpits for BS and very few have the guard covers modeled with physical mappings, so this should be super easy...I'm just relatively inept at this stuff. Also, I've never fussed around with Helios...could that be my solution? I've always just dealt with the lua files myself.

Link to comment
Share on other sites

  • 4 months later...

Hi,

 

The main problem I had was the fact most commands in BS toggle the switch rather than set its state. I realised though that most switches can easily be set to toggle using info from the clickabledata.lua and devices.lua

 

You then edit the appropriate controls lua file (Saved Games...\config\input\KA-50...

 

Here is an example from mine:

 

{combos = {{key = "JOY_BTN22"}, }, down = 3004, up = 3004, cockpit_device_id = 12, value_down = 0.2, value_up = 0.1, name = "Burst length - long", category = "Ins Weapons Status and Control Panel PUI-800"},

{combos = {{key = "JOY_BTN23"}, }, down = 3004, up = 3004, cockpit_device_id = 12, value_down = 0, value_up = 0.1, name = "Burst length - short", category = "Ins Weapons Status and Control Panel PUI-800"},

 

You can create this by looking up the control you want in clickabledata.lua and then cross referencing the devices.lua and command_defs.lua files to get the values.

 

 

This is the appropriate clickabledata line:

 

elements["SR-PTR"] = {class = {class_type.TUMB,class_type.TUMB}, hint = LOCALIZE("Weapon mode switch - Burst Length"), device = devices.WEAP_INTERFACE, action = {device_commands.Button_4,device_commands.Button_4} , stop_action = {}, arg = {400,400}, arg_value = {-direction*0.1,direction*0.1}, arg_lim = {{0.0, 0.2},{0.0, 0.2}}, use_OBB = true, updatable = true}

 

 

and from devices.lua:

 

devices["WEAP_INTERFACE"] = 12

 

 

The final relevant cross referencing is the device)commands.Button_4 being equal to 3004. You don't need to cross ref it every time as it is simply 3000 plus the button number. The relevant info is in command_defs.lua towards the end...

 

start_command = 3000

device_commands =

{

Button_1 = start_command + 1;

Button_2 = start_command + 2;

Button_3 = start_command + 3;

Button_4 = start_command + 4;

..........

 

 

Try as I might though, I cannot find a way of setting the AP route mode, I can only toggle it on/off - it isn't in clickable data. This is really annoying me so if anyone knows how to, please enlighten me :-)

 

I haven't tried but I wonder whether you can map a single 'joybtn' to two outputs - the first the cover and the second the switch.

The HELIOS software is quite good and can solve the issue of flipping the cover when you move the switch. However, I could not get the states of the switches to sync at the start of the mission so I abandonned it.

 

PM


Edited by Puddlemonkey
Link to comment
Share on other sites

  • 1 year later...

Puddlemonkey, you are my HERO! :D

 

I realised though that most switches can easily be set to toggle using info from the clickabledata.lua and devices.lua

 

You then edit the appropriate controls lua file (Saved Games...\config\input\KA-50...

 

I have been searching for this information forever! This is the definitive way to fix toggle and multi-way switches in the Black Shark. I've implemented it and it works like a charm, even for rotaries like the SPU-9 radio selector! You are my hero and I would +rep you from here until eternity if I could; unfortunately I haven't posted enough... But at least you should know that I would probably name my firstborn after you, if he didn't already have a name.

 

Once again, thank you so much! :thumbup:

Link to comment
Share on other sites

Hey all. Thanks for this incredibly helpful thread!

Question about macros: I've created one, but even though I start at time = 0, there's roughly a quarter-second delay between hitting the control and having the macro execute. Any known reason for this?

Link to comment
Share on other sites

  • 1 year later...

Awesome information !

 

I'm still struggling with the 1.2.8 and the new diff.lua format, especially with the KA-50.

 

So far, my solution is to append the custom combos at the end of the "\DCS World\Mods\aircrafts\Ka-50\Input\ka-50\joystick\default.lua" file, and map them directly in the GUI.

 

This is fine, but given the amount of work required to make each and everyone of them, I thought I'd better make a simple script that would build them *all* for me, and share the result.

 

Attached to this post is a ~500 lines text files that has every possible clickable_data (except the useless 3 linked to "device_id 0").

 

I arranged them in a category named "CUSTOM", for convenience.

 

They are labeled "_TOGGLE" when there are but 2 possible values (1 / 0), _3WAY when there are 3 (0.0 / 0.1 / 0.2), and _NWAY when there are more than 3 (up to 34 !). The exact value is added right after the label, for example:

 

{ down = 3001, cockpit_device_id = 34, value_down = 1, value_down = 0, name = "CUSTOM_TOGGLE: GEAR-PTR", category = "CUSTOM"},

 

{ down = 3003, cockpit_device_id = 14, value_down = 0, value_down = 0.1, name = "CUSTOM_3WAY: MAIN-ROTOR-PTR_DOWN", category = "CUSTOM"},
{ down = 3003, cockpit_device_id = 14, value_down = 0.2, value_down = 0.1, name = "CUSTOM_3WAY: MAIN-ROTOR-PTR_UP", category = "CUSTOM"},

 

{ down = 3005, cockpit_device_id = 6, value_down = 0, name = "CUSTOM_NWAY: CONTR-SAPROTATE-PTR_value0", category = "CUSTOM"},
{ down = 3005, cockpit_device_id = 6, value_down = 0.1, name = "CUSTOM_NWAY: CONTR-SAPROTATE-PTR_value0.1", category = "CUSTOM"},
{ down = 3005, cockpit_device_id = 6, value_down = 0.2, name = "CUSTOM_NWAY: CONTR-SAPROTATE-PTR_value0.2", category = "CUSTOM"},
{ down = 3005, cockpit_device_id = 6, value_down = 0.3, name = "CUSTOM_NWAY: CONTR-SAPROTATE-PTR_value0.3", category = "CUSTOM"},
{ down = 3005, cockpit_device_id = 6, value_down = 0.4, name = "CUSTOM_NWAY: CONTR-SAPROTATE-PTR_value0.4", category = "CUSTOM"},
{ down = 3005, cockpit_device_id = 6, value_down = 0.5, name = "CUSTOM_NWAY: CONTR-SAPROTATE-PTR_value0.5", category = "CUSTOM"},
{ down = 3005, cockpit_device_id = 6, value_down = 0.6, name = "CUSTOM_NWAY: CONTR-SAPROTATE-PTR_value0.6", category = "CUSTOM"},

 

Disclaimer

 

I'm like Jon Snow, I know nothing. I had a need, made a dirty script and shared the output hoping it would save time to others as well. I obviously did *not* test all of the switches provided, they may or may not work, but at least the device_id and the device_command should be correct. Please fell free to help me make this better !

 

THIS IS ONLY FOR THE KA50 AT THE MOMENT

 

Installation

 

Simply append the commands you're interested in (or all of them) at the end of

"\DCS World\Mods\aircrafts\Ka-50\Input\ka-50\joystick\default.lua"

 

between:

keyCommands = {
... some very long text ..
[color="Red"]_ INSERT CONTENT HERE _[/color] (should be around line 672)
},

axisCommands = {

 

(this is *not* update-proof, mind you, but if ED decides to change the ids/commands, I have the script ready to generate them again :P).

 

Feel free to give them new names/category to your liking.

 

The new commands should pop up in the 'options/control' GUI. Map them to your DX buttons and you're good to go !

 

Cheers :beer:

 

Changelog

 

v4: commands are now sorted by category and categories have a name (*much* easier to find something in the GUI)

v3: fixed a very bad typo

v2: names of commands made more human-friendly

ouptut_v4.txt


Edited by etcher
Forgot to specify this if for the KA50 only ATM

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 4 months later...

Etcher,

 

I just loaded in your mods and they work great, but one thing needs to be changed:

 

The commands that have both an up and a down action (for example, the weapon system manual/auto mode, which is up for manual and down for auto) need to have both an UP and a DOWN at the beginning of the line.

 

i.e. your text:

{ down = 3016, cockpit_device_id = 12, value_down = 1.0, value_up = 0, name = "CUSTOM_TOGGLE: Targeting mode reset", category = "CUSTOM_WEAP_INTERFACE"},

 

is wrong, we need:

{ down = 3016, up = 3016, cockpit_device_id = 12, value_down = 1.0, value_up = 0, name = "CUSTOM_TOGGLE: Targeting mode reset", category = "CUSTOM_WEAP_INTERFACE"},

I'd love to have a copy of your script to work on, so I can build the commands for the Mig21. Would that be possible?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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