SRL Archive - OSR Help

FindColor x, y that doesn't = 0


FrostFyr

2010-06-27 03:11:37

is there a way to find a Changing color on a Single Colored block BG (in my case black or white) thats already built into scar? in my mind it would seem a useful function but i can't find any in the built-in functions list

i've made my own but i was just curious.

function FindNotColor(var x, y: Integer; Color, xs, ys, xe, ye: Integer): Boolean;
var
xx, yy: Integer;
begin
for xx := xs to xe do
for yy := ys to ye do
if GetColor(xx, yy) <> Color then
begin
x := xx;
y := yy;
Result := True;
//If you want it to work faster then you need to
//put Exit; here or something :p
end;
end;

Sex

2010-06-27 03:54:56

Just do
if FindColor(x, y, Color, blah, blah, blah, blah) <> TheNum then
...(it is not the color)

ZephyrsFury

2010-06-27 04:10:17

Maybe:


if (not(FindColor(X, Y, Color, x1, y1, x2, y2))) then
begin
//What happens when it doesn't find the colour
end;


Sex

2010-06-27 04:13:17

^ yeah, that is what I meant. Sorry haven't scripted for a cool minute ;D.

FrostFyr

2010-06-27 10:13:21

Simply, no, if i run that it'll always find false and have the x, y co-ord xe, ye

I want to be able to CLICK the color i'm "not" finding

ZephyrsFury

2010-06-27 10:37:17

I see, well in that case there is no in-built function to do that.

Rich

2010-06-27 12:32:43

if (GetColor(X, Y) <> Colour) then
?

Wizzup?

2010-06-27 13:04:15

From: FrostFyr
Simply, no, if i run that it'll always find false and have the x, y co-ord xe, ye

I want to be able to CLICK the color i'm "not" finding


I don't understand what you want to do. You don't want to find a colour, yet click on it?
E: So you want to loop over all possible pixels, and the first that does NOT match the colour passed, should be clicked?

FrostFyr

2010-06-27 14:54:12

It should do pretty much what the code i provided does:
search a range for any color that doesn't equal the Color variable

and since there's no inbuilt function my question has been answered
Thank you guys