SRL Archive - RS3 Help

Cant seem to get it to stop detecting stumps


Battousai

2015-02-25 14:20:33


Procedure chopWillows();
var
i: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
chat: String;
msc: TPoint;
Begin
If Not isLoggedIn Then
Begin
Repeat
getNewClient();
Until(isLoggedIn);
End;
antiRandoms();
minimapAngle();

msc := mainScreen.getCenterPoint();
findColorsSpiralTolerance(msc.x, msc.y, TPA, 1977638, mainScreen.getBounds(), 3, colorSetting(2, 2.20, 3.71));

If length(TPA) < 1 Then
exit;

ATPA := TPAToATPA(TPA, 90);

SortATPAFrom(ATPA, mainScreen.getCenterPoint());;
ATPA.filterBetween(0, 4);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

For i := 0 To high(ATPA) Do
begin
mouseRandom(middleTPA(ATPA[i]), MOUSE_MOVE);
If isMouseOverText(['Willow', 'illow'], 500) Then
Begin
smartImage.clear;
randomRClickWillow();
smartImage.clear;
break;
End;
End;
mouseOffClient(OFF_CLIENT_RANDOM);
Repeat
If Not isLoggedIn Then
Begin
Repeat
getNewClient();
Until(isLoggedIn);
End;
ClearDebug;
writeLn('Status: Chopping Willows');
wait(randomRange(250, 500));
Until(Not isStillChopping Or Not isLoggedIn);
End;

I can't seem to even through filtering get it to stop detecting Stumps of trees already chopped down.

ATPA := TPAToATPA(TPA, 90); , Unless I'm wrong then this line here should stop it from detecting stumps compared to tree's, Unless I am leaving something out in the above code to actually do that, Then I am completely "Stumped"

KeepBotting

2015-02-25 14:51:54

TPAToATPA (documentation) doesn't really "filter" anything, I don't believe. It "splits" groups of TPoints in a TPoint array into their own seperate TPointArrays, and outputs those as an Array of TPointArrays.

This post by The Mayor outlines the easiest way to get a script to stop falsely detecting tree stumps as live trees. And if you actually want to see it in practise, check out iOak (link in my signature). I believe it's the filter() routine that makes the magic happen.

Hoodz

2015-02-25 15:03:50


For i := 0 To high(ATPA) Do
begin
if (length(ATPA[I]) < 50) then
continue; {tree stumps have less brown pixels than a whole tree, lets say 50}
{if the current TPA has less than 50 matching points then it will go to the next one}
mouseRandom(middleTPA(ATPA[i]), MOUSE_MOVE);
If isMouseOverText(['Willow', 'illow'], 500) Then
Begin
smartImage.clear;
randomRClickWillow();
smartImage.clear;
break;
end;
end;

Battousai

2015-03-02 02:16:41

From: hoodz

For i := 0 To high(ATPA) Do
begin
if (length(ATPA[I]) < 50) then
continue; {tree stumps have less brown pixels than a whole tree, lets say 50}
{if the current TPA has less than 50 matching points then it will go to the next one}
mouseRandom(middleTPA(ATPA[i]), MOUSE_MOVE);
If isMouseOverText(['Willow', 'illow'], 500) Then
Begin
smartImage.clear;
randomRClickWillow();
smartImage.clear;
break;
end;
end;


Either i am completely incapable of doing a single thing right or none of this is working Because i have it set to < 2400 and it is still managing to find stumps, yet anything higher than that and it dont even find tree's anymore…

tls

2015-03-02 03:28:35

From: Battousai
Either i am completely incapable of doing a single thing right or none of this is working Because i have it set to < 2400 and it is still managing to find stumps, yet anything higher than that and it dont even find tree's anymore…


Well what do stumps lack? Leaves. So add a tpa with the leaves to the tpa with the stump(some sort of split or tpatoatpa).

cosmasjdz

2015-03-02 03:31:16

From: Battousai
Either i am completely incapable of doing a single thing right or none of this is working Because i have it set to < 2400 and it is still managing to find stumps, yet anything higher than that and it dont even find tree's anymore…


try something like atpa.filterbetween(0,50) to remove small atpas
also to remove large ones you could do like atpa.filterbetween(500,maxinteger)

So your boxes of atpa would contain between 50 and 500 pixels of selected color.

Also your tree and a stump has different boxes in size so you could do like filter boxes compared of them length too.

Actually i think there the hook is missunderstanging what you want to look for. In your place i always do a dummy script to look what lenght tpa for example i can expect by debugging tpa+atpa every second or so and wondering around in game myself in various angles. So it can be easier to determine either sizes and lengths.

Hoodz

2015-03-02 07:16:34

From: Battousai
Either i am completely incapable of doing a single thing right or none of this is working Because i have it set to < 2400 and it is still managing to find stumps, yet anything higher than that and it dont even find tree's anymore…


debug the atpa their length, i can tv if you want in a few hours.

King

2015-03-02 09:14:43

Why are you trying to detect the tree bark rather than the leaves? Maybe I am missing something, but I would go for the leaves of the tree, or have it search for the stump, put it in a TPA box and then have it search for the leaves of the tree within that box. That way, it will find the stump / bark and then only move the mouse over to the location if the tree has leaves within that box?

Hoodz

2015-03-02 10:26:39

From: King
Why are you trying to detect the tree bark rather than the leaves? Maybe I am missing something, but I would go for the leaves of the tree, or have it search for the stump, put it in a TPA box and then have it search for the leaves of the tree within that box. That way, it will find the stump / bark and then only move the mouse over to the location if the tree has leaves within that box?


most of the leaves are not interact-able

Battousai

2015-03-02 11:06:18

From: King
Why are you trying to detect the tree bark rather than the leaves? Maybe I am missing something, but I would go for the leaves of the tree, or have it search for the stump, put it in a TPA box and then have it search for the leaves of the tree within that box. That way, it will find the stump / bark and then only move the mouse over to the location if the tree has leaves within that box?


The leaves have no options to chop a tree down, i wish it was that easy honestly :)

King

2015-03-03 11:23:54

From: hoodz
most of the leaves are not interact-able


From: Battousai
The leaves have no options to chop a tree down, i wish it was that easy honestly :)


Okay, that makes sense then. You could detect the stump, then look for the foliage in the box, then if it is present, click on the tree bark color?

the bank

2015-03-03 11:32:28

From: King
Okay, that makes sense then. You could detect the stump, then look for the foliage in the box, then if it is present, click on the tree bark color?


Unreliable due to grass colors being close to foliage colors.

The best suggestion has already been made. Debug the tpa length.

Hoodz

2015-03-03 11:44:55

From: King
Okay, that makes sense then. You could detect the stump, then look for the foliage in the box, then if it is present, click on the tree bark color?


From: the bank
Unreliable due to grass colors being close to foliage colors.
The best suggestion has already been made. Debug the tpa length.


i already helped him out @ tv, it should be fixed now

King

2015-03-03 16:44:57

From: the bank
Unreliable due to grass colors being close to foliage colors.

The best suggestion has already been made. Debug the tpa length.


What is best is just a matter of opinion, I haven't played in awhile, that is how I have found them before with no issues or mis-identifications. Things change, I apologize for being out of the loop.

From: hoodz
i already helped him out @ tv, it should be fixed now


Good to hear, I'm glad you could get it working for him!