SRL Archive - Other Scripts

FindColorSkipCoords


Freddy1990

2006-05-21 10:24:20

Well, I made them first colorfinding functions cuz i was bored, so I started thinking and came up with this, this will find a color, ignoring all coordinates in the specified TPointArray.

function FindColorSkipCoords(var x, y: Integer; color, x1, y1, x2, y2: Integer; skipcoords: TPointArray): Boolean;
var
p1, p2: TPoint;
tmpColor, a: integer;
skipB: Boolean;
begin
if(x1 < x2)then begin p1.x := x1; p2.x := x2; end else begin p1.x := x2; p2.x := x1; end;
if(y1 < y2)then begin p1.y := y1; p2.y := y2; end else begin p1.y := y2; p2.y := y1; end;
Result := False;
for x := p1.x to p2.x do
begin
for y := p1.y to p2.y do
begin
skipB := False;
tmpColor := GetColor(x, y);
for a := 0 to GetArrayLength(skipcoords) - 1 do
begin
if(skipcoords[a].x = x)and(skipcoords[a].y = y)then skipB := True;
end;
if(GetColor(x, y) = color)and(skipB = False)then
begin
Result := True;
Exit;
end;
end;
end;
end;

(BTW: It's tested if anyone would doubt it works.)

Dankness

2006-05-21 10:26:22

that looks pretty useful actually.

Cheesehunk

2006-05-21 15:42:04

From: Dankness
that looks pretty useful actually.


It looks very useful, good job Freddy! Are you getting back into SCAR scripting again?

Freddy1990

2006-05-21 17:19:53

Yeah, prolly, since clients are currently pretty dead I currently have no use of expanding my java skills anymore