ScenEdit_AddZone fails in LUA Console?

Post bug reports and ask for game support here.

Moderator: MOD_Command

Post Reply
coolum001
Posts: 7
Joined: Thu Aug 03, 2017 1:46 am

ScenEdit_AddZone fails in LUA Console?

Post by coolum001 »

Hi

I am running Command V12.12 Build936.21, Running in Steam Mode

I have a problem trying to create an exclusion zone from the LUA Console (use case is modelling an Economic Exclusion Zone, with many RPs to be created from LUA). The problem occurs in even the hand-crafted 4 RP case.

my code looks like:

Code: Select all

 local points = ScenEdit_GetReferencePoints({side="ADF", area={"X1", "X2", "X3", "X4"}})
 print(points)
 local tt={description='EEZ', isactive=true, area=points, affects={'Aircraft','Ship'}, markas='Hostile'}
 print(tt)
 ScenEdit_AddZone('ADF', 1, tt)
 
 
and the print statements shows what I expect, but I get the error pop-up, and LUA error

Code: Select all

 ScenEdit_AddZone 5 : ,Error in RP!
 
Is there some attribute I should be setting in the RP, so I can use them in a Zone to be created from LUA?

Thanks in advance
Attachments
LUAAddZone.zip
(2.75 KiB) Downloaded 4 times
coolum001
Posts: 7
Joined: Thu Aug 03, 2017 1:46 am

RE: ScenEdit_AddZone fails in LUA Console?

Post by coolum001 »

So I figured it out by myself;

In the 'table' list parameter input to the Scen_AddZone method,

the attribute 'area' is described as '{ of RPs }'; it is actually a list of RP names.

So, code like:

local tt={description='EEZ', isactive=true, area={"X1", "X2", "X3", "X4"}, affects={'Aircraft','Ship'}, markas='Hostile'}
print(tt)
ScenEdit_AddZone('ADF', 1, tt)

works OK

I suggest providing usage examples for this method.

Thanks for your time
Rory Noonan
Posts: 2418
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

RE: ScenEdit_AddZone fails in LUA Console?

Post by Rory Noonan »

You can save yourself some typing and use the following:

ScenEdit_AddZone('ADF', 1, {description='EEZ', isactive=true, area={"X1", "X2", "X3", "X4"}, affects={'Aircraft','Ship'}, markas='Hostile'})
Image
Post Reply

Return to “Tech Support”