SCAR Code:
program UniversalTPA;
{.include SRL/SRL.scar}
var
H, S, L, HueMod, SatMod, RoundedTolerance: Extended;
MidColour, i, ii, z, z1, z2, z3: integer;
HueString, SatString, LetsGo: string;
HSLColor: Array[1..3] of Extended;
HSL: Array[0..1] of Array[1..3] of Extended;
Colors: TIntegerArray;
ColourVariable: array [0..3] of integer;
UpTextz: array of string;
procedure DeclarePlayers;
begin
HowManyPlayers := 1; //How many Players
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; //Starting Player
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Integers[0]:= 50; // Loads to Do.
Players[0].Integers[1] := 60; // Minutes before sleeping (1 player ONLY; Set 'True' below if you want this active)
Players[0].Booleans[0] := True; // Do you want to sleep? Reduces Randoms
Players[0].Strings[0] := 'normal';
end;
procedure GetColourVariables;
begin
if not (LoggedIn) then
Exit;
case lowercase(Players[CurrentPlayer].Strings[0]) of
'normal':
begin
ColourVariable[0] := 3241318;
ColourVariable[1] := 2119755;
ColourVariable[2] := 2645844;
ColourVariable[3] := 3240035;
UpTextz := ['Tree', 'Tre', 'ree'];
end;
'oak':
begin
ColourVariable[0] := 2584416;
ColourVariable[1] := 3305828;
ColourVariable[2] := 4162678;
ColourVariable[3] := 5544845;
UpTextz := ['Oak', 'Oa', 'ak'];
end;
'willow':
begin
ColourVariable[0] := 2181686;
ColourVariable[1] := 6193521;
ColourVariable[2] := 3755332;
ColourVariable[3] := 3234376;
UpTextz := ['Willow', 'Will', 'illo', 'llow'];
end;
'maple':
begin
ColourVariable[0] := 1319487;
ColourVariable[1] := 725796;
ColourVariable[2] := 2177124;
ColourVariable[3] := 1385537;
UpTextz := ['Maple', 'Map', 'apl', 'ple'];
end;
'yew':
begin
ColourVariable[0] := 3241318;
ColourVariable[1] := 2119755;
ColourVariable[2] := 2645844;
ColourVariable[3] := 3240035;
UpTextz := ['Yew', 'Ye', 'ew'];
end;
end;
end;
procedure ColourToZ;
begin
GetColourVariables;
z := ColourVariable[0];
z1 := ColourVariable[1]
z2 := ColourVariable[2];
z3 := ColourVariable[3];
end;
procedure WorkOutTheMods;
//By MastaRaymond and BazzBarrett, Modified by TorrentOfFlame for this script
begin
ColourToZ;
Colors := [z, z1, z2, z3];
for i := 1 to 3 do
begin
HSL[0][i] := 255; //Max is 240?
end;
for i := 0 to High(Colors) do
begin
ColortoHSL(Colors[i], HSLColor[1], HSLColor[2], HSLColor[3]);
for ii:= 1 to 3 do
begin
HSL[0][ii] := MinE(HSLColor[ii], HSL[0][ii]);
HSL[1][ii] := MaxE(HSLColor[ii], HSL[1][ii]);
end;
end;
H := HSL[1][1] - HSL[0][1];
S := HSL[1][2] - HSL[0][2];
L := HSL[1][3] - HSL[0][3];
LetsGo := FloatToStr(H);
Writeln('H := ' + LetsGo +'.');
MidColour := HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2);
HueMod := (H/L);
SatMod := (S/L);
RoundedTolerance := Round(L);
HueString := FloatToStr(HueMod);
SatString := FloatToStr(SatMod);
Setlength(HueString, 4);
Setlength(SatString, 4);
Writeln('Hue Mod '+ HueString +'');
Writeln('Sat Mod '+ SatString +'');
Writeln('Tolerance ' + inttostr(round(RoundedTolerance + 0.2)) +'');
end;
function AllTPAs(x, y: Integer): Boolean;
var
CTS, i: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(HueMod, SatMod);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, MidColour, MSX1, MSY1, MSX2, MSY2, 17);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
for i := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);
if(IsUpTextMultiCustom([UpTextz])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;
begin
WorkOutTheMods;
end.