Jump to content

Adding 'nudge' bindings for axis commands


electricaltill

Recommended Posts

I'm making a button box for the F-14. There are several rotary elements that have 'nudge' CW/CCW key bindings. Some don't have these bindings, I would like to add them and I can't quite grasp from the LUAs how they work.

 

For instance, the azimuth center knob in the RIO cockpit (which DOES have these bindings). In clickabledata.lua:

elements["PNT_82"] = default_axis(_("Radar azimuth center"),devices.RADAR, device_commands.RADAR_azimuth_center_knob, cockpit_args.RADAR_azimuth_center_knob, 0.0)

Fine. But in default.lua for the keyboard commands we have:

{ combos = {{key = 'D', reformers = {'LAlt'}}}, up = device_commands.RADAR_azimuth_leftright, down = device_commands.RADAR_azimuth_leftright, cockpit_device_id=devices.RADAR, value_down = 1, value_up = 0, name = _('Radar azimuth right'), category = _('Radar Control Panel')},
{ combos = {{key = 'A', reformers = {'LAlt'}}}, up = device_commands.RADAR_azimuth_leftright, down = device_commands.RADAR_azimuth_leftright, cockpit_device_id=devices.RADAR, value_down = -1, value_up = 0, name = _('Radar azimuth left'), category = _('Radar Control Panel')}

In default.lua for the joystick commands we have:

{ up = device_commands.RADAR_azimuth_leftright, down = device_commands.RADAR_azimuth_leftright, cockpit_device_id=devices.RADAR, value_down = 1, value_up = 0, name = _('Radar azimuth right'), category = _('Radar Control Panel')},
{ up = device_commands.RADAR_azimuth_leftright, down = device_commands.RADAR_azimuth_leftright, cockpit_device_id=devices.RADAR, value_down = -1, value_up = 0, name = _('Radar azimuth left'), category = _('Radar Control Panel')}

So there's extra 'leftright' commands which seem to make this work.

 

I can see in command_defs.lua that there are two lines for this control:

   RADAR_azimuth_scan_knob = counter(),
   RADAR_azimuth_leftright = counter()

I have tried to add 'leftright' bindings for the DDD erase control by editing all of the files above. The bindings appear in DCS, but don't actually do anything when mapped.

 

In clickabledata.lua both of these controls ("Erase" and "Radar azimuth center") are default_axis commands, so no changes needed there.

 

What am I missing?


Edited by electricaltill
Link to comment
Share on other sites

Keyboard default lua only works with keyboard. Joystick defaultlua is only loaded with a joystick.

 

Your code examples do not have unique names, they have the default names, so your list is not updated with your new commands. 'example left" would be changed to 'example left nudge' or whatever.

 

I find that editing a button press command works with a hard-wired button, but a virtual button produced by code (encoder sending a virtual button pulse for example) will not be affected.

 

Good luck, I'm done here.

Link to comment
Share on other sites

Keyboard default lua only works with keyboard. Joystick defaultlua is only loaded with a joystick.

 

Your code examples do not have unique names, they have the default names, so your list is not updated with your new commands. 'example left" would be changed to 'example left nudge' or whatever.

 

The examples are not my code, they are existing, working bindings. I am asking if there is anything else needed to make bindings like this work. Mainly I don't understand what gives significance to the 'leftright' commands in command_defs.lua.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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