SRL Archive - MSI Bugs

Another suggestion..


DeSnob

2010-09-14 20:35:59

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:
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.

Sir R. M8gic1an

2010-09-15 07:04:59

Diff / what did you change?

~RM

DeSnob

2010-09-15 07:09:26

From: Sir R. Magician
Diff / what did you change?

~RM


I didn't change anything, just wanted to show the procedure.

NCDS

2010-09-15 11:25:35

TrackObject will cause the character to click an object multiple times generally. That's probably what your experiencing.

Coh3n

2010-09-15 13:39:35

From: DeSnob
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.

That's what it does, but if the player has to walk to the tree, the object can someones be lost and therefore has to click the tree again.

DeSnob

2010-09-15 18:32:57

From: Coh3n
That's what it does, but if the player has to walk to the tree, the object can someones be lost and therefore has to click the tree again.


The issue is that it continuously clicks WHILE at the tree (standing still).

Coh3n

2010-09-15 22:23:57

From: DeSnob
The issue is that it continuously clicks WHILE at the tree (standing still).

I've had it click it one or two times once it's already chopping, but nothing more. What tree is this happening with? Can you take a screenshot of/video of the SMART debugging when this happens?

The tree colors may need to be updated. There may not be enough colors being found after clicking the tree.

Sir R. M8gic1an

2010-09-17 05:13:26

This was the same for mining. There error is here:

{******************************************************************************}
{ Function MSI_ChopTree(Which: TIntegerArray): Boolean; }
{ By: marpis }
{ Date: 25 June 2010 }
{ Description: Chops tree }
{******************************************************************************}
Function MSI_ChopTree(Which: TIntegerArray): Boolean;
Var
TreeIndex: Integer;
Begin
If MSI_FindObjects(Which, TreeIndex, ClickLeft) Then
begin
Result := True;
MSI_TrackObject(Which[TreeIndex]); //this is causing it
MSI_WaitWhileChopping(Which[TreeIndex]);
end;
End;

Wonder why?


TREE_YEW:
with MSI_Objects[whichObject] do
begin
Name := 'Yew tree';
UpText := 'wn Yew';
Option := 'Chop down Yew';
Colors := [4162165];
Tol := 14;
Hue := 0.01;
Sat := 0.76;
FindAllColors := False;
W := 35;
H := 35;
Accuracy := 10;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True; //because of this
BadColors := [];
BadColorTolerance := 10;
AssociatedItems := [LOGS_YEW];
end;


//and...
Function MSI_FindObjectsIn
If MSI_Objects[Objs[II]].WaitToMove Then
MSI_TrackObject(Objs[II]);

So it calls TrackObject twice. I fixed it up for mining. I'll take care of this in a sec.

e: done. Rev 288

~RM

NCDS

2010-09-17 11:02:58

Awesome! Nice find RM :)