SRL Archive - MSI Bugs

Shrub


TomTuff

2011-01-06 05:58:15

Sorry for the undescreptive thread title :p

I'm running MSI (Varrock East trees) on a player I just made. Sometimes, one of the shrubs in the area (see picture) is determined to be the tree and so when the tree is gone yet the shrub still stands, the player will stand there until (i'm assuming) some sort of timer runs out.

I could be completely wrong, but it always happens on this specific tree :p

In the picture, the tree the player is cutting is the problem and the and the shrub (in the box, added by MSI Debugging not me) is what i believe to be throwing the script off.

Again, it could be something else, but it should still be looked into.

e: IT'S DOING IT AGAIN >_<;

Sir R. M8gic1an

2011-01-06 11:11:08

The way that TPA is splitting doesn't look good to me.

That looks like TPAToATPA, where SplitTPA might've been better.

It's weird/wrong that one tree gets split into 3.

And lastly I'll suggest a technique I used years ago. Move the mouse to where you think the tree is to actually check if it's a tree.

~RM

Coh3n

2011-01-06 12:00:44

From: Sir R. Magician
The way that TPA is splitting doesn't look good to me.

That looks like TPAToATPA, where SplitTPA might've been better.

It's weird/wrong that one tree gets split into 3.

And lastly I'll suggest a technique I used years ago. Move the mouse to where you think the tree is to actually check if it's a tree.

~RM

Yeah it looks like the Tree's W/H are set too small.

I suppose we could add a MMouse to TrackObject to verify that we're actually tracking the right object, but what if we aren't? How are we going to effectively recover?

lordsaturn

2011-01-06 12:41:07

From: Coh3n
Yeah it looks like the Tree's W/H are set too small.

I suppose we could add a MMouse to TrackObject to verify that we're actually tracking the right object, but what if we aren't? How are we going to effectively recover?


The timeout that TomTuff mentioned, or a color check while tracking. Sorry I'm ignorant on the subject of MSI's code.

Sir R. M8gic1an

2011-01-06 14:10:08

{******************************************************************************}
{ function MSI_TrackObject(var ObjInfo: TMSObject): boolean; }
{ By: marpis & Sir R. Magician }
{ Date: 09 August 2010 }
{ Description: Follows object while moving (ObjInfo.X, ObjInfo.Y) }
{******************************************************************************}
function MSI_TrackObject(ObjID: integer): boolean;
var
ATPA: T2DPointArray;
TPA: TPointArray;
CTS, T, Tries: integer;
B: TBox;
Previous: TPoint;
BreakNext: boolean;
DistMultiplier: extended;
begin
MSI_AddHeader('MSI_Track Object');
Result := true;
Track_Search(T_TrackObject);

CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(MSI_Objects[ObjID].Hue, MSI_Objects[ObjID].Sat);

//Preparing vars for loop
DistMultiplier := Distance(MSCX, MSCY, MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y) / 40;
if DistMultiplier < 1.0 then DistMultiplier := 1.0;
BreakNext := false;
Previous := Point(MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y);
T := GetSystemTime + 30000;

repeat
B := MSI_MakeBox(Point(MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y),
round(MSI_Objects[ObjID].W * DistMultiplier),
round(MSI_Objects[ObjID].H * DistMultiplier));

SMART_DrawBoxEx(True, B, clYellow);

if MSI_FindObjectsTPA(TPA, ObjID, B) then
begin
ATPA := SplitTPA(TPA, MSI_Objects[ObjID].W);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
MiddleTPAEx(ATPA[0], MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y);

if tries = 1 then
begin
tries := 0;
DistMultiplier := DistMultiplier - 1.0; //setting the box back to 'normal' size
end;
end else begin
Inc(tries);
if tries = 1 then
begin
DistMultiplier := DistMultiplier + 1.0; //increasing search box
continue;
end else begin
MSI_Debug('Lost track of object');
Result := false;
break;
end;
end;

if BreakNext then Break;

if distance(Previous.X, Previous.Y, MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y) < DIST_PIXEL_MOVE then
if not FlagPresent then
if not IsMoving then
BreakNext := true;

Previous := Point(MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y);

Wait(5);
until (T < GetSystemTime);

if Result then
Track_Success(T_TrackObject);

Track_Print(T_TrackObject);

MSI_CloseHeader(BoolToStr(Result));

SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(2);
end;

~RM

Nava2

2011-01-06 14:23:06

From: Sir R. Magician
{******************************************************************************}
{ function MSI_TrackObject(var ObjInfo: TMSObject): boolean; }
{ By: marpis & Sir R. Magician }
{ Date: 09 August 2010 }
{ Description: Follows object while moving (ObjInfo.X, ObjInfo.Y) }
{******************************************************************************}
function MSI_TrackObject(ObjID: integer): boolean;
var
ATPA: T2DPointArray;
TPA: TPointArray;
CTS, T, Tries: integer;
B: TBox;
Previous: TPoint;
BreakNext: boolean;
DistMultiplier: extended;
begin
MSI_AddHeader('MSI_Track Object');
Result := true;
Track_Search(T_TrackObject);

CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(MSI_Objects[ObjID].Hue, MSI_Objects[ObjID].Sat);

//Preparing vars for loop
DistMultiplier := Distance(MSCX, MSCY, MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y) / 40;
if DistMultiplier < 1.0 then DistMultiplier := 1.0;
BreakNext := false;
Previous := Point(MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y);
T := GetSystemTime + 30000;

repeat
B := MSI_MakeBox(Point(MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y),
round(MSI_Objects[ObjID].W * DistMultiplier),
round(MSI_Objects[ObjID].H * DistMultiplier));

SMART_DrawBoxEx(True, B, clYellow);

if MSI_FindObjectsTPA(TPA, ObjID, B) then
begin
ATPA := SplitTPA(TPA, MSI_Objects[ObjID].W);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
MiddleTPAEx(ATPA[0], MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y);

if tries = 1 then
begin
tries := 0;
DistMultiplier := DistMultiplier - 1.0; //setting the box back to 'normal' size
end;
end else begin
Inc(tries);
if tries = 1 then
begin
DistMultiplier := DistMultiplier + 1.0; //increasing search box
continue;
end else begin
MSI_Debug('Lost track of object');
Result := false;
break;
end;
end;

if BreakNext then Break;

if distance(Previous.X, Previous.Y, MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y) < DIST_PIXEL_MOVE then
if not FlagPresent then
if not IsMoving then
BreakNext := true;

Previous := Point(MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y);

Wait(5);
until (T < GetSystemTime);

if Result then
Track_Success(T_TrackObject);

Track_Print(T_TrackObject);

MSI_CloseHeader(BoolToStr(Result));

SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(2);
end;

~RM


Sorry, one thing I just noticed:
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(2);

Shouldn't these be reset to what they were on entering the function? :p

Coh3n

2011-01-06 15:17:52

From: lordsaturn
The timeout that TomTuff mentioned, or a color check while tracking.

Yeah that's what it does now. If we did an uptext check and we weren't tracking the right object, I guess we could just break out of the loop and click a new tree, but I can see people complaining about that.

From: lordsaturn

Sorry I'm ignorant on the subject of MSI's code.

If you don't mind me asking… why?

NCDS

2011-01-06 16:53:12

IIRC, the WaitWhile*skill* functions all check with PixelShift to see if your char is still moving to tell if it's performing a skill or not. Perhaps that's all that needs to be messed with?

W/H do need to be changed though, as well.

lordsaturn

2011-01-06 17:32:17

From: Coh3n
Yeah that's what it does now. If we did an uptext check and we weren't tracking the right object, I guess we could just break out of the loop and click a new tree, but I can see people complaining about that.


If you don't mind me asking… why?


Because I'm not a contributor to MSI atm. If trackobject doesn't work, here's an idea, use something like smartColors algorithm to get a few unique colors on the screen, then after you are done moving check to see how much they have moved and translate the object coords based on that.

Sir R. M8gic1an

2011-01-07 01:06:05

@Nava:

your absolutely right about the CTS (duh)

Where did your runtime-autocoloring end up? That would be useful as f*ck tbh :)

@LordSaturn
That's actually a pretty damn cool idea.


@Bug
I think all that is actually missing is a color count. If we did a color count it'd never end up on the bush thinking it's the tree. heh.

~RM

Coh3n

2011-01-07 15:08:25

From: Sir R. Magician
@Nava:

your absolutely right about the CTS (duh)

Where did your runtime-autocoloring end up? That would be useful as f*ck tbh :)

Pretty sure it's still in SRL.


From: Sir R. Magician

@Bug
I think all that is actually missing is a color count. If we did a color count it'd never end up on the bush thinking it's the tree. heh.

~RM

Yeah, could increase the minCount as well as w/h. I don't see why that wouldn't work.

Sir R. M8gic1an

2011-01-07 15:14:16

From: Coh3n
Pretty sure it's still in SRL.



Yeah, could increase the minCount as well as w/h. I don't see why that wouldn't work.


TrackObject doesn't currently take minCount into account ;)

~RM

Coh3n

2011-01-12 01:51:31

@Tom: I updated the record for normal trees a couple days ago. It should be significantly better now. :)

TomTuff

2011-01-12 02:04:12

I wish i had the drive to test it, but I really don't as my player has >15 wc now (>40 in fact lol). I just reported so people don't have problems with it in the future. Thanks though :)

Coh3n

2011-01-12 02:05:30

From: TomTuff
I wish i had the drive to test it, but I really don't as my player has >15 wc now (>40 in fact lol). I just reported so people don't have problems with it in the future. Thanks though :)

Yeah no problem. Turns out the colors really needed some updating also. :)