SCAR Code:
program AutoColorer;
{
By : Jethr0x
}
var
R, G, B,
RGl, RGh, RBl, RBh, GBl, GBh,
SH1, SHh, LHl, LHh, HLl, HLh,
XYl, XYh, YZl, YZh : Integer;
H,S,L,X,Y,Z : Extended;
const
NameofFunct = 'FindTreeColor'; // What is the name of the function you are making?
OutputName = 'TreeColor'; // The Output... Outputname = Color.. like WaterColor = 1223124.
Error = ('Could not find ' + OutputName);
Color = 2247283; // set your color
begin
{ Breaks Down your Color }
ColorToRGB(Color, R, G, B);
ColorToHSL(Color, H, S, L);
ColorToXYZ(Color, X, Y, Z);
{ STARTS CALULATING! }
RGl := (R - G) - 20;
RGh := (R - G) + 20;
RBl := (R - B) - 20;
RBh := (R - B) + 20;
GBl := (G - B) - 20;
GBh := (G - B) + 20;
SH1 := (Round(S) - Round(H)) - 15;
SHh := (Round(S) - Round(H)) + 15;
LHl := (Round(L) - Round(H)) - 15;
LHh := (Round(L) - Round(H)) + 15;
HLl := (Round(H) - Round(L)) - 15;
HLh := (Round(H) - Round(L)) + 15;
XYl := (Round(X) - Round(Y)) - 7;
XYh := (Round(X) - Round(Y)) + 7;
YZl := (Round(Y) - Round(Z)) - 7;
YZh := (Round(Y) - Round(Z)) + 7;
{ Begins the Autocolor Output... }
Writeln('******************************************************************');
Writeln('~~~~~ Jethr0x''s AutoColorer v1! Fill in the color and watch! ~~~~~');
Writeln('******************************************************************');
Writeln('function ' +NameofFunct+ ' : Integer;');
Writeln('var');
Writeln(' R,G,B,TestColor : Integer;');
Writeln(' H,S,L : Extended;');
Writeln(' X,Y,Z : Extended;');
Writeln(' MyColor : Integer;');
Writeln(' ColorsTPA : TPointArray;');
Writeln(' C1 : TIntegerArray;');
Writeln(' i,C2: Integer;');
Writeln('begin');
Writeln(' MyColor := ' +IntToStr(Color)+';');
Writeln(' FindColorsSpiralTolerance(MSCX, MSCY, ColorsTPA, MyColor, MMX1, MMY1, MMX2,');
Writeln(' MMY2, 60);');
Writeln(' C1 := GetColors(ColorsTPA);');
Writeln(' C2 := High(C1);');
Writeln(' for i := 0 to C2 do');
Writeln(' begin');
Writeln(' if RS_OnMinimap(ColorsTPA[i].X, ColorsTPA[i].Y) then ');
Writeln(' begin');
Writeln(' TestColor := GetColor(ColorsTPA[i].X, ColorsTPA[i].Y);');
Writeln(' if SimilarColors(TestColor, MyColor, 50) then');
Writeln(' begin');
Writeln(' ColorToRGB(TestColor, R, G, B);');
Writeln(' ColorToHSL(TestColor, H, S, L);');
Writeln(' ColorToXYZ(TestColor, X, Y, Z);');
Writeln(' if InRange(R - G, '+inttostr(RGl) + ', ' +IntToStr(RGh)+ ') then');
Writeln(' if InRange(R - B, ' +IntToStr(RBl)+ ', ' +IntToStr(RBh)+ ') then');
Writeln(' if InRange(G - B, ' +IntToStr(GBl)+ ', ' +IntToStr(GBh)+ ') then');
Writeln(' if InRange(Round(S) - Round(H), '+inttostr(SH1) + ', ' +IntToStr(SHh)+ ') then');
Writeln(' if InRange(Round(L) - Round(H), ' +IntToStr(LHl)+ ', ' +IntToStr(LHh)+ ') then');
Writeln(' if InRange(Round(H) - Round(L), ' +IntToStr(HLl)+ ', ' +IntToStr(HLh)+ ') then');
Writeln(' if InRange(Round(X) - Round(Y), ' +IntToStr(XYl)+ ', ' +IntToStr(XYh)+ ') then');
Writeln(' if InRange(Round(Y) - Round(Z), ' +IntToStr(YZl)+ ', ' +IntToStr(YZh)+ ') then');
Writeln(' if GetColor(ColorsTPA[i].X + 2, ColorsTPA[i].Y + 2)');
Writeln(' = TestColor then');
Writeln(' if GetColor(ColorsTPA[i].X + 1, ColorsTPA[i].Y + 1)');
Writeln(' = TestColor then');
Writeln(' begin');
Writeln(' Writeln(''' +OutPutName+ ' = '' +Inttostr(TestColor));');
Writeln(' Result := TestColor;');
Writeln(' Exit;');
Writeln(' end;');
Writeln(' end;');
Writeln(' end;');
Writeln(' end;');
Writeln(' Writeln(' + Error +');');
Writeln(' Result := 0;');
Writeln(' end;');
Writeln('******************************************************************');
Writeln('~~~~~~~~~~~~~~ Dont forget to credit me! (Jethr0x) ~~~~~~~~~~~~~~~');
Writeln('******************************************************************');
end.