Hard Light Productions Forums
Hosted Projects - Non-FreeSpace => MechCommander OmniTech => Topic started by: Drewbs on August 22, 2018, 01:55:19 pm
-
I am encountering another syntax error for IsWithinArea. I have:
if (IsWithinArea(VongL1a, -6976.0, -320.0, 0.0, 50.0) : true) then
The ABL library has:
IsWithinArea(UnitID, position Point, real Radius) : boolean;
// UnitID(from GetUnitMates(SquadID,Array); , 3-point array or worldposition with xyz, range in meters
What am I doing wrong?
-
I'm new to this forum and haven't used the ABL scripts yet, but I have some general programming knowledge and any interpreter woud read your current line as this:
IsWithinArea(VongL1a, -6976.0, -320.0, 0.0, 50.0) : true
IsWithinArea(UnitID, position Point, real Radius) : boolean
where the variables are read like this:
UnitID = VongL1a
position Point (expects array) = -6976,0
real Radius = -320.0
because of the way the commas are used
you could try something like:
IsWithinArea(VongL1a, (-6976.0, -320.0, 0.0), 50.0) : true
either way, the function expects an array (however the syntax for arrays is in this language) between the first and second comma within the parantheses
-
position type is the user data type (array (3) in abl script.
It has integerl values:
x (x coord),
y,
z (usually 0);
declaration:
Position aPoint;
assign data:
aPoint[0] = 6293;
aPoint[1] = 6464;
aPoint[2] = 0;
Pass the variable to the function:
IsWithinArea(VongL1a, aPoint, 50.0)
-
Thanks guys! Works like a charm now!