Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Syntax 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 >> Syntax Error Page: [1]
Login
Message << Older Topic   Newer Topic >>
Syntax Error - 1/9/2022 11:37:37 PM   
bearhunter007

 

Posts: 23
Joined: 3/11/2017
Status: offline
I have used the following code with success in the old version ie. command: modern naval/air ops.

However with the new version I get the following:

ERROR: [string "Console"]:3: syntax error near 'u'

local u= ScenEdit_GetReferencePoint({guid='9QYU5K-0HMEJJLE87IL2'})
print u

I don't get what the error is referring too.

Thanks
Post #: 1
RE: Syntax Error - 1/10/2022 1:07:07 AM   
bearhunter007

 

Posts: 23
Joined: 3/11/2017
Status: offline
Not content with dealing with the above issue I tried Jan Masterson's code for a circle of units

I get the following error: unexpected symbol near '<\226>'

function draw_circle_of_units(a,b,t,txt)
if txt == nil then
txt = ""
end
t = t - 1
lat1 = a.latitude
lon1 = a.longitude
lat2 = b.latitude
lon2 = b.longitude
dlat = math.abs(lat2-lat1)
dlon = math.abs(lon2-lon1)
r = math.sqrt(dlat*dlat + dlon*dlon)
for i=0,t-1 do
th = 2 * math.pi * i / t
rlat = lat1 + r * math.sin(th)
rlon = lon1 + r * math.cos(th)
ScenEdit_AddUnit({
side='PlayerSide',
type = 'Facility',
dbid = 62,
name=txt,
lat=rlat,
lon=rlon,
heading = th * 180.0 / 3.14159})
end
end

local unit = ScenEdit_GetUnit({name=”Arty”,side=”China”}) --compiler flags this line
draw_circle_of_units({latitude=unit.latitude, longitude=unit.longitude},{latitude=unit.latitude + .1, longitude=unit.longitude}, 6, “EDSA 9/50”)

I would appreciate any help since I never had this problem in the old CMANO program.

< Message edited by bearhunter007 -- 1/10/2022 1:11:23 AM >

(in reply to bearhunter007)
Post #: 2
RE: Syntax Error - 1/10/2022 7:12:51 AM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline

quote:

ORIGINAL: bearhunter007

I have used the following code with success in the old version ie. command: modern naval/air ops.

However with the new version I get the following:

ERROR: [string "Console"]:3: syntax error near 'u'

local u= ScenEdit_GetReferencePoint({guid='9QYU5K-0HMEJJLE87IL2'})
print u

I don't get what the error is referring too.

Thanks

print(u)

(in reply to bearhunter007)
Post #: 3
RE: Syntax Error - 1/10/2022 7:20:30 AM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
I receive no such error and the units are created in a circle when executing...

local function draw_circle_of_units(a,b,t,txt)
  if txt == nil then txt = "" end
  t = t - 1
  lat1 = a.latitude
  lon1 = a.longitude
  lat2 = b.latitude
  lon2 = b.longitude
  dlat = math.abs(lat2-lat1)
  dlon = math.abs(lon2-lon1)
  r = math.sqrt(dlat*dlat + dlon*dlon)
  for i=0,t-1 do
    th = 2 * math.pi * i / t
    rlat = lat1 + r * math.sin(th)
    rlon = lon1 + r * math.cos(th)
    ScenEdit_AddUnit({
      side='PlayerSide',
      type = 'Facility',
      dbid = 62,
      name=txt,
      lat=rlat,
      lon=rlon,
      heading = th * 180.0 / 3.14159})
  end
end
local unit = ScenEdit_GetUnit({name="Arty",side="China"}) --compiler flags this line
draw_circle_of_units({latitude=unit.latitude, longitude=unit.longitude},{latitude=unit.latitude + .1, longitude=unit.longitude}, 6, "EDSA 9/50");

So long as side "China" exists, and a unit "Arty" exists on that side.


< Message edited by KnightHawk75 -- 1/10/2022 8:21:20 AM >

(in reply to KnightHawk75)
Post #: 4
RE: Syntax Error - 1/11/2022 12:01:34 AM   
bearhunter007

 

Posts: 23
Joined: 3/11/2017
Status: offline


Thanks for the feedback Knighthawk, it's been some time since I've used LUA.

(in reply to KnightHawk75)
Post #: 5
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Syntax 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.641