find properties of a reference point to allow changing the rp

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
orca
Posts: 545
Joined: Wed Nov 06, 2013 4:59 pm

find properties of a reference point to allow changing the rp

Post by orca »

I am trying to find the longitude and latitude of a reference point.

This seems to work.
local rp = ScenEdit_GetReferencePoint({side='Axis', name='test'})
I can then print(rp) and get the properties such as latitude, longitude, etc in the lua consule. But I don't know how to use these printed values into a new script.

So my question is, how do I get the specific value for the latitude of that local rp so that I can then plug this value into a different script. My intention is to use this value in a ScenEdit_SetReferencePoint script to change the location of the latitude and longitude for the local rp using something like this:

local newrplatitude=currentrplatitud + 1
ScenEdit_SetReferencePoint({side='Axis', guid='2QQSQX-0HM2MDDRD4568', latitude=newrplatitud})
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: find properties of a reference point to allow changing the rp

Post by KnightHawk75 »

local rp = ScenEdit_GetReferencePoint({side='Axis', name='test'})
local storedLat = rp.latitude + 1.0;
local storedLon = rp.longitude -1.0;

ScenEdit_SetReferencePoint( {side='Axis', guid='2QQSQX-0HM2MDDRD4568', latitude=storedLat, longitude=storedLon} )

or in a more in-line manner..

local rp = ScenEdit_GetReferencePoint({side='Axis', name='test'})
ScenEdit_SetReferencePoint( {side='Axis', guid='2QQSQX-0HM2MDDRD4568', latitude=(rp.latitude + 1.0), longitude=(rp.longitude - 1.0)} )

Post Reply

Return to “Lua Legion”