Jump to content

Recommended Posts

Posted (edited)

I am in need of some assistance with my joystick default.lua file.

I am trying to modify the speed brake function like I did for the landing gear.

The problem is that no matter what I do at best I can only see one action in the control panel but, usually none. Ed's is there and working but not mine.

At first I thought it was because of a naming conflict, 'Alt Speed Brake Switch - EXTEND', 'Alt Speed Brake Switch - RETRACT' but, Ed's is nearly identical, 'Speed Brake Switch - EXTEND', 'Speed Brake Switch - RETRACT' and it still works.

I am still new at LUA so, it may be something simple. Hopefully someone will spot my error.

Maybe someone can tell me how to insert code correctly.

 

Since I don't know how to insert code, I will list my examples below.

-- ED's approach

{    down = hotas_commands.THROTTLE_SPEED_BRAKE,                        up = hotas_commands.THROTTLE_SPEED_BRAKE,                        cockpit_device_id = devices.HOTAS,    value_down = -1.0,    value_up = 0.0,    name = _('Speed Brake Switch - EXTEND'),                    category = {_('Throttle Grip'), _('HOTAS')}},
{    down = hotas_commands.THROTTLE_SPEED_BRAKE,                                                                                        cockpit_device_id = devices.HOTAS,    value_down =  0.0,                    name = _('Speed Brake Switch - OFF'),                        category = {_('Throttle Grip'), _('HOTAS')}},
{    down = hotas_commands.THROTTLE_SPEED_BRAKE,                                                                                        cockpit_device_id = devices.HOTAS,    value_down =  1.0,                    name = _('Speed Brake Switch - RETRACT'),                    category = {_('Throttle Grip'), _('HOTAS')}},

 

-- My first

{    down = hotas_commands.THROTTLE_SPEED_BRAKE,            up = hotas_commands.THROTTLE_SPEED_BRAKE,        cockpit_device_id = devices.HOTAS,                value_down =  1.0,    value_up = 0.0,    name = _('Alt Speed Brake Switch - EXTEND/ON'),                            category = {_('Special For Joystick'), _('Throttle Grip'), _('HOTAS')}},
{    down = hotas_commands.THROTTLE_SPEED_BRAKE,                                                            cockpit_device_id = devices.HOTAS,                value_down =  1.0,    value_up = 0.0,    name = _('Alt Speed Brake Switch - RETRACT/OFF'),                       category = {_('Special For Joystick'), _('Throttle Grip'), _('HOTAS')}},

 

-- My current

{    down = hotas_commands.THROTTLE_SPEED_BRAKE,            up = hotas_commands.THROTTLE_SPEED_BRAKE,        cockpit_device_id = devices.HOTAS,                value_down = -1.0,    value_up = 0.0,    name = _('Alt Speed Brake Switch - EXTEND'),                            category = {_('Special For Joystick'), _('Throttle Grip'), _('HOTAS')}},
{    down = hotas_commands.THROTTLE_SPEED_BRAKE,                                                            cockpit_device_id = devices.HOTAS,                value_down =  1.0,                    name = _('Alt Speed Brake Switch - RETRACT'),                           category = {_('Special For Joystick'), _('Throttle Grip'), _('HOTAS')}},

Edited by Barnowl

Windows 10 x64, Intel i9 11900K, cooled by Cooler Master water cooler, 64GB DDR4, Asus Z590-E Wifi, NVIDIA GeForce GTX 1070 8GB, 4 NVMe SSD's, Sony 27", Delan Clip using Opentrack, WinWing F-15EX Throttle, F-16EX Stick, Skywalker Rudder, and 2 MFD's with display units, MS Sidewinder FFB Stick

Posted

You haven't stated what you want to achieve so I can only guess.

A command with the value -1 will extend the speedbrake as long as the command is present (contact closed), until it's fully extended.

A command with the value 0 (zero) stops the speedbrake' movement in its current position.

A command with the value 1 will retract the speedbrake as long as the command is present (contact closed), until it's fully retracted.

I use the stock commands 'Speed Brake Switch - EXTEND' and 'Speed Brake Switch - RETRACT/OFF' with the speedbrake switch on the TM WH throttle and that works fine as I can extend the speedbrake to any desired position.

 

If you want to use just a single maintained 2-position ON/OFF switch then you can use this code line:

{down = hotas_commands.THROTTLE_SPEED_BRAKE, up = hotas_commands.THROTTLE_SPEED_BRAKE, cockpit_device_id = devices.HOTAS, value_down = -1.0, value_up = 1.0, name = _('Speed Brake 2-Pos Switch EXTEND/RETRACT'), category = {_('Throttle Grip'), _('HOTAS')}},

When the switch is ON the speedbrake extends fully, and when you switch back to OFF it will retract all the way. You cannot set them to an intermediate position. You can reverse the command by swapping the values 1 and -1.

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

Posted (edited)

Thank you for your help.

 

What I am trying to do is duplicate what ED's code does but, have the ability for the game to 'Remember' the switch position.

Example:

{    down = iCommandPlaneGearUp,                         up = iCommandPlaneGearDown,                                                                        value_down =  1.0,    value_up = 0.0,    name = _('Alt Landing Gear Control Handle 2-Pos UP/DOWN'),                category = {_('Special For Joystick'), _('Left Vertical Panel')}},

This code knows where my switch position is at all times.

 

If I understand you correctly, with this code that you use, allows you to 'Extend/Retract' with only one line of code. And with your example it can only be fully Extended or Retracted, nothing in between.

Again thanks for your help.

Edited by Barnowl

Windows 10 x64, Intel i9 11900K, cooled by Cooler Master water cooler, 64GB DDR4, Asus Z590-E Wifi, NVIDIA GeForce GTX 1070 8GB, 4 NVMe SSD's, Sony 27", Delan Clip using Opentrack, WinWing F-15EX Throttle, F-16EX Stick, Skywalker Rudder, and 2 MFD's with display units, MS Sidewinder FFB Stick

Posted

This code knows where my switch position is at all times.

That's easy to "know" because the gear can only be UP or down.

The speed brake can be anywhere between RETRACTED and EXTENDED, so what you desire is not feasible with switches.

I actually use the stock code and I have 3 defined positions:

RETRACTED, EXTENDED, HALTED (wherever I moved the 3-position switch to the middle position).

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

Posted

Ok, good to know. Thanks

Windows 10 x64, Intel i9 11900K, cooled by Cooler Master water cooler, 64GB DDR4, Asus Z590-E Wifi, NVIDIA GeForce GTX 1070 8GB, 4 NVMe SSD's, Sony 27", Delan Clip using Opentrack, WinWing F-15EX Throttle, F-16EX Stick, Skywalker Rudder, and 2 MFD's with display units, MS Sidewinder FFB Stick

Posted

Is there any way to make changes to the lua file and see the results without shutting down and restarting DCS?

Windows 10 x64, Intel i9 11900K, cooled by Cooler Master water cooler, 64GB DDR4, Asus Z590-E Wifi, NVIDIA GeForce GTX 1070 8GB, 4 NVMe SSD's, Sony 27", Delan Clip using Opentrack, WinWing F-15EX Throttle, F-16EX Stick, Skywalker Rudder, and 2 MFD's with display units, MS Sidewinder FFB Stick

Posted
Is there any way to make changes to the lua file and see the results without shutting down and restarting DCS?

No. It seems that the software loads the LUA files when the game starts, and ignores any changes thereafter.

PS:

For your alternate gear command, you don't need the value_down and value_up stements.

This will do:

{down = iCommandPlaneGearUp, up = iCommandPlaneGearDown, name = _('Alt Landing Gear Control Handle 2-Pos UP/DOWN'), category = {_('Special For Joystick'), _('Left Vertical Panel')}},

That's because "iCommandPlaneGearUp" and "iCommandPlaneGearDown" are self-contained commands that don't need any arguments.

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

Posted
No. It seems that the software loads the LUA files when the game starts, and ignores any changes thereafter.

PS:

For your alternate gear command, you don't need the value_down and value_up stements.

This will do:

{down = iCommandPlaneGearUp, up = iCommandPlaneGearDown, name = _('Alt Landing Gear Control Handle 2-Pos UP/DOWN'), category = {_('Special For Joystick'), _('Left Vertical Panel')}},

That's because "iCommandPlaneGearUp" and "iCommandPlaneGearDown" are self-contained commands that don't need any arguments.

Ok, Thanks

Windows 10 x64, Intel i9 11900K, cooled by Cooler Master water cooler, 64GB DDR4, Asus Z590-E Wifi, NVIDIA GeForce GTX 1070 8GB, 4 NVMe SSD's, Sony 27", Delan Clip using Opentrack, WinWing F-15EX Throttle, F-16EX Stick, Skywalker Rudder, and 2 MFD's with display units, MS Sidewinder FFB Stick

  • Recently Browsing   0 members

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