Trigger zone custom properties - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 12-02-2019, 02:33 PM   #1
Nagilem
Member
 
Join Date: Feb 2019
Location: Gilbert, AZ
Posts: 335
Default Trigger zone custom properties

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 -
Code:
       [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.
Code:
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.
Code:
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?
__________________
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

Last edited by Nagilem; 12-02-2019 at 03:11 PM.
Nagilem is offline   Reply With Quote
Old 12-03-2019, 04:20 PM   #2
Nagilem
Member
 
Join Date: Feb 2019
Location: Gilbert, AZ
Posts: 335
Default

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.
__________________
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
Nagilem is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 03:40 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.