SRL Archive - SRL Archives

CheckBitmap


Ace

2006-05-28 15:35:47

[PHP]function CheckBitmap(iBitmap, x, y : Integer) : Boolean;
var xx,yy,x1,y1,x2,y2 : Integer;
begin
Result := false;
x1 := x - 1;x2 := x + 1;y1 := y - 1;y2 := y + 1;
if (FindBitMapTol(xx,yy,iBitmap,x1,y1,x2,y2)) then
Result := true;
end;[/PHP]

Returns true if the specified bitmap is at the x,y location you supply.

Pyro

2006-05-28 16:08:52

From: Ace
[PHP]function CheckBitmap(iBitmap, x, y : Integer) : Boolean;
var xx,yy,x1,y1,x2,y2 : Integer;
begin
Result := false;
x1 := x - 1;x2 := x + 1;y1 := y - 1;y2 := y + 1;
if (FindBitMapTol(xx,yy,iBitmap,x1,y1,x2,y2)) then
Result := true;
end;[/PHP]

Returns true if the specified bitmap is at the x,y location you supply.


Ahh that would have to have a bitmap height of two and a width of 2 would it not? Also you dont need the result:=false there. Boolean functions are automatically set to false until told otherwise.

Ace

2006-05-28 16:26:10

Uh… You may be right.
However, I think that x1,y1,x2,y2 specify the area to search in. Im assuming that with the inbuilt FindBitmap function by Kait there are two nested loops. One that loops through the full box (specified by x1,y1,x2,y2) and another that loops through the bitmap if a screen pixel matches the first pixel of the bitmap. On that second loop it loops through the current screen location that the first loop got to, plus the width and height values of the specified bitmap… If that's the case (and it most likely is) the parameters I used should work fine because it will really be searching here:
CurrentScreenLocation + bmpWidth + HowFarInTheBitmapWeveGone;
CurrentScreenLocation + bmpHeight + HowFarInTheBitmapWeveGone;
and not
CurrentScreenLocation +  HowFarInTheBitmapWeveGone;
CurrentScreenLocation + HowFarInTheBitmapWeveGone;
But maybe im wrong. Maybe Kait used some obscure way to do it.

And thanks for telling me about the result thing. I didnt know. :)