RemoveDistTPointArray
PHP Code:
{*******************************************************************************
function RemoveDistTPointArray(x, y, dist: Integer; ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray;
Description: Removes the points that are inside or outside the distance Dist
from the point (x, y) from the TPointArray ThePoints.
*******************************************************************************}
RemoveDistTPointArray, will make a circle of radius 'Dist' with it's center points being situated at cordinates 'x' and 'y'. The 'RemoveHigher' parameter of data type Boolean will remove points inside or outside of the circle.
RemoveHigher is True - Points removed outside the circle of radius 'Dist', points are kept within circle of radius 'Dist'
RemoveHigher is False - Points are kept outside the circle of radius 'Dist', points are removed within circle of radius 'Dist'.
Remember that this is a function so a data type of TPointArray must be assigned to it. It can be used as such:
SCAR Code:
program New;
{.Include SRL/SRL.Scar}
{.include srl/srl/misc/debug.scar}
Var x, y : Integer;
tpa : array of tpoint;
Begin
SetupSRL;
FindColorsTolerance(TPA, 7048347, msx1, msy1, msx2, msy2, 10);
MiddleTPAEx(TPA, x, y);
TPA := RemoveDistTPointArray(x, y, 20, TPA, true); // here
DebugTPA(tpa, '');
End.
What that script will do is find occurances of the color '7048347' in the mainscreen of runescape and find the middle of all those points. It then makes a circle of radius 20 (Dist) around the cordinates x and y of the TPointArray 'TPA'. The last parameter is true, so it will remove the points within the circle, and leave the ones outside of the circle untouched.
More will be explained in due time, in the next section.