Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

LUA Error

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> LUA Error Page: [1]
Login
Message << Older Topic   Newer Topic >>
LUA Error - 1/1/2019 1:41:09 PM   
Tecmeister

 

Posts: 27
Joined: 12/11/2006
Status: offline
Help!!

I've been working on fixing this error for a few months with no luck. I have a technical background but no programming experience. Lua looks like it can be simple, and built up to complex tasks, but I'm missing something and can't figure out what.

This scenario is predicated on the US getting tired of China's actions in the South China Sea. The Navy is sent in along with ground based air assets, and after destroying everything that tries to stop them, invading and capturing Woody Island.

Once the Amphib task group (I've removed all other assets on both side for simplicity) is stationed in the box south of Woody, (Ref Pts 2720-2723) undock the 4 LCAC's and move them into the tiny patrol area next to Woody, Ref Pts 2724-2727. The LCAC's need to be in the patrol area for 30 minutes to fire the Capture Woody script.

All the info I've found for SetUnitSide seems right, but it's not, I always get an error "Lua script execution error: [string "Capture Woody"]:1: ')' expected near 'Island'".

The attached save is after the Amphibs reach their patrol area, so all that's left to do is move the LCAC's.

Can someone show me what I'm missing? I'd like to test and them upload the whole scenario for other players to try.

Thanks,

Tecmeister

Attachment (1)
Post #: 1
RE: LUA Error - 1/1/2019 2:26:22 PM   
stilesw


Posts: 1497
Joined: 6/26/2014
From: Hansville, WA, USA
Status: offline
Tecmeister,

May have found your Lua problem. You used:
ScenEdit_SetUnitSide (China, Woody Island, United States)

Coincidentally, I was doing a similar thing with Woody Island some time back and found this code works:

ScenEdit_SetUnitSide({side="PRC", name="Woody Island Air Strip", newside="USN"})

So, it appears to have been a problem with identifiers (side, name, newside) and quotes.

Hope this helps,

-Wayne

(in reply to Tecmeister)
Post #: 2
RE: LUA Error - 1/1/2019 4:33:26 PM   
Tecmeister

 

Posts: 27
Joined: 12/11/2006
Status: offline
Wayne,

Thanks for the quick reply. Tried your update above, but no joy. Any other ideas are welcome, and Thanks Again!

Bruce

(in reply to stilesw)
Post #: 3
RE: LUA Error - 1/1/2019 5:30:58 PM   
Whicker

 

Posts: 664
Joined: 6/20/2018
Status: offline
you just have multiple formatting errors, this works in your save in the lua console:

ScenEdit_SetUnitSide({side='China', name='Woody Island', newside='United States'})

- you have a space after ScenEdit_SetUnitSide
- you are missing the curly brackets {}
- you are not giving the parameter/identifier or whatever you call it - name=, side=, newside=
- you didn't enclose your strings in quotes - the name and sides in this context are strings, and strings are always enclosed in quotes - single or double, either works as long as they are paired.

< Message edited by Whicker -- 1/1/2019 5:33:58 PM >

(in reply to Tecmeister)
Post #: 4
RE: LUA Error - 1/1/2019 5:33:01 PM   
Whicker

 

Posts: 664
Joined: 6/20/2018
Status: offline
it may take a second or two of game time to update properly.

(in reply to Whicker)
Post #: 5
RE: LUA Error - 1/5/2019 3:22:00 PM   
Tecmeister

 

Posts: 27
Joined: 12/11/2006
Status: offline
Whicker,

That's excellent, worked the first attempt. I must have tried 30 different attempts to make that work. Most of the LUA docs I found (including the Command LUA Documentation web page)didn't include the curly brackets in their examples, so I assumed (yeah, I know...) that they were for illustrative purposes. A thousand Thank-You's!!

Bruce

(in reply to Whicker)
Post #: 6
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> LUA Error Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.813