Author Topic: ABL scripting error  (Read 1190 times)

0 Members and 1 Guest are viewing this topic.

Offline Drewbs

  • 24
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?

 

Offline tisi

  • 21
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:

Code: [Select]
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:
Code: [Select]
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:

Code: [Select]
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

 

Offline magic

  • Moderator
  • 211
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)

 

Offline Drewbs

  • 24
Thanks guys! Works like a charm now!