Is does track the shape Markus. It can't track the shape the way you'd do it because the shapes change as you move, due to distance to endpoint.
Also, 60 seconds has nothing to do with object tracking. Any kid knows how do find that in WaitWhileMining.
I'm glad you've shown you made it through a few tutorials while using MSI.
Also, it's not the tracking, it's WaitWhileMining.
And oh yeh, I agree with Coh3n, 80-90% accuracy in tracking is nothing compared to what could be done with hybrid :)
{******************************************************************************}
{ 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));
if (MSI_SetupVars[SETUP_DEBUG_SMART]) then
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('MSI_TrackObject: ' + BoolToStr(Result));
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(2);
end;
I've been better than you since MR Alcher. oops. Didn't mean to say that.
However I guess we could capture the shape and project it on the predicted line of the rock (object) and look for an instance of it there, rather than expecting the shape to be at point x.
I'm not sure how you'd triangulate your way out of this one, but I guess you could.