PDA

View Full Version : How to click biggest object first?



beefman
07-07-2014, 11:03 PM
Hi,
At the moment my bot usually clicks the most awkward, furthest away ever green tree you can find. Which is extremely annoying and slows down xp/ph but also gp/ph.
http://i62.tinypic.com/jjtcb4.jpg




Does anyone know how i can get it to click the nearest tree? I've used aca and YoHoJo and The Mayor have helped me and gave me advice how to pick a good colors over skype.
http://i58.tinypic.com/xkptgi.png



However, it's still picking really weird placed trees. Here's my script for picking the color.

procedure ChopTree();
var
x, y: integer;
begin // colour, tol CTS, hue, sat
if mainscreen.findObject(x, y, 1983028, 12, colorSetting(2, 0.10, 0.45), mainscreen.playerPoint, 10, 50, 50, ['down Ever','last','ever'], MOUSE_LEFT) then
writeLn('Clicking Tree') //this is the exception for the semicolon because it is followed by an else statement

if tabBackPack.waitForShift(randomRange(4000, 6000)) then
begin
writeLn('Tree cut. We got a log.');
end;


Could anyone have a look and suggest ways i can fix this?

Wetish
07-07-2014, 11:35 PM
Use TPAs instead of the findobject method. I would recommend reading a tutorial if you don't understand what each line does. This is for osr so it might not work without changing a few things, but the concept is there.

procedure ChopTree;
var
CTS: Integer;
TPA: TPointArray;
ATPA: array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.10, 0.45);
FindColorsTolerance(TPA, 1983028, MSX1,MSY1,MSX2,MSY2, 12);
ColorToleranceSpeed(CTS);
ATPA := ClusterTPA(TPA, 10);

//Try one of these:
//SortATPASize(ATPA,true); //This sorts the TPAs from largest to smallest
//SortATPAFromMidPoint(ATPA,Point(MSCX,MSCY));//This sorts the TPAs from the center of the screen to the outer edges

SetColorToleranceSpeed(CTS);
if length(ATPA) > 0 then
begin
MMouse(ATPA[0].x,ATPA[0].y,10,10);
end;
end;
end;

Coh3n
07-07-2014, 11:47 PM
Wetish; TRSMainscreen.findObject() uses TPA's internally and works perfectly fine for 99% of cases.

beefman; in this cause you should make your object's dimensions much much larger. Right now you have set the objects to 10 pixels by 50 pixels, clearly much smaller than a single tree. I would suggest at least 75x200. See how that goes.

Also, I recommend reloading the client a few times and collect multiple colors each time your reload -- the colors like to change a lot.

beefman
07-08-2014, 01:17 AM
Use TPAs instead of the findobject method. I would recommend reading a tutorial if you don't understand what each line does. This is for osr so it might not work without changing a few things, but the concept is there.

procedure ChopTree;
var
CTS: Integer;
TPA: TPointArray;
ATPA: array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.10, 0.45);
FindColorsTolerance(TPA, 1983028, MSX1,MSY1,MSX2,MSY2, 12);
ColorToleranceSpeed(CTS);
ATPA := ClusterTPA(TPA, 10);

//Try one of these:
//SortATPASize(ATPA,true); //This sorts the TPAs from largest to smallest
//SortATPAFromMidPoint(ATPA,Point(MSCX,MSCY));//This sorts the TPAs from the center of the screen to the outer edges

SetColorToleranceSpeed(CTS);
if length(ATPA) > 0 then
begin
MMouse(ATPA[0].x,ATPA[0].y,10,10);
end;
end;
end;

Okay, thank you. I've never used TPA. I'll see if i can find any tutorials for it.

beefman
07-08-2014, 01:19 AM
Wetish; TRSMainscreen.findObject() uses TPA's internally and works perfectly fine for 99% of cases.

beefman; in this cause you should make your object's dimensions much much larger. Right now you have set the objects to 10 pixels by 50 pixels, clearly much smaller than a single tree. I would suggest at least 75x200. See how that goes.

Also, I recommend reloading the client a few times and collect multiple colors each time your reload -- the colors like to change a lot.

I'll change the dimensions and collect some more colors. I've heard about the color changing from different worlds ect. Thanks :)