Slashed
2012-12-14 21:02:47
So, I've been all day coding a simple rock finder using ATPA, should be done in 10 minutes or less but instead is error after error when everything seems correct.
It compiles fine but the behave it has is very different.
I defined the TPA and the ATPA, created a MS region for the findcolorstolerance, divided even in that space in small boxes 10 w 10 h and used splitTPAEx.
What it does is loop through the ATPA as if nothing was found and just loops and loops even with a break there.
I know it's hard to but please, try to ignore the messy standards. ( Doesn't do the proper standards in a QUOTE statement)
I leave here the parts that are giving me trouble:
It compiles fine but the behave it has is very different.
I defined the TPA and the ATPA, created a MS region for the findcolorstolerance, divided even in that space in small boxes 10 w 10 h and used splitTPAEx.
What it does is loop through the ATPA as if nothing was found and just loops and loops even with a break there.
I know it's hard to but please, try to ignore the messy standards. ( Doesn't do the proper standards in a QUOTE statement)
I leave here the parts that are giving me trouble:
Function FindTin: Boolean;
var
tmpCTS, i, x, y: Integer;
RockTPA: TPointArray;
RockATPA: T2DPointArray;
begin
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.06,0.87);
FindColorsTolerance(RockTPA, 10790596, 185, 175, 327, 258, 19)
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02,0.02);
RockATPA := SplitTPAEx(RockTPA, 10, 10);
SortATPASize(RockATPA, True);
for i :=0 to high(RockATPA) do
begin
MiddleTPAEx(RockATPA,x,y);
MMouse(x, y, 5, 5);
if WaitUptext('ocks', 400)then
begin
Result := True;
Exit;
end;
end;
end;
Procedure MineTin;
begin
if FindTin then
begin
case random(100) of
0..75:begin
wait(RandomRange(50,150));
FastClick(mouse_left);
repeat
wait(1000 + random(100));
until not PlayerIsMining;
end;
76..100:begin
wait(RandomRange(50,150));
FastClick(mouse_right);
wait(100+Random(100));
ChooseOption('Tin');
repeat
wait(1000 + random(100));
until not PlayerIsMining;
end;
end;
end;
end;