Setting up switches in the Spitfire Mk IX

View previous topic View next topic Go down

Setting up switches in the Spitfire Mk IX

Post  StiC on Tue Feb 07, 2017 7:51 pm

To get latching toggle switches to function in DCS you need to set up a customized control input. This will work with any DCS module.

First locate the default.lua file in the game folder. C:\Program Files\Eagle Dynamics\DCS World\Mods\aircraft\SpitfireLFMkIX\Input\SpitfireLFMkIX\joystick\default.lua

Then open the file in a text editor. notepad++ is recommended but regular notepad should work. You will see lots of gibberish like this...

-- Flaps Lever
{down = device_commands.Button_9, cockpit_device_id = devices.CONTROLS, value_down = 1.0, name = _('Input.SpitfireLFMkIX.flaps_1'), category = _('Flight Control')},
{down = device_commands.Button_9, cockpit_device_id = devices.CONTROLS, value_down = 0.0, name = _('Input.SpitfireLFMkIX.flaps_0'), category = _('Flight Control')},
{down = device_commands.Button_10, cockpit_device_id = devices.CONTROLS, value_down = 1.0, name = _('Input.SpitfireLFMkIX.flaps'), category = _('Flight Control')},


Notice there are two device commands for Flaps, 9 & 10. There are two 9s because one is for flaps off/up (value_down = 0.0) and the other is for flaps on/down (value_down = 1.0). Device command 10 is for the Flaps toggle button assignment.

Toggle switches, like the ones on the TM Warthog throttle, have 2 or 3 positions. OFF-ON for the 2 position where the bottom position is off and the ON position is assigned a button number. ON-OFF-ON for the 3 position where the middle position is off and the 2 ON states are assigned to 2 different buttons.

As the code appears above, we can only assign controls when the switch is turned from the off position to the on position, which isn't much good if we want to control the flaps with a single toggle switch. To fix it we need to add a control input that recognizes both on and off actions.

Start by copying one of the ON/OFF lines. I prefer using the one where the value_down = 0.0 as this usually matches the position of the physical switch. Paste the line back into the file so it looks like this.

-- Flaps Lever
{down = device_commands.Button_9, cockpit_device_id = devices.CONTROLS, value_down = 0.0, name = _('Input.SpitfireLFMkIX.flaps_0'), category = _('Flight Control')},
{down = device_commands.Button_9, cockpit_device_id = devices.CONTROLS, value_down = 1.0, name = _('Input.SpitfireLFMkIX.flaps_1'), category = _('Flight Control')},
{down = device_commands.Button_9, cockpit_device_id = devices.CONTROLS, value_down = 0.0, name = _('Input.SpitfireLFMkIX.flaps_0'), category = _('Flight Control')},
{down = device_commands.Button_10, cockpit_device_id = devices.CONTROLS, value_down = 1.0, name = _('Input.SpitfireLFMkIX.flaps'), category = _('Flight Control')},


Next edit the line to recognize switching from on to off with an up device command.
{down = device_commands.Button_9, up = device_commands.Button_9, cockpit_device_id = devices.CONTROLS, value_down = 0.0, name = _('Input.SpitfireLFMkIX.flaps_0'), category = _('Flight Control')},

Then add a value to the up command. Note that it is different than the down value. The value is taken from the other device command 9 line.
{down = device_commands.Button_9, up = device_commands.Button_9, cockpit_device_id = devices.CONTROLS, value_down = 0.0, value_up = 1.0, name = _('Input.SpitfireLFMkIX.flaps_0'), category = _('Flight Control')},

Last give the command a unique name. You can also add a unique category to make the new command easy to find but it is not necessary.
{down = device_commands.Button_9, up = device_commands.Button_9, cockpit_device_id = devices.CONTROLS, value_down = 0.0, value_up = 1.0, name = _('Custom_Input.SpitfireLFMkIX.flaps_0'), category = _('Custom_Flight Control')},

Save the file and start DCS World. Now when you go into the control options you will find the new button assignment under the unique name you chose. Assign the control using your toggle switch and test it in the game. If the switch operates the opposite of what you expected simply edit the line to swap the values assigned to value_down/value_up and reassign the switch in the control options.

Game updates will overwrite this file so keep a backup.

_________________
avatar
StiC
Warrant Officer

Posts : 669
Join date : 2012-02-27
Age : 47
Location : Cape Breton Island

View user profile

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum