SRL Archive - MSI Bugs

Varrock East Oaks Animation


YoHoJo

2011-04-02 13:25:45

Not sure if this 'problem' is specific to this location, I've got noticed it here.

Often times when chopping a tree, you come at it diagonally, making you actually stand one block to the left/right of the center block on the screen.

MSI checks for animation only on the center block (which is fine) but when this happens the script thinks you are not chopping since there is no animation on the center block (unless someone next to you is chopping) causing the script to click the tree over and over until it is chopped.

Maybe (just for this location/locations were this happens?) we could increase the area in which we search for animation, it's pretty common.

:]

NCDS

2011-04-02 13:39:24


Procedure MSI_WaitWhileChopping(TreeID: integer);
Var
CTS, HalfWidth, HalfHeight, L, I, T, OldInvCount, NewInvCount, tDist, prevLen: Integer;
TotalChopTime, R, CT: Integer;
ATPA: T2DPointArray;
TPA: TPointArray;
Objs: TIntegerArray;
B: TBox;
TreeExists, Debug: Boolean;
Begin
if (not LoggedIn) then
Exit;

MSI_AddHeader('MSI_WaitWhileChopping');

Objs := MSI_Players[CurrentPlayer].Scripts[CurrentScript].Trees;

CTS := GetColorToleranceSpeed;

SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(MSI_Objects[TreeID].Hue, MSI_Objects[TreeID].Sat);

HalfWidth := Round(MSI_Objects[TreeID].W * 0.7);
HalfHeight := Round(MSI_Objects[TreeID].H * 0.7);
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 + MSI_Objects[TreeID].MaxTime + Random(5000));
TotalChopTime := (GetSystemTime + (4 * 60000));

Repeat
Debug := (Random(10) < 3);

If InvFull Then
Break;

MSI_FindRandoms(False);
MSI_AntiBan(RandomRange(0, 5000), ANTI_BAN_CHANCE);

// Check if the tree Exists
if (Debug) then
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);
SortTPAFrom(TPA, Point(MSCX, MSCY));

if (Length(TPA) > 0) then
begin
if (length(TPA) <= (prevLen / 2)) then
begin
MSI_Debug('Length(TPA) < half the previous, tree is gone');
break;
end;

if (MSI_SetupVars[SETUP_DEBUG_SMART]) then
SMART_DrawDotsEx(True, TPA, clYellow);

// Gets distance from closest point to player
tDist := Distance(TPA[0].x, TPA[0].y, MSCX, MSCY);

// Resets the tracking box to a box the size of the tree located around the closest point
B := MSI_MakeBox(Point(TPA[0].x, TPA[0].y), MSI_Objects[TreeID].W, MSI_Objects[TreeID].H);

if (MSI_SetupVars[SETUP_DEBUG_SMART]) then
SMART_DrawBoxEx(False, B, clBlue);

prevLen := length(TPA);
end;

if (Debug) then
MSI_Debug('Track box distance: '+IntToStr(tDist));

if (tDist > TREE_MAX_DIST) then
begin
if (Debug) then
MSI_Debug('Tracking box is over the maximum distance');
Break;
end;

TreeExists := Length(TPA) >= MSI_Objects[TreeID].Accuracy;
If (TreeExists) Then
If (Random(4) <> 0) Then
Wait(200 + Random(50))
Else
SleepAndMoveMouse(200 + Random(50));

if (random(20) < 5) then
if MSI_FindBirdNest then
Break;

// InvCount check
if (Debug) then
MSI_Debug('Checking inventory count');

NewInvCount := InvCount;
If (NewInvCount > OldInvCount) Then
Begin
if (Debug) then
MSI_SubDebug('New count > old count');

OldInvCount := NewInvCount;
T := (GetSystemTime + MSI_Objects[TreeID].MaxTime + Random(5000));
End;

// Prevent logout
If ((TotalChopTime - GetSystemTime) < 60000) Then
Begin
if (Debug) then
MSI_Debug('Preventing logout');

CT := GetCurrentTab;
Repeat
R := RandomRange(Tab_Combat, Tab_Notes);
Until(R <> CT);
GameTab(R);

if (Debug) then
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('MSI_WaitWhileChopping: Finished');

SetColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
End;
Exactly what Animation check are you talking about? :confused:

I know Coh3n has been working with WaitWhileChopping for a few days, not sure as to his current progress, but I'd imagine any issues would be fixed.

YoHoJo

2011-04-02 14:13:54

I actually never looked at any code :p.
I jut assumed whilechopping looked for any character movement/animation on the center tile. I'm on phone right now I'll look at it more when I get home.

Coh3n

2011-04-02 14:51:32

From: YoHoJo
I actually never looked at any code :p.
I jut assumed whilechopping looked for any character movement/animation on the center tile. I'm on phone right now I'll look at it more when I get home.

My new one does. It works 1000x better, I just haven't committed it yet. I can push it to my repository, then you can pull from mine if you want to test it out. Also, MSI_WaitWhileChopping has a huge memory leak somehow, so that may be the cause of your code:8 errors.

E: Updated my repo -> https://github.com/Coh3n/MSI/commit/bf3c743285f520457d6e1d373efedd57d1d4592d I still have a few things to test before pushing to main.

YoHoJo

2011-04-02 15:01:22

Thanks.
Memory Leak fixed in your updated repo? Or still can't figure out exactly wtf is wrong?

Coh3n

2011-04-02 15:02:58

From: YoHoJo
Thanks.
Memory Leak fixed in your updated repo? Or still can't figure out exactly wtf is wrong?

I still can't figure out what the fuck is wrong, but it's definitely improved. Did you ever have this issue when using a mining script?

I've been running 2 Simbas all night, still going and they're both at over 12 hours.

YoHoJo

2011-04-02 15:11:57

I've mined for 24+ hours on two simbas, never code 8.
You also have mined a BUNCH of clay and I assume you also never code 8ed?

Only seems to happen with WCing, I'm running two more 1.5 hours so far….

Coh3n

2011-04-02 15:15:06

From: YoHoJo
I've mined for 24+ hours on two simbas, never code 8.
You also have mined a BUNCH of clay and I assume you also never code 8ed?

Only seems to happen with WCing, I'm running two more 1.5 hours so far….

That's exactly why it was probably MSI_WaitWhileChopping. I also got the code:8 after switching from mining to woodcutting (and yeah, I ran 4 simbas all went for 30h mining clay). I also ran a series of tests on WaitWhileChopping, which showed that there was definitely a leak. The question is what is the leak?

Running woodcutting last night, my memory as still increased, but no code:8, so it's an improvement. I hope you have good luck with my repo as well. Let me know how it goes. :)

IPwnz

2011-04-02 15:19:10

From: YoHoJo
Only seems to happen with WCing, I'm running two more 1.5 hours so far….


Not to be a downer, but I wake up every morning (that is, I run it with 4 characters for about 7 hours or so before it dies) with MSI crashed with a code 8 and all I run is Rimmington Iron Miner, so it isn't just WC'ing.

Coh3n

2011-04-02 15:20:38

From: IPwnz
Not to be a downer, but I wake up every morning (that is, I run it with 4 characters for about 7 hours or so before it dies) with MSI crashed with a code 8 and all I run is Rimmington Iron Miner, so it isn't just WC'ing.

Do you have smart debugging enabled?

IPwnz

2011-04-02 15:26:52

From: Coh3n
Do you have smart debugging enabled?


Nope, I haven't ever bothered because of the misc incompatibility bugs I hear with plugins and such.

Coh3n

2011-04-02 15:33:07

From: IPwnz
Nope, I haven't ever bothered because of the misc incompatibility bugs I hear with plugins and such.

See, this is the issue that makes me so fucking mad. I have no idea whatsoever that would cause this. The only thing that's called during mining are MSI_TrackObject and MSI_FindObjectsIn, and those just use Simba's color routines. There's no unfreed DTMs in MSI, because they're all loaded on startup. All form components are freed. After that, I don't know what can cause leaks.

NCDS

2011-04-02 15:54:01

I've never got a code 8 at all and I have 5 players (2 WCing and 3 Mining) running around the clock with little exception. (usually 20+ hrs. before I stop to reset/check things)

Sir R. M8gic1an

2011-04-02 16:36:06

Different thing althogether….

why do we have if debug then MSI_Debug instead of just having if not Debug then exit inside MSI_Debug? ( I know I'm always throwing shit onto your hands…. excuse my lazy old ass :p )

~RM

NCDS

2011-04-02 16:40:01

From: Sir R. M8gic1an
Different thing althogether….

why do we have if debug then MSI_Debug instead of just having if not Debug then exit inside MSI_Debug? ( I know I'm always throwing shit onto your hands…. excuse my lazy old ass :p )

~RM


Just the way it was originally done I suppose. Me and Coh3n have plans to (it seems he's already began a bit) go through MSI as a whole and just fix up the code where need be.

Coh3n

2011-04-02 17:30:17

From: Sir R. M8gic1an
Different thing althogether….

why do we have if debug then MSI_Debug instead of just having if not Debug then exit inside MSI_Debug? ( I know I'm always throwing shit onto your hands…. excuse my lazy old ass :p )

~RM

Why would it exit? "Debug" is just randomly set to true. It just so it doesn't spam the debug as much.

Coh3n

2011-04-19 18:06:20

This was fixed quite some time ago. :)