Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Getting Highlighted Reference Points

 
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 >> Getting Highlighted Reference Points Page: [1]
Login
Message << Older Topic   Newer Topic >>
Getting Highlighted Reference Points - 3/19/2020 10:07:57 PM   
bearhunter007

 

Posts: 23
Joined: 3/11/2017
Status: offline
The code below works as far as getting the number of Reference points and whether they are highlighted. It fails on the logic test of whether zz='Yes'. What am I missing?



--Get all Highlighted Reference Points
local u = VP_GetSide({Side ='Vietnam'}) -- a side object
--print(u.rps)

tbl={}
tbl=u.rps
--print(tbl)
local count = 0
for _ in pairs(tbl) do
count = count + 1
end
print(count)


for i=1, count do
if u.rps~=nil then
local zz=u.rps.highlighted
print(zz)
if zz=='Yes' then
print(u.rps) -- ***This is not getting printed***
end
end
end
Post #: 1
RE: Getting Highlighted Reference Points - 3/20/2020 12:49:10 AM   
Eboreg

 

Posts: 230
Joined: 3/14/2019
Status: offline
Change "if zz == 'Yes'" to "if zz == true"

(in reply to bearhunter007)
Post #: 2
RE: Getting Highlighted Reference Points - 3/20/2020 2:28:03 AM   
bearhunter007

 

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

Thanks for the reply. I initially tried 'true' but it did not work.


(in reply to Eboreg)
Post #: 3
RE: Getting Highlighted Reference Points - 3/20/2020 3:27:19 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Simple test to validate
quote:

local a = ScenEdit_GetReferencePoint({side='1',name='rp-7'})
print(a.highlighted)
if a.highlighted == true then
print('Highlighted')
end


_____________________________

Michael

(in reply to bearhunter007)
Post #: 4
RE: Getting Highlighted Reference Points - 3/20/2020 3:29:25 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
BTW, when printing 'boolean' types, they usually come out 'Yes' or 'No'. But you test them against proper values (true/false)

_____________________________

Michael

(in reply to michaelm75au)
Post #: 5
RE: Getting Highlighted Reference Points - 3/20/2020 6:15:35 PM   
bearhunter007

 

Posts: 23
Joined: 3/11/2017
Status: offline
Thanks Michael I realized I had several syntax errors.

Here is the corrected code that works:

--Get all Highlighted Reference Points
local u = VP_GetSide({Side ='Vietnam'}) -- a side object
--print(u.rps)

tbl={}
tbl=u.rps
--print(tbl)
local count = 0
for _ in pairs(tbl) do
count = count + 1
end
print(count)


for i=1, count do
if u.rps~=nil then
local z=u.rps.highlighted==true
if z==true then print(u.rps) end
end
end

(in reply to michaelm75au)
Post #: 6
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Getting Highlighted Reference Points 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.656