SRL Archive - SRL Archives

FindAkBuildingColor;


XcanadamanX

2007-05-09 15:57:10

I didnt find an al kharid building autocolorer so i made one myself. based off of tara's(actually is but changed values) autocolorers.
anyway here it is. i donno if it works in other places. didnt want to test since my chars are not anywhere else other than fally and ak.
tell me if it works anywhere else.
there is also a cactuscolorfinder below

function FindAkBuildingColor: Integer;
var
GenericColor, a, b, TestColor, Red, Green, Blue : integer;
begin
GenericColor := 6193293;
Flag;
a := MMX1;
b := MMY1;
repeat
b := b + 1;
repeat;
a := a + 1;
if FindColorTolerance(x, y, GenericColor, a, b, MMX2, MMY2, 50) then
begin
if a = MMX1 + 1 then b := y;
a := x;
TestColor := GetColor(x, y);
red := (TestColor mod 256);
green := ((TestColor / 256) mod 256);
blue := ((TestColor / 256) / 256);
//writeln(inttostr(testcolor))
//Writeln(inttostr(red - green)+' '+ inttostr(red - blue)+' '+inttostr(green - blue))
if Red - Green >= 0 then if Red - Green <= 14 then
if Red - Blue >= 42 then if Red - Blue <= 50 then
if Green - Blue >= 30 then if Green - Blue <= 50 then
begin
if GetColor(a + 2, b + 2) = TestColor then
if GetColor(a + 1, b + 1) = TestColor then
if GetColor(a, b + 2) = TestColor then
if GetColor(a + 2, b) = TestColor then
if GetColor(a, b + 1) = TestColor then
if GetColor(a + 1, b) = TestColor then
if GetColor(a + 1, b + 2) = TestColor then
if GetColor(a + 2, b + 1) = TestColor then
begin
Result := TestColor;
AkBuildingColor := TestColor;
WriteLn('AkBuildingColor = ' +
IntToStr(TestColor));
Exit;
end;
end;
end else a := MMX2;
until a >= MMX2;
a := MMX1;
until b >= MMY2;
WriteLn('Could not find AKBuildingColor!');
Result := 0;
end;

edit: and heres another autocolor func FindCactusColor

function FindCactusColor: Integer;
var
GenericColor, a, b, TestColor, Red, Green, Blue : integer;
begin
GenericColor := 3632957;
Flag;
a := MMX1;
b := MMY1;
repeat
b := b + 1;
repeat;
a := a + 1;
if FindColorTolerance(x, y, GenericColor, a, b, MMX2, MMY2, 50) then
begin
if a = MMX1 + 1 then b := y;
a := x;
TestColor := GetColor(x, y);
red := (TestColor mod 256);
green := ((TestColor / 256) mod 256);
blue := ((TestColor / 256) / 256);
if Green - Red >= 28 then if Green - Red <= 60 then
if Red - Blue >= 1 then if Red - Blue <= 33 then
if Green - Blue >= 40 then if Green - Blue <= 78 then
begin
if GetColor(a + 1, b + 1) = TestColor then
if GetColor(a, b + 1) = TestColor then
if GetColor(a + 1, b) = TestColor then
begin
Result := TestColor;
CactusColor := TestColor;
WriteLn('Cactus Color = ' +
IntToStr(TestColor));
Exit;
end;
end;
end else a := MMX2;
until a >= MMX2;
a := MMX1;
until b >= MMY2;
WriteLn('Could not find Cactus Color!');
Result := 0;
end;


hope you like it.;)