Skip to content

P51‐D Generator Disconnect Switch

Jerker Dahlblom edited this page Sep 20, 2023 · 12 revisions

We will take this control and see where the values comes from and what they mean

p51_gen_lua_definition

The P-51D manual states that the disconnect switch is the left switch on the upper row.

cockpit_switches_mw_screen

  • Now start ModelViewer2.exe.
  • Open Cockpit_P-51D-25-NA.edm

p51_gen_arg_mw

When you place your cursor on the connector box for the generator you will see an argument_id pop up. In this case it is pnt_102.

p51_gen_arg_change_mw

You can now go to that argument in the Args window of model viewer and with the slider you can see that the control moves. Now we have verified that 102 is the argument_id for the control.

Now we need the device category ID which we will find from several files.

Searching for ptn_102 or 102 in the DCS World\Mods\aircraft\P-51D\Cockpit\Scripts\ shows this entry in clickabledata.lua. p51_gen_clickable_data_device

There the device category is listed. We need the actual ID which is a number. So opening devices.lua we find that this. p51_devices_list_get_highlighted

The device category ID is 14.

Now we need the command ID for the control. Going back to clickabledata.lua we have this piece of information.

p51_gen_command

It is Button3 we are interested in. We find information about that in the command_defs.lua file.

p51_gen_command_def_lua

You can see that commands starts at 3000, so for each button in the list you add 1. We can deduce that the command ID is 3003.

To summarize :

  • argument_id is 102
  • device category ID is 14
  • command ID is 3003

Now you have enough information to create the control in DCS-BIOS. What you need to decide on now is what type of control it will be in DCS-BIOS. There are a lot of them. This one was simple though. defineToggleSwitch makes the most sense.

p51_gen_lua_definition

  • GEN, this is the unique name for the DCS-BIOS control, name your controls so it is easy to understand what it is.
  • Right Switch Panel is the category, the rest of the switches on the same panel would use this category too.
  • Generator, description. Here you can add a little more context if necessary.

Back