Trouble with LUA / Activation & Deactivation of No-Navigation Zones (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Tech Support



Message


Fer_Cabo -> Trouble with LUA / Activation & Deactivation of No-Navigation Zones (6/9/2017 9:17:56 AM)

Hi guys,

I'm having trouble with a LUA instruction for an Action that deactivates an existing and active No-Navigation Zone.

What i found in CMANO manuals and sample scripts is as follows:

mySide = VP_GetSide({Name=”US”})
myZone = mySide:getnonavzone(“AAW Zone 1”)
myZone.isactive = ”False”

In my Scenario case, the script would be as follows, for an Action deactivating the initially activated No-Navigation-Zone defined for "DPRK" side units on Chinese Territory (the No-Navigation Zone is called "PRCSOVEREIGN"), once the side "PRC" has been attacked and the Mutual Defence Agreement between the two countries/Sides enters into effect:

mySide = VP_GetSide({Name=”DPRK”})
myZone = mySide:getnonavzone(“PRCSOVEREIGN”)
myZone.isactive = ”False”

The problem is... when i test this LUA Script in the Script Console, it returns ERROR based on a character position (148) which does not even exist, since the script is apparently not so long.

What'd be the right scripting?

Thanks a (metric)Ton in advance for your help!

Fernando.






michaelm75au -> RE: Trouble with LUA / Activation & Deactivation of No-Navigation Zones (6/9/2017 11:02:10 AM)

Would be easier to see what problem is if you attach the scenario?
The error should report what line the error occurred on.




Fer_Cabo -> RE: Trouble with LUA / Activation & Deactivation of No-Navigation Zones (6/9/2017 11:11:38 AM)

Thanks Michael, but the error only reports unexpected character in position 148 (no line reference - besides, there are only 3 lines in the script).

Thought it could be a typo just like using some Capital letters: GetNonavzone vs. getnonavzone, but doesn't work either




michaelm75au -> RE: Trouble with LUA / Activation & Deactivation of No-Navigation Zones (6/9/2017 11:33:04 AM)

I assume you are using the latest version (1.12+)
The " isn't needed around the false.

If you can zip and attach the scenario, I can probably give a clearer answer.
I don't know it is just how it shows, but the quotes marks around DRPK and PRCSOVEREIGN seem to be different.
mySide = VP_GetSide({Name=DPRK})
myZone = mySide:getnonavzone(PRCSOVEREIGN)

Try using the single quote ' instead.




Fer_Cabo -> RE: Trouble with LUA / Activation & Deactivation of No-Navigation Zones (6/10/2017 12:26:49 PM)

mySide = VP_GetSide({Name="DPRK"})
myZone = mySide:getnonavzone("PRCSOVEREIGN")
myZone.isactive = False

It works like this!

Thanks a lot!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.8125