SRL Archive - OSR Help

Help With Color Finding


Gucci

2012-03-27 02:45:39

Hi everyone I'm working on a arctic pine script and was using this function to find the pines :

function FindPine(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.20, 0.16);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, PineColor, MSX1, MSY1, MSX2, MSY2, 25);
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, ine, rctic'])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;

But using this the mouse just keeps flying around to all the pine trees without clicking on then even though I have chopping set like this:

if FindPine(x, y) then
begin
Writeln('Tree Has Been Found');
Wait(10+ Random(20));
MMouse(x, y, 4, 4);
if WaitUpText('rctic', 500) then
Wait(10+ Random(45));
Mouse(x, y, 0, 0, True);
end;


Any help would be appreciated

Abu

2012-03-27 03:03:33

If its moving towards the tree then its not a color finding problem….

maybe change the UpText for the actual woodcutting part to 'hop'?

x[Warrior]x3500

2012-03-27 03:04:53

have u tried adding a wait() after your mmouse()?

in your first procedure, you dont have that wait() which can easily mess up a script. typically i wait atleast 400 ms before tryin to detect uptext. in the second one, u wait for 500 ms which is great.

Edit: woah! never noticed that srl helper thing. thanks srl staff!

Kyle Undefined

2012-03-27 09:18:09

You're doing a double check for the uptext, why?

You're calling ColorToleranceSpeed(CTS); before the function is over. That will affect how the ATPA will come out. Try moving that line of code after the loop.

Gucci

2012-03-27 10:58:36

Alright thanks guys I'll try out the suggestions and see if I can get it working