rj
2013-05-01 17:23:35
So I am using a ATPA to find clay rocks, sometimes it has to go through a few to find them, and I AM sorting them from the center of the screen. Secondly, when ever the script clicks the rock it waits 2-3 seconds and clicks it again? It's supposed to wait 6-8 seconds or until the inventory count is added
function MineClay: Boolean;
var
j, CTS, Timeout, OreCount, MineCount, T: Integer;
TPA_Rock, TPA_Vein, TPA_Clay: TPointArray;
Clay_ATPA: T2DPointArray;
g: TPoint;
begin
if (not loggedin) then exit;
OreCount := InvCount + 1
if (IsUpTextMultiCustom(['lay', 'Clay'])) then
begin
update_state('Found clay uptext clicking');
case random(109) of
0..60: Wait(RandomRange(50, 300));
61..91: Wait(RandomRange(100, 400));
92..100: Wait(RandomRange(200, 900));
101..108: Wait(RandomRange(400, 1400));
end;
clickmouse2(mouse_left)
tries := 0;
MarkTime(MineCount);
repeat
update_state('Mining');
Wait(RandomRange(100, 300));
until (TimeFromMark(MineCount) > 3500) or (InvCount = OreCount);
if (InvCount = OreCount) then Inc(OresMined);
exit;
end;
Result := False;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
Timeout := RandomRange(6000, 8000);
begin
SetColorSpeed2Modifiers(0.05, 0.20);
FindColorsTolerance(TPA_ROCK, 4094608, MSX1, MSY1, MSX2, MSY2, 4);
SetColorSpeed2Modifiers(0.01, 2.26);
FindColorsTolerance(TPA_VEIN, 6400982, MSX1, MSY1, MSX2, MSY2, 17);
SetColorSpeed2Modifiers(0.02, 0.02);
ColorToleranceSpeed(CTS);
CombineTPAWrap(TPA_Rock, TPA_Vein, TPA_clay);
SplitTPAWrap(TPA_Clay, 5, Clay_ATPA);
SortATPAFromFirstPoint(Clay_ATPA, Point(MSCX, MSCY));
end;
MarkTime(T);
if Length(TPA_clay) < 1 then Exit;
//smart_debugATPA(true,Clay_ATPA);
for j := 0 to High(Clay_ATPA) do
begin
if (Length(Clay_ATPA[j]) < 12) then Continue;
update_state('Starting to loop through atpas');
g := MiddleTPA(Clay_ATPA[j]);
MMouse(g.x, g.y, RandomRange( - 5, 5), RandomRange( - 5, 5));
Wait(RandomRange(100, 250));
if IsUpTextMultiCustom(['lay', 'Clay']) then
begin
Result := True;
update_state('Found the uptext');
clickmouse2(mouse_left);
Flag;
tries := 0;
Wait(RandomRange(100, 700));
repeat
Wait(RandomRange(15, 200));
update_state('Mining');
until (TimeFromMark(MineCount) > TimeOut) or (InvCount = OreCount);
if (InvCount = OreCount) then Inc(OresMined);
break;
exit;
end;
end;
if (not result) then WalkMine;
end;
