Nagilem Posted December 2, 2019 Share Posted December 2, 2019 (edited) Anyone know how to access the trigger zone custom properties from a script? I added the properties and can see them in the mission file inside the miz. From the mission file in the miz - [14] = { ["y"] = 428908.55457227, ["radius"] = 3000, ["zoneId"] = 823, ["x"] = -229321.5339233, ["color"] = { [1] = 1, [2] = 1, [3] = 1, [4] = 0.15, }, -- end of ["color"] ["properties"] = { [1] = { ["key"] = "Sunrise", ["value"] = "7", }, -- end of [1] [2] = { ["key"] = "Sunset", ["value"] = "19", }, -- end of [2] [3] = { ["key"] = "Start_Delay", ["value"] = "900", }, -- end of [3] }, -- end of ["properties"] ["hidden"] = false, ["name"] = "Variables", }, -- end of [14] I tried several methods to get them loaded but can't seem to access them. First method - tried get getZones API function. I can get to the "radius" property, but cannot seem to enumerate the custom property key/value pairs. I don't know what other table entries are passed back from the function when invoked. Hoggit has an example that includes radius and point. local Vartable = trigger.misc.getZone("Variables") https://wiki.hoggitworld.com/view/DCS_func_getZone Also tried the moose method to GetStates(). I cannot return the custom properties. local Vartable = ZONE:FindByName("Variables") local test = Vartable:GetState(Vartable, "Sunrise") I haven't found a good way to force the enumeration of the Vartable variable as a table in the log to see what these functions return. I get errors when I try. Anyone else know how to pass these into variables in lua? Edited December 2, 2019 by Nagilem 1 :pilotfly: Specs: I9-9900k; ROG Strix RTX 2080ti; Valve Index HMD; 32GB DDR4 3200 Ram; Samsung 970 EVO 1TB SSD; TM Warthog with pedals, 3 TM MFDs Link to comment Share on other sites More sharing options...
Nagilem Posted December 3, 2019 Author Share Posted December 3, 2019 Thanks to some folks on Discord - found another way to pass variables using a DO SCRIPT function in a trigger. I added a trigger, set up a do script in that trigger, then declare the variables as I would in a lua script fie directly in the ME. Then after that runs, I setup my DO SCRIPT FILE and redeclare those variables in my script referencing the previous declarations and they come right into the script Works great. 1 :pilotfly: Specs: I9-9900k; ROG Strix RTX 2080ti; Valve Index HMD; 32GB DDR4 3200 Ram; Samsung 970 EVO 1TB SSD; TM Warthog with pedals, 3 TM MFDs Link to comment Share on other sites More sharing options...
Recommended Posts