SRL Archive - OSR Help

Help With Finding


Gucci

2012-03-21 18:47:08

Okay so I've gone through multiple finding functions excluding DTM's and my Maple Chopper still won't chop the maples. Here is the part of the code:

function MapleColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.19);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 1913182, MSX1, MSY1, MSX2, MSY2, 8);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 2.76) and (X <= 10.45) and (Y >= 2.21) and (Y <= 8.16) and (Z >= 0.88) and (Z <= 2.96) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

function FindMaple(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.19);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, MapleColor, MSX1, MSY1, MSX2, MSY2, 8);
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(['hop, aple, ree'])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;

Thanks in advance for help

nickrules

2012-03-21 19:19:44

two possible things: You need to update your colors, OR, you're not calling it correctly. So basically, if it's hovering over the the tree and not clicking, use my solution below. Otherwise you need to pick new colors, I'd imagine.

You'd call findmaple(x,y) and then mouse(x,y,0,0,mouse_left).

Abu

2012-03-21 19:23:04

I remember having long code like yours… then I just cut it down into one simple function:
function FindObjCustom(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol: Integer): Boolean;

It notes down the co-ordinates, checks multiple uptexts, multiple colors and uses a tolerance. An example would be:

if FindObjCustom(x, y, ['aple', 'tre'], [maplecolor1, maplecolor2], 5)then
begin
MMouse(x, y, 2, 2,);
Mouse(x, y, 0, 0, True);
end;

Try it :)

P.S - use better colors

wazzzup

2012-03-21 19:23:40

Procedure PwnMaple;
begin
If FindMaple(x,y) then
writeln('Found Maple Tree')
end;

You need to either add that in your script and put PwnMaple; at the bottom of your script where all the other stuff is or pick new colors

Gucci

2012-03-21 20:23:43

From: abu_jwka
I remember having long code like yours… then I just cut it down into one simple function:
function FindObjCustom(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol: Integer): Boolean;

It notes down the co-ordinates, checks multiple uptexts, multiple colors and uses a tolerance. An example would be:

if FindObjCustom(x, y, ['aple', 'tre'], [maplecolor1, maplecolor2], 5)then
begin
MMouse(x, y, 2, 2,);
Mouse(x, y, 0, 0, True);
end;

Try it :)

P.S - use better colors


I don't like FindObjCustom cause it's way to simple and I plan on using this to apply for membs :)

And the others I am using if FindMaple(x, y) then…… but I haven't played for a bit and realized maple's have been updated so changed all the colors thanks for the help though :)