I need to count an item in my inventory. I don't want to use a DTM if I don't have to because I'm trying to just use tpa's.
Here's the code:
SCAR Code:
function FlaxAmount: Integer;
var x, y, i,a: Integer; iBox: TBox; Arr: array of TPoint;
begin
if not LoggedIn then Exit;
for i := 1 to 28 do
begin
iBox := InvBox(i);
Arr := GetColorPoints(x, y, 12433750, iBox.x1, iBox.y1, iBox.x2, iBox.y2, 1, 1, 10);
if Length(Arr) > 5 then
Inc(Result);
end;
end;
I am testing with only 1 flax in my inventory and it is in the second slot.
For some reason, the function keeps returning 0 or 27 or 14.
Any thoughts?
For those wondering:
SCAR Code:
{*******************************************************************************
function GetColorPoints(x, y, Color, bp1, bp2, bp3, bp4, Width, Height, Tol: Integer): TPointArray;
By: NCDS
Description: Finds and Stores points defined by 'Color' and bp[1..4].
Also checks width, height and allows for tolerance.
*******************************************************************************}
GetColorPoints(); works fine, I use it in many other functions.