JPHamlett
2009-05-13 05:58:04
ok so ive been reading sum tutorials amd they all are way over my head can someone make a tpa to cut a normal tree and and explain what u did
ty
ty
2009-05-13 05:58:04
2009-05-13 06:16:39
procedure CutTree;
var
I, H, x, y: Integer; // Declare integers that will be used
CTS: Integer; // Record the current CTS so we can replace it once done
TPA: TPointArray; // Store TPoints into an array for shortness
ATPA: T2DPointArray; //Store a 2 dimensional array of TPA.
begin
CTS := GetColorToleranceSpeed; // Save the current CTS into CTS
ColorToleranceSpeed(2); // Set our new CTS 1=fast, 2=medium,accurate, 3=slow,REAL accurate
SetColorSpeed2Modifiers(0.2, 0.2); // Set our SAT and HSL values, default is 0.2 & 0.2
FindColorsTolerance(TPA, 4754045, MSX1, MSY1, MSX2, MSY2, 3); // Find the colors and store them into TPA as multiple TPoints. (4754045=tree color, 'ms...'= the x1,y1,x2,y2 values, 3=tolerance)
if (Length(TPA) = 0) then Exit; // If there are no TPA points found, then exit proc.
ATPA := SplitTPAEx(TPA, 9, 9); // Create the T2DPointArray, (TPA=the 1d point values, 9,9= the distances between TPA's to put together as one)
SortATPAFrom(ATPA, Point(MSCX, MSCY)); // Sort all the ATPA's from the center of the main screen.
H := High(ATPA) - 1; // Get the length of how many ATPA's are stored, and subtract 1 so it doesn't count the extra value wasteful value at the last of the array.
for I := 0 to H do // Make the loop to go through all points in the ATPA.
begin
MiddleTPAEx(ATPA[I], x, y); // Get the center point between the set of two ATPA Points, and store them into x & y.
MMouse(x, y, 3, 3); // Moves mouse to the x & y location recorded with 3 as random value to add to each x and y.
Wait(100 + Random(200)); // Waits a few random milliseconds until the mouse has reached the object
if IsUpText('ree') then // check if the uptext of current mouse pos to see if its a tree
begin
Mouse(x, y, 3, 3, True); // Click the mouse on the x, y pos recorded. (True=Left click)
Wait(1000 + Random(1000)); // Wait 1000ms with random 1000ms until tree is cut down
end;
end;
end;
2009-05-13 06:23:33
if not FindColorsTolerance(TPA, 'ree', MSX1, MSY1, MSX2, MSY2, 3) then
exit;> FindColorsTolerance(TPA, 'ree', MSX1, MSY1, MSX2, MSY2, 3); // Find the colors and store them into TPA as multiple TPoints. ('ree'=tree name, 'ms...'= the x1,y1,x2,y2 values, 3=tolerance)
if (Length(TPA) = 0) then Exit; // If there are no TPA points found, then exit proc.
2009-05-13 06:25:21
2009-05-13 06:37:44
FindColorsTolerance(TPA, 'ree', MSX1, MSY1, MSX2, MSY2, 3);
2009-05-13 06:39:22
FindColorsTolerance(TPA, 4754045, MSX1, MSY1, MSX2, MSY2, 3);
2009-05-13 18:52:36
function YourTPA: Boolean;
var
CTS, i: Integer; //Your integers
TPA: TPointArray; //Your TPoint
ATPA: Array of TPointArray; //It is all of the TPA's together
begin
CTS := GetColorToleranceSpeed; //Saves your current Speed as CTS
ColorToleranceSpeed(2); //Puts the CTS to 2, for use in the procedure
SetColorSpeed2Modifiers(HueMod, SatMod); //HueMod and SatMod are replaced by the modifications on the colour which you are using, and can be defined with the script at the bottom of this example
FindColorsSpiralTolerance(MSCX, MSCY, TPA, MidColour, MSX1, MSY1, MSX2, MSY2, 10); //This finds the thing that you want to find. MidColour is the colour defined by the script at the bottom of this example.
SetColorSpeed2Modifiers(0.2, 0.2); //Chaned the Color speed modifiers back.
ColorToleranceSpeed(CTS); //Puts the colours back to default.
ATPA := TPAToATPAEx(TPA, 15, 15); //This makes an ATPA of all of the points in the 15 by 15 box of the TPA which we defined earlier in FindColorsSpiralTolerance.
for i := 0 to High(ATPA) do //This does from 0 to all of our TPA's in ATPA it will
begin
MiddleTPAEx(ATPA[i], x, y);//Find the centre point of our ATPA's and saves then under x and y
MMouse(x, y, 2, 2); //This moves the mouse to the x and y points defined in MiddleTPAEx.
begin
DoYourShit //Then you can make it do what you want it too.
end;
end;
end;program FindTPAVariables;
{.include SRL/SRL.scar}
var
H, S, L, HueMod, SatMod: Extended;
MidColour, i, ii: integer;
HueString, SatString: string;
HSLColor: Array[1..3] of Extended;
HSL: Array[0..1] of Array[1..3] of Extended;
Colors: TIntegerArray;
begin
Colors := [3241318, 2645844, 2119755, 2645844]; // PUT YOUR COLOURS HERE PL0X
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];
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);
HueString := FloatToStr(HueMod);
SatString := FloatToStr(SatMod);
SetLength(HueString, 4);
SetLength(SatString, 4);
ClearDebug;
Writeln('Hue Mod '+ HueString +'');
Writeln('Sat Mod '+ SatString +'');
Writeln('MidColour ' + IntToStr(MidColour) +'');
end.
2009-05-13 19:09:18