Jump to content

Recommended Posts

Posted (edited)

Hi People,

I try to assign the BR-RD Switch to my HOTAS warthog... Pinky Switch or flaps.

But if iuse a 3 way switch it only works in one direction, if i move the switch on my HOTAS from the [RD(down)] postion to middel, the switch in Cockpit jumps to the BR Position.

Any solution to fix this???

Edited by Jafferson
Posted

Are you using target or programming the switches in DCS?

HP G2 Reverb (Needs upgrading), Windows 10 VR settings: IPD is 64.5mm, High image quality, G2 reset to 60Hz refresh rate. set to OpenXR, but Open XR tool kit disabled.

DCS: Pixel Density 1.0, Forced IPD at 55 (perceived world size), DLSS setting is quality at 1.0. VR Driver system: I9-9900KS 5Ghz CPU. XI Hero motherboard and RTX 3090 graphics card, 64 gigs Ram, No OC... Everything needs upgrading in this system!.

Vaicom user and what a superb freebie it is! Virpil Mongoose T50M3 base & Mongoose CM2 Grip (not set for dead stick), Virpil TCS collective with counterbalance kit (woof woof). Virpil Apache Grip (OMG). MFG pedals with damper upgrade. Total controls Apache MPDs set to virtual Reality height. Simshaker Jet Pro vibration seat.. Uses data from DCS not sound... goodbye VRS.

Posted (edited)

follow this link: you will need to make some lua changes. I completely reworked my thrustmaster warthog hotas with 2 and 3 way switches.

 

For instance: the laste switch in up position now puts the autopilot in desired heading while switch down is desired track. Middle position is neither.

 

http://forums.eagle.ru/showthread.php?p=2472727#post2472727

 

The last 7 pages or so will give you enough information. The first post about the KA-50 is outdated information. You will need the information about the P51-D though. This information works the same for the ka-50. So be sure to read the first post but ignore the stuff about the ka-50.

 

actually you need only this piece of information:

 

Ian;2440800']Step 1: Note the tooltip text of the switch you want, in this case "Weapon mode switch - Burst Length"

 

Step 2: Locate your aircraft's clickabledata.lua file and open it in a text editor (I use Notepad++). It is located in C:\Program Files\Eagle Dynamics\DCS World\Mods\aircraft\Ka-50\Cockpit\Scripts.

 

Step 3: Search for the tooltip text to find your switch, it will look something like this:

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}

Note "arg_lim" from 0.0 to 0.2, and "arg_value" has has a 0.1 multiplier. You don't have to understand every detail of what is going on here (I don't), but it is enough to guess that the values you want are 0.0, 0.1 and 0.2 (0.0 to 0.2 in 0.1 steps). Three-position buttons use 0.0, 0.1 and 0.2 -- except when they don't and it's -1, 0 and 1 instead:

elements["PTR_HUD-TMB-SETKA02"] = { class = {class_type.TUMB,  class_type.TUMB}, hint = LOCALIZE("HUD Modes Reticle/Night/Day"), device  = devices.HUD, action = {device_commands.Button_2,  device_commands.Button_2}, arg = {9, 9}, arg_value = {-direction*1.0,  direction*1.0}, arg_lim = {{-1,1}, {-1,1}} }

You get the idea.

 

So far, we have established that the values for the switch positions are 0.0, 0.1 and 0.2.

We also need a command number. In clickabledata.lua, those are usually written as "device_commands.Button_X", where "Button_X" means 3000+X. For our switch, we want command number 3004. We also need to know the device ID to send the command to. Note "device = devices.WEAP_INTERFACE". In your aircraft's "devices.lua" file, you can learn that WEAP_INTERFACE is device ID 12.

 

We have gathered the following information:

Device ID: 12

Command: 3004

Argument values: 0.0, 0.1, 0.2

 

Now we can write entries to add to the Ka-50's "default.lua" input config file (C:\Program Files\Eagle Dynamics\DCS World\Mods\aircraft\Ka-50\Input\ka-50\default.lua):

{down = 3004, value_down = 0.2, up = 3004, value_up = 0.1,  cockpit_device_id = 12, name = " Weapon mode switch center/up", category  = "Ins Weapons Status and Control Panel PUI-800"},
{down = 3004, value_down = 0.0, up = 3004, value_up = 0.1,  cockpit_device_id = 12, name = " Weapon mode switch down/center",  category = "Ins Weapons Status and Control Panel PUI-800"},

As suggested by Yurgon, I have prepended a space to the name to make the command show up at the top of the list.

 

The first entry is for the "up" direction of the Warthog Throttle's toggle switch (button 27): when it is pushed down (the switch is moved up), we send command 3004 with an argument of 0.2 to device 12. When it is released (switch back to center), we send command 3004 with an argument of 0.1 to device 12.

 

The second entry is for the "down" direction of the Warhog Throttle's toggle switch (button 2cool.gif: when it is pushed down (the switch is moved down), we send command 3004 with an argument of 0.0 to device 12. When it is released (switch back to center), we send command 3004 with an argument of 0.1 to device 12.

 

After you have edited default.lua, save the file, restart DCS and assign your key bindings in the options.

 

This should work for any aircraft with a clickable cockpit. Note that sometimes, the "devices.lua" file can be tricky. For example, here's the start of the "devices.lua" file for the UH-1H:

local count = 0
local function counter()
   count = count + 1
   return count
end
-------DEVICE ID-------
devices = {}
-- moved forward for correct initialization of another devices
-- do not changed folowing sequence for sim
devices["ELEC_INTERFACE"]            = counter() -- 1
devices["FUELSYS_INTERFACE"]        = counter() -- 2
devices["ENGINE_INTERFACE"]            = counter() -- 3
devices["HYDRO_SYS_INTERFACE"]        = counter() -- 4
devices["ADI_PILOT"]                = counter() -- 6
devices["ADI_OPERATOR"]                = counter() -- 7
devices["NAVLIGHT_SYSTEM"]            = counter() -- 8
devices["SOUND_SYSTEM"]             = counter() -- 9
devices["WEAPON_SYS"]                = counter() -- 10

Note that device IDs are not assigned directly. Instead, the file defines a function called "counter" that returns the next higher value whenever it is called, so the first device (ELEC_INTERFACE) gets 1, FUELSYS_INTERFACE gets 2, etc. Also note the helpful comments that have been provided. Can you spot the trap? (What is the device ID for SOUND_SYSTEM?)

 

 

The comments are wrong -- they skip device 5. The Lua interpreter does not care about comments. Device ADI_PILOT has ID 5, not 6. Device ADI_OPERATOR has ID 6, not 7, etc. The correct device ID for SOUND_SYSTEM is 8.

 

Edited by kingpinda
Posted

Ok thx, thats what i searcing for.

I found the line...

 

elements["BAR-RV-PTR"] = {class = {class_type.TUMB,class_type.TUMB}, hint = LOCALIZE("Autopilot BARO/RALT altitude hold mode"), device = devices.AUTOPILOT, action = {device_commands.Button_6,device_commands.Button_6}, stop_action = {}, arg = {335,335},cycle = false, arg_value = {direction*0.5,-direction*0.5}, arg_lim = {{0.0, 1.0},{0.0, 1.0}}, use_OBB = true, updatable = true}

 

But no idea to change this???

Posted (edited)

figured out...

 

arg_value = {-direction*1.0,direction*1.0}, arg_lim = {{0.0, 1.0},{0.0, 1.0}}, use_OBB = true, updatable = true}

 

Changing the end of the line works :thumbup:

 

elements["BAR-RV-PTR"] = {class = {class_type.TUMB,class_type.TUMB}, hint = LOCALIZE("Autopilot BARO/RALT altitude hold mode"), device = devices.AUTOPILOT, action = {device_commands.Button_6,device_commands.Button_6}, stop_action = {}, arg = {335,335}, arg_value = {-direction*1.0,direction*1.0}, arg_lim = {{0.0, 1.0},{0.0, 1.0}}, use_OBB = true, updatable = true}

Edited by Jafferson
Posted (edited)

That's one way of doing it.. making a three-way switch into a 2-way switch... but thats not what was explained in above quote.

 

But if it floats your boat and you don't ever use the middle position.

 

The clean correct method however would be to take the information from the clickable lua and device lua and make 2 new lines in a copy of the default.lua in the mods/aircraft/ka-50/input/joystick map and rename it so it sits next to the default.lua.

 

Then add below this line

 

{down = iCommandHelicopter_PPR_BAR_RV , name = _('Autopilot BARO/RALT altitude hold mode'), category = _('Ins Autopilot')},

these two lines:

 

{down = 3006, value_down = 0.0, up = 3006, value_up = 0.5, cockpit_device_id = 33, name = _(' Baro/neutral'), category = _('Ins Autopilot')},
{down = 3006, value_down = 1.0, up = 3006, value_up = 0.5,  cockpit_device_id = 33, name = _(' Radar/neutral'), category = _('Ins  Autopilot')},

and bind these 2 new binds to the up and down position of your flaps or laste or nav lights switch.

 

don't use the icommands up and down. they tend not to sync and values don't work with icommands. The value is what tells the sim in what position the switch needs to be: 0.0 is up position ie Baro, 0.5 is middle position and 1.0 is down position ie Radar.

 

What you did is basically tell the sim that instead of the multiplier (arg_value) be 0.5 in a range of 0.0 to 1.0 (three positions) you changed the multiplier to 1! so you end up with 2 positions in a range from 0.0 to 1.0. Multiplying isn't the correct term because you can't multiply 0 and expect a different number.. but They are basically units. you changed units of 0.5 to units of 1.0

 

edit: forgive me if I use wrong terminology. But I am not a programmer nor have I ever ventured in lua's untill a couple months back.

Edited by kingpinda
  • Recently Browsing   0 members

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