SCAR Code:
function FindMouse : Boolean;
var
MousePoints : TPointArrayArray;
MousePointArray : TPointArray;
CheckPoint : TPoint;
MouseColoursArray : TIntegerArray;
MouseColour, StartTime, MouseTime, X, Y, I : Integer;
CTS : Integer;
begin
CTS := GetColorToleranceSpeed;
MarkTime(StartTime);
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, MousePointArray, 16645629, MSX1, MSY1, MSX2, MSY2, 7);
MousePoints := SplitTPA(MousePointArray, 5);
for I := 0 to High(MousePoints) do
begin
CheckPoint := MiddleTPA(MousePoints[I]);
MouseColour := GetColor(CheckPoint.X, CheckPoint.Y);
MarkTime(MouseTime);
Mouse(CheckPoint.X, CheckPoint.Y, 2, 2, False);
Wait(50 + Random(50));
if ClickOption('ouse', 1) then
begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True);
if not(InIntArray(MouseColoursArray, MouseColour)) then
begin
SetArrayLength(MouseColoursArray, Length(MouseColoursArray) + 1);
MouseColoursArray[High(MouseColoursArray)] := MouseColour;
WriteLn(IntToStr(MouseColour) + ' Added To MouseColour Array');
end;
Result := True;
WriteLn(IntToStr(TimeFromMark(StartTime) - TimeFromMark(MouseTime)));
ColorToleranceSpeed(CTS);
Exit;
end;
end;
end;
SCAR Code:
function FindTree : Boolean;
var
TreePointArray : TPointArrayArray;
TreePoints : TPointArray;
Centre : TPoint;
TreeBox : TBox;
X, Y, I, K, U : Integer;
CTS : Integer;
begin
CTS := GetColorToleranceSpeed;
MarkTime(U);
ColorToleranceSpeed(2);
Centre := IntToPoint(MSCX, MSCY);
FindColorsTolerance(TreePoints, 2910042, MSX1, MSY1, MSX2, MSY2, 10);
TreePointArray := SplitTPA(TreePoints, 20);
SortATPAFrom(TreePointArray, Centre);
K := TimeFromMark(U);
for I := 0 to High(TreePointArray) do
begin
TreeBox := GetTPABounds(TreePointArray[I]);
MMouse((TreeBox.X1 + TreeBox.X2)/2, (TreeBox.Y1 + TreeBox.Y2)/2, 3, 3);
Wait(50 + Random(50));
if IsUpText('hop') then
begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True);
Result := True;
WriteLn(IntToStr(K));
ColorToleranceSpeed(CTS);
Exit;
end;
end;
end;
SCAR Code:
function FindMeanColour(NumberArray : TIntegerArray) : TIntegerArray;
var
I : Integer;
H, S, L : Extended;
R, G, B : Integer;
X, Y, Z : Extended;
HTotal, STotal, LTotal : Extended;
HMean, SMean, LMean : Extended;
RTotal, GTotal, BTotal : Integer;
RMean, GMean, BMean : Integer;
XTotal, YTotal, ZTotal : Extended;
XMean, YMean, ZMean : Extended;
begin
SetArrayLength(Result, 3);
for I := 0 to High(NumberArray) do
begin
ColorToHSL(NumberArray[I], H, S, L);
ColorToRGB(NumberArray[I], R, G, B);
ColorToXYZ(NumberArray[I], X, Y, Z);
HTotal := HTotal + H;
STotal := STotal + S;
LTotal := LTotal + L;
RTotal := RTotal + R;
GTotal := GTotal + G;
BTotal := BTotal + B;
XTotal := XTotal + X;
YTotal := YTotal + Y;
ZTotal := ZTotal + Z;
end;
HMean := HTotal/Length(NumberArray);
SMean := STotal/Length(NumberArray);
LMean := LTotal/Length(NumberArray);
RMean := RTotal/Length(NumberArray);
GMean := GTotal/Length(NumberArray);
BMean := BTotal/Length(NumberArray);
XMean := XTotal/Length(NumberArray);
YMean := YTotal/Length(NumberArray);
ZMean := ZTotal/Length(NumberArray);
Result[0] := HSLToColor(HMean, SMean, LMean);
Result[1] := RGBToColor(RMean, GMean, BMean);
Result[2] := XYZToColor(XMean, YMean, ZMean);
end;
function FindGlobalTolerance(NumberArray : TIntegerArray) : Integer;
var
I : Integer;
begin
for I := 1 to High(NumberArray) do
while not(SimilarColors(NumberArray[I], NumberArray[I - 1], Result)) do
Inc(Result);
end;
procedure FindHSLInfo(NumberArray : TIntegerArray);
var
I : Integer;
H, S, L : TExtendedArray;
R, G, B : TIntegerArray;
X, Y, Z : TExtendedArray;
HSArray, HLArray, SLArray : TExtendedArray;
RBArray, RGArray, GBArray : TIntegerArray;
XYArray, XZArray, YZArray : TExtendedArray;
GenericColourArray : TIntegerArray;
begin
SetArrayLength(H, Length(NumberArray));
SetArrayLength(S, Length(NumberArray));
SetArrayLength(L, Length(NumberArray));
SetArrayLength(R, Length(NumberArray));
SetArrayLength(G, Length(NumberArray));
SetArrayLength(B, Length(NumberArray));
SetArrayLength(X, Length(NumberArray));
SetArrayLength(Y, Length(NumberArray));
SetArrayLength(Z, Length(NumberArray));
SetArrayLength(HSArray, Length(NumberArray));
SetArrayLength(HLArray, Length(NumberArray));
SetArrayLength(SLArray, Length(NumberArray));
SetArrayLength(RGArray, Length(NumberArray));
SetArrayLength(RBArray, Length(NumberArray));
SetArrayLength(GBArray, Length(NumberArray));
SetArrayLength(XYArray, Length(NumberArray));
SetArrayLength(XZArray, Length(NumberArray));
SetArrayLength(YZArray, Length(NumberArray));
for I := 0 to High(NumberArray) do
begin
ColorToHSL(NumberArray[I], H[I], S[I], L[I]);
ColorToRGB(NumberArray[I], R[I], G[I], B[I]);
ColorToXYZ(NumberArray[I], X[I], Y[I], Z[I]);
end;
for I := 0 to High(NumberArray) do
begin
HSArray[I] := H[I] - S[I];
HLArray[I] := H[I] - L[I];
SLArray[I] := S[I] - L[I];
RGArray[I] := R[I] - G[I];
RBArray[I] := R[I] - B[I];
GBArray[I] := G[I] - B[I];
XYArray[I] := X[I] - Y[I];
XZArray[I] := X[I] - Z[I];
YZArray[I] := Y[I] - Z[I];
end;
GenericColourArray := FindMeanColour(NumberArray);
WriteLn('Santy''s HSL Characteristic Finder!');
WriteLn(' ');
WriteLn('Generic HSL Colour : ' + IntToStr(GenericColourArray[0]));
WriteLn('Generic RGB Colour : ' + IntToStr(GenericColourArray[1]));
WriteLn('Generic XYZ Colour : ' + IntToStr(GenericColourArray[2]));
WriteLn('Max Tolerance : ' + IntToStr(FindGlobalTolerance(NumberArray)));
WriteLn(' ');
WriteLn('Min H : ' + FloatToStr(AMinE(H)) + ', Max H : ' + FloatToStr(AMaxE(H)));
WriteLn('Min S : ' + FloatToStr(AMinE(S)) + ', Max S : ' + FloatToStr(AMaxE(S)));
WriteLn('Min L : ' + FloatToStr(AMinE(L)) + ', Max L : ' + FloatToStr(AMaxE(L)));
WriteLn(' ');
WriteLn('Min H - S : ' + FloatToStr(AMinE(HSArray)) + ', Max H - S : ' + FloatToStr(AMaxE(HSArray)));
WriteLn('Min H - L : ' + FloatToStr(AMinE(HLArray)) + ', Max H - L : ' + FloatToStr(AMaxE(HLArray)));
WriteLn('Min S - L : ' + FloatToStr(AMinE(SLArray)) + ', Max S - L : ' + FloatToStr(AMaxE(SLArray)));
WriteLn(' ');
WriteLn('Min R : ' + IntToStr(AMin(R)) + ', Max R : ' + IntToStr(AMax(R)));
WriteLn('Min G : ' + IntToStr(AMin(G)) + ', Max G : ' + IntToStr(AMax(G)));
WriteLn('Min B : ' + IntToStr(AMin(B)) + ', Max B : ' + IntToStr(AMax(B)));
WriteLn(' ');
WriteLn('Min R - G : ' + IntToStr(AMin(RGArray)) + ', Max R - G : ' + IntToStr(AMax(RGArray)));
WriteLn('Min R - B : ' + IntToStr(AMin(RBArray)) + ', Max R - B : ' + IntToStr(AMax(RBArray)));
WriteLn('Min G - B : ' + IntToStr(AMin(GBArray)) + ', Max G - B : ' + IntToStr(AMax(GBArray)));
WriteLn(' ');
WriteLn('Min X : ' + FloatToStr(AMinE(X)) + ', Max X : ' + FloatToStr(AMaxE(X)));
WriteLn('Min Y : ' + FloatToStr(AMinE(Y)) + ', Max Y : ' + FloatToStr(AMaxE(Y)));
WriteLn('Min Z : ' + FloatToStr(AMinE(Z)) + ', Max Z : ' + FloatToStr(AMaxE(Z)));
WriteLn(' ');
WriteLn('Min X - Y : ' + FloatToStr(AMinE(XYArray)) + ', Max X - Y : ' + FloatToStr(AMaxE(XYArray)));
WriteLn('Min X - Z : ' + FloatToStr(AMinE(XZArray)) + ', Max X - Z : ' + FloatToStr(AMaxE(XZArray)));
WriteLn('Min Y - Z : ' + FloatToStr(AMinE(YZArray)) + ', Max Y - Z : ' + FloatToStr(AMaxE(YZArray)));
end;
SCAR Code:
function MakeDDTM(InventorySpot : Integer; ItemName : string) : Boolean;
var
I : Integer;
DDTMBox : TBox;
DDTMMainPoint : TPoint;
DDTMPoints : TPointArray;
DDTMSubPoints : TPointArrayArray;
begin
if not(InRange(InventorySpot, 1, 28)) then
begin
WriteLn('Inventory Spot Must Be Between 1 And 28, Inclusive');
WriteLn('Exiting');
Exit;
end;
DDTMBox := InvBox(InventorySpot);
DDTMMainPoint := ItemCoords(InventorySpot);
FindColorsTolerance(DDTMPoints, 65536, DDTMBox.X1, DDTMBox.Y1, DDTMBox.X2, DDTMBox.Y2, 0);
DDTMSubPoints := TPAToATPA(DDTMPoints, 10);
WriteLn(ItemName + 'Main.X := ' + IntToStr(DDTMMainPoint.X));
WriteLn(ItemName + 'Main.Y := ' + IntToStr(DDTMMainPoint.Y));
WriteLn(ItemName + 'Main.AreaSize := 0');
WriteLn(ItemName + 'Main.AreaShape := 0');
WriteLn(ItemName + 'Main.Color := ' + IntToStr(GetColor(DDTMMainPoint.X, DDTMMainPoint.Y)));
WriteLn(ItemName + 'Main.Tolerance := 255');
for I := 0 to High(DDTMSubPoints) do
begin
WriteLn(' ');
WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].X := ' + IntToStr(DDTMSubPoints[I][0].X));
WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].Y := ' + IntToStr(DDTMSubPoints[I][0].Y));
WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].AreaSize := 0');
WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].AreaShape := 0');
WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].Color := 65536');
WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].Tolerance := 0');
end;
Result := True;
end;
Descriptions :
- FindMouse : Find a toy mouse on the ground. Results true if clicked. Adds mouse colour into TIntegerArray.
- FindTree : Finds any tree on mainscreen...maybe except willows. Results true if clicked.
- HSL Tool : Finds characteristics of a TIntegerArray. Lowest and highest H, S, L, R, G, B, X, Y, Z, while also finding the lowest and highest differences.
- MakeDDTM : Makes a DDTM of an item in the inventory. You can choose the name and inventory spot by filling in the parameters.
This is my first function thread, rate it or hate
Constructive criticism is appreciated...and so is flaming, gives me a chance to take out all my anger on someone. Bye now