Jump to content

Querying the DCS Scripts\Database\planes type files from with LUA


Kolyma

Recommended Posts

I think this idea is beyond currently documented info about what end-users know about the DCS API for LUA and there's no existing library doing this kind of stuff

 

1) From inside a script running under the DCS LUA sandbox engine, is it possible to access an existing in-memory database that contains this kind of information?

 

\Scripts\Database\planes\A-10C.lua

 

I'm specifically looking if I can build up or access a key/value store of the pylon locations and authorized munitions, plus other aircraft-specific capabilities defined in those files in that directory.

 

2) If I can't get it from the DCS API in LUA scripts under the engine, I'm thinking of trying to access the files myself from within a running script and build up the key/value store. That's assuming a running DCS LUA scripts is not permissions-blocked from accessing that area of the file system.

 

Does anyone know the best way to integrate these files into a custom DCS script in order to generate some kind of comprehensive database? I have no problem enumerating the files themselves and cycling through accessing them. I'll admit to being more of a C++ and Python programmer, so my LUA stuff is hackety hack hack right now...

 

return plane( "A-10C", _("A-10C"),
   {
       
       EmptyWeight = "11325",
       MaxFuelWeight = 5029,
       MaxHeight = "13700",
       MaxSpeed = "840",
       MaxTakeOffWeight = "21081",
       Picture = "A-10A.png", --!!!!
       Rate = "50",
       Shape = "a-10",
       WingSpan = "17.53",
       WorldID = 58,
       
	-- Countermeasures
	passivCounterm = {
		CMDS_Edit = true,
		SingleChargeTotal = 480,
		-- RR-170 - 30 cartridges per magazine, increment by 2 magazines
		chaff = {default = 240, increment = 60, chargeSz = 1},
		-- MJU-7 - 15 cartridges per magazine, increment by 2 magazines
		flare = {default = 120, increment = 30, chargeSz = 2}
       },
	
   {
       pylon(1, 0, -0.615000, -0.016000, -6.365000,
           {
			use_full_connector_position=true,
           },
           {
               { CLSID = "{DB434044-F5D0-4F1F-9BA9-B73027E18DD3}" },
               { CLSID = "{BCE4E030-38E9-423E-98ED-24BE3DA87C32}" }, -- MK-82				
			{ CLSID = "LAU-105_1*AIM-9M_L" },
			{ CLSID = "LAU-105" },
			{ CLSID = "LAU-105_2*CATM-9M" },
			{ CLSID = "LAU-105_1*CATM-9M_L" },
			{ CLSID = "{6D21ECEA-F85B-4E8D-9D51-31DC9B8AA4EF}" },
               { CLSID = "{A4BCC903-06C8-47bb-9937-A30FEDB4E741}" },
               { CLSID = "{A4BCC903-06C8-47bb-9937-A30FEDB4E742}" },
               { CLSID = "{A4BCC903-06C8-47bb-9937-A30FEDB4E743}" },
               { CLSID = "{A4BCC903-06C8-47bb-9937-A30FEDB4E744}" },
               { CLSID = "{A4BCC903-06C8-47bb-9937-A30FEDB4E745}" },
               { CLSID = "{A4BCC903-06C8-47bb-9937-A30FEDB4E746}" },
			{ CLSID = "{DB769D48-67D7-42ED-A2BE-108D566C8B1E}" }, -- GBU-12
			{ CLSID = "{BDU-50LD}" },
			{ CLSID = "{BDU-50LGB}" }, -- BDU-50LGB
			{ CLSID = "{BDU-50HD}" },
			{ CLSID = "{Mk82AIR}" },
			{ CLSID = "{CBU-87}" },
			{ CLSID = "ALQ_184" }, -- ALQ-184		
			{ CLSID = "{5335D97A-35A5-4643-9D9B-026C75961E52}" }, -- CBU-97
			{ CLSID = "LAU-105_AIS_ASQ_T50_L" },	-- ACMI
           }
       ),

Link to comment
Share on other sites

Not really no. When you make a mission file you can easily read the payload for groups created there, but that isn't a whole list of which weapons can be put where. Some basic data is available via Unit.getDesc(), getSensors(), and getWeapons(). I compiled all those default values in a DB. For example here is the F-18: https://github.com/mrSkortch/DCS-miscScripts/blob/master/ObjectDB/Aircraft/FA-18C.lua

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

I thought so. That static, cut-n-paste version of gathering that data is how I've handled the idea in the past.

 

I'm going to write something library-like to just build up a script-useful dynamic db derived from the actual DCS files installed at runtime. Worst case scenerio (if a script ran from the LUA engine can't for some reason touch those files when running, I'll make it do some kind of out-of-script pre-procesing to build a static version of the loadable DB. If you can think it, you can do it, right?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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