I was unsure whether this was the code itself or that it didn't track the TPAs well. It continually clicks the trees even though it chops away, and when it does this the player isn't even moving. That's why I suspect something's up with the TPAs. The last update was great (thanks Coh3n) but I'm still having this little issue. I'll check it out myself right now.
E:
Simba Code:
Procedure MSI_WaitWhileChopping(TreeID: integer);
Var
CTS, HalfWidth, HalfHeight, L, I, T, OldInvCount, NewInvCount: Integer;
TotalChopTime, R, CT: Integer;
ATPA: T2DPointArray;
TPA: TPointArray;
B: TBox;
TreeExists: Boolean;
Begin
MSI_AddHeader('MSI_WaitWhileChopping');
CTS := GetColorToleranceSpeed;
SetColorSpeed2Modifiers(MSI_Objects[TreeID].Hue, MSI_Objects[TreeID].Sat);
HalfWidth := (MSI_Objects[TreeID].W / 2);
HalfHeight := (MSI_Objects[TreeID].H / 2);
B := IntToBox(MSI_Objects[TreeID].X - HalfWidth, MSI_Objects[TreeID].Y - HalfHeight,
MSI_Objects[TreeID].X + HalfWidth, MSI_Objects[TreeID].Y + HalfHeight);
L := Length(MSI_Objects[TreeID].Colors);
SetLength(ATPA, L);
Dec(L);
OldInvCount := InvCount;
T := GetSystemTime + 20000 + Random(5000);
TotalChopTime := GetSystemTime;
MSI_AddHeader('Entering loop');
Repeat
If InvFull Then
Break;
MSI_AntiBan(RandomRange(0, 5000), ANTI_BAN_CHANCE);
{ Check if the tree Exists }
MSI_Debug('Looking for tree');
For I := 0 To L Do
FindColorsTolerance(ATPA[I], MSI_Objects[TreeID].Colors[I],
B.X1, B.Y1, B.X2, B.Y2, MSI_Objects[TreeID].Tol);
TPA := MergeATPA(ATPA);
//WriteLn(Length(TPA));
TreeExists := Length(TPA) >= MSI_Objects[TreeID].Accuracy;
If (TreeExists) Then
If (Random(4) <> 0) Then
Wait(200 + Random(50))
Else
SleepAndMoveMouse(200 + Random(50));
MSI_FindRandoms;
MSI_FindBirdNest;
{ InvCount check }
MSI_Debug('Checking inventory count');
NewInvCount := InvCount;
If (NewInvCount > OldInvCount) Then
Begin
MSI_SubDebug('New count > old count');
OldInvCount := NewInvCount;
T := GetSystemTime + 20000 + Random(5000);
End;
{ Prevent logout }
If ((GetSystemTime - TotalChopTime) > 60000) Then
Begin
MSI_Debug('Preventing logout');
CT := GetCurrentTab;
Repeat
R := RandomRange(Tab_Combat, Tab_Notes);
Until(R <> CT);
GameTab(R);
MSI_SubDebug('Clicking game tab: ' + IntToStr(R));
Wait(RandomRange(500, 1000));
End;
if (GetCurrentTab <> tab_Inv) then
MouseBox(646, 177, 662, 195, 1);
Until(Not TreeExists) Or (GetSystemTime > T) Or (Not LoggedIn);
MSI_CloseHeader('Out of loop');
MSI_CloseHeader('MSI_WaitWhileChopping: Exit');
End;
Why not just add a while ... do loop in the tree finding procedure that will wait until it can't find the color in the spot anymore. I believe it might be searching for colors elsewhere and therefore not finding what it needs.