Lua help

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
ddural
Posts: 21
Joined: Thu Apr 07, 2011 12:22 pm

Lua help

Post by ddural »

I'm trying to learn this code. I am just trying to figure out how to make a radar come on at a certain time. When i try to fill in the blanks, I get a error message that says:

ScenEdit_SetEMCON 0 : ,Unable to identify EMCON subject type! Valid inputs are: Side / Mission /Group / Unit

I am trying to turn on a {name='Radar (Big Bird D [91N6])', guid='683ed749-f8d4-4874-af76-13f9924a186a'}

The side is CHINA

How do I fill in the blanks for below?


ScenEdit_SetEMCON('EMCONSubjectType', 'EMCONSubjectNameOrID', 'EMCONSettings')


ironhand125
Whicker
Posts: 665
Joined: Tue Jun 19, 2018 9:54 pm

RE: Lua help

Post by Whicker »

ScenEdit_SetEMCON(['Side' / 'Mission' / 'Group' / 'Unit'], ['Side Name or ID' / 'Mission Name or ID' / 'Group Name or ID' / 'Unit Name or ID'], ['Radar/Sonar/OECM=Active/Passive;' / 'Inherit'])

so I think it would be:

ScenEdit_SetEMCON('unit','Radar (Big Bird D [91N6])','Radar=Active' )

https://commandlua.github.io/index.html ... t_SetEMCON
ddural
Posts: 21
Joined: Thu Apr 07, 2011 12:22 pm

RE: Lua help

Post by ddural »


I typed this: ScenEdit_SetEMCON('unit'radar, '{name='Radar (Big Bird D [91N6])', guid='88e75020-b060-4d21-af5b-2d132a37b125'}', 'Radar=active')

And I got this message: >> ScenEdit_SetEMCON('unit'radar, '{name='Radar (Big Bird D [91N6])', guid='88e75020-b060-4d21-af5b-2d132a37b125'}', 'Radar=active')

ERROR: [string "Console"]:1: ')' expected near 'radar'
ironhand125
Whicker
Posts: 665
Joined: Tue Jun 19, 2018 9:54 pm

RE: Lua help

Post by Whicker »

did you try what I have above?
the name is not a table, just the name in quotes - no guid, no curly brackets.
ddural
Posts: 21
Joined: Thu Apr 07, 2011 12:22 pm

RE: Lua help

Post by ddural »

Yes I just tried and it worked. Thank you. I will try this for a while, then i will try random on off radars. I just need to fill in the right stuff. Practice, practice.
ironhand125
Post Reply

Return to “Lua Legion”