Ok so I'm making a yew cutter and I'm making the Ent finding function right now. I was thinking of doing something that I saw in a thread a while back.
What I'm trying to do is get a bitmap of the yew tree (or just get the position of points of a particular colour) then checking a bit later to see if the points have changed. This is what I have so far:
SCAR Code:
function FindEnt(ax, ay: Integer): Boolean;
var
TempBMP, NoPts, CTS, x1, y1, x2, y2, Dist: Integer;
Pts, CPts: TPointArray;
TP: TPoint;
TempBool: Boolean;
begin
Dist := 50; //Dist either side, up or down of the centre point
if (not(LoggedIn)) then Exit;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
NoPts := 0;
x1 := ax - Dist; y1 := ay - Dist; x2 := ax + Dist; y2 := ay + Dist;
if (x1 < 0) then x1 := 0; if (y1 < 0) then y1 := 0;
TempBMP := BitmapFromString(x2 - x1, y2 - y1, '');
CopyClientToBitmap(TempBMP, x1, y1, x2, y2);
{FindColorsTolerance(Pts, YewColour, ax - 25, ay - 25, ax + 25, ay + 25, 20);
if (Length(Pts) = 0) then
begin
WriteLn('Something wrong with this colour/range/tolerance Zeph...');
FreeBitmap(TempBMP);
Exit;
end;
for i := 0 to High(Pts) do
begin
TP := Pts[i];
FastSetPixel(TempBMP, TP.x, TP.y, GetColor(TP.x, TP.y));
end; }
Wait(100);
FindColorsTolerance(CPts, YewColour, x1, y1, x2, y2, 20);
for i := 0 to High(CPts) do
begin
TP := CPts[i];
if (not(FastGetPixel(TempBMP, TP.x, TP.y) = GetColor(TP.x, TP.y))) then //Why do I get an access violation error???
Inc(NoPts);
end;
try
if (NoPts / Length(CPts) * 100 > 50) then TempBool := True; //if 50% of the pixels have changed
except TempBool := True; end;
if (TempBool) then
begin
WriteDebug('Possible Ent detected...');
if (not(IsUpText('ew'))) then MMouse(ax, ay, 5, 5);
Result := (IsUpTextYellow('ew')) and (IsEntInClosestSymbol); //if the uptext is yellow or if the yellow NPC dot is in the tree symbol
end;
FreeBitmap(TempBMP);
ColorToleranceSpeed(CTS);
end;
The problem is that I keep getting an access violation error on the line with the FastGetColor. I have no idea why. Could someone please help or suggest a better way of doing this. 
I thank you in advance...
Zeph