SRL Archive - SRL Archives

Some Auto-Colours


Daniel

2009-08-30 09:46:19

Well, here are some auto-colours that i have used and work perfectly. But, i don't really need them anymore. So, here ya' guys go ;):

Append to \SRL\Core\AutoColor.scar:

{*******************************************************************************
function FindCactusColour: Integer;
By: Dan's The Man
Description: Autodetects the green cactus colour of a cactus.
*******************************************************************************}
function FindCactusColour: Integer;
var
TPA: TPointArray;
i, bI, TemporaryCTS: Integer;
BakColour: Integer;
Red, Green, Blue: Integer;
begin
TemporaryCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 1925696, MMX1, MMY1, MMX2, MMY2, 35);
bI := High(TPA);
if(bI + 1 > 0) then
begin
for i := 0 to bI do
begin
BakColour := GetColor(TPA[i].X, TPA[i].Y);
ColorToRGB(BakColour, Red, Green, Blue);
if(InRange(Red, 45, 85)) then
if(InRange(Green, 75, 120)) then
if(InRange(Blue, 5, 55)) then
if(GetColor(TPA[i].X + 5, TPA[i].Y) = BakColour) then
if(GetColor(TPA[i].X + 5, TPA[i].Y + 1) = BakColour) then
if(GetColor(TPA[i].X + 1, TPA[i].Y + 1) = BakColour) then
if(GetColor(TPA[i].X + 2, TPA[i].Y) = BakColour) then
if(GetColor(TPA[i].X + 2, TPA[i].Y + 1) = BakColour) then
begin
Result := BakColour;
Writeln('Cactus colour found: ' + IntToStr(BakColour));
Exit;
end;
end;
Writeln('Found a relating cactus colour, but not the one we'#39're looking for :(');
ColorToleranceSpeed(TemporaryCTS);
Exit;
end;
Writeln('Could not find any cactus colours.');
ColorToleranceSpeed(TemporaryCTS);
end;

{*******************************************************************************
function FindMMFurnaceColour: Integer;
By: Dan's The Man
Description: Autodetects the grey furnace colour of the furnace symbol.
*******************************************************************************}
function FindMMFurnaceColour: Integer;
var
TPA: TPointArray;
i, bI, TemporaryCTS: Integer;
BakColour: Integer;
Red, Green, Blue: Integer;
begin
TemporaryCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 3620683, MMX1, MMY1, MMX2, MMY2, 15);
bI := High(TPA);
if(bI + 1 > 0) then
begin
for i := 0 to bI do
begin
BakColour := GetColor(TPA[i].X, TPA[i].Y);
ColorToRGB(BakColour, Red, Green, Blue);
if(InRange(Red, 60, 90)) then
if(InRange(Green, 60, 70)) then
if(InRange(Blue, 45, 65)) then
if(GetColor(TPA[i].X + 1, TPA[i].Y) = BakColour) then
if(GetColor(TPA[i].X + 2, TPA[i].Y) = BakColour) then
begin
Result := BakColour;
Writeln('MM Furnace colour found: ' + IntToStr(BakColour));
ColorToleranceSpeed(TemporaryCTS);
Exit;
end;
end;
Writeln('Found a relating MM Furnace colour, but not the one we'#39're looking for :(');
ColorToleranceSpeed(TemporaryCTS);
Exit;
end;
Writeln('Could not find any MM Furnace colours.');
ColorToleranceSpeed(TemporaryCTS);
end;

{*******************************************************************************
function FindMMBankColour: Integer;
By: Dan's The Man
Description: Autodetects the gold bank symbol colour of the bank symbol.
*******************************************************************************}
function FindMMBankColour: Integer;
var
TPA: TPointArray;
i, bI, TemporaryCTS: Integer;
BakColour: Integer;
Red, Green, Blue: Integer;
begin
TemporaryCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 2215920, MMX1, MMY1, MMX2, MMY2, 2);
bI := High(TPA);
if(bI + 1 > 0) then
begin
for i := 0 to bI do
begin
BakColour := GetColor(TPA[i].X, TPA[i].Y);
ColorToRGB(BakColour, Red, Green, Blue);
if(InRange(Red, 235, 245)) then
if(InRange(Green, 200, 210)) then
if(InRange(Blue, 30, 35)) then
if(GetColor(TPA[i].X + 1, TPA[i].Y) = BakColour) then
if(GetColor(TPA[i].X + 2, TPA[i].Y) = BakColour) then
begin
Result := BakColour;
Writeln('MM Bank colour found: ' + IntToStr(BakColour));
ColorToleranceSpeed(TemporaryCTS);
Exit;
end;
end;
Writeln('Found a relating MM Bank colour, but not the one we'#39're looking for :(');
ColorToleranceSpeed(1);
Exit;
end;
Writeln('Could not find any MM Bank colours.');
ColorToleranceSpeed(TemporaryCTS);
end;

Hope that you MIGHT find these useful :p