Spaceblow
2014-08-08 21:20:31
So I'm making a simple script that collects redberries from a bush. I think I'm almost done but I can't figure out how to solve something. This is what I have so far (major thanks to The Mayor for his AIO guide):
So it clicks the redberry bush and collects redberries. But the problem is there are only 2 redberries every bush, so I have to make it stop clicking after there aren't any left and continue to the next bush. I really don't know how to do that, it just keep clicking the bush while there aren't any redberries anymore. Maybe this could help you visualizing my problem:

And if I would finally make it work and it reaches the other bush and gets 2 redberries, do I have to use minimap.setAngle() to turn the camera so it could go to the other bush again or is there another/better way to do? Thanks in advance! :)
procedure getRedberries();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
redberriesTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit;
redberriesTimer.start();
repeat
findColorsSpiralTolerance(x, y, TPA, 1473055, mainScreen.getBounds(), 10, colorSetting(2, 0.14, 1.53));
if (Length(TPA) < 1) then
exit;
ATPA:= TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i:= 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Redberry bush'], 2000) then
begin
fastClick(MOUSE_LEFT);
//smartImage.clear;
break;
end;
end;
tabBackpack.waitForShift(2000);
until tabBackpack.isFull() or (redberriesTimer.getTime() > 900000);
end;
So it clicks the redberry bush and collects redberries. But the problem is there are only 2 redberries every bush, so I have to make it stop clicking after there aren't any left and continue to the next bush. I really don't know how to do that, it just keep clicking the bush while there aren't any redberries anymore. Maybe this could help you visualizing my problem:

And if I would finally make it work and it reaches the other bush and gets 2 redberries, do I have to use minimap.setAngle() to turn the camera so it could go to the other bush again or is there another/better way to do? Thanks in advance! :)