GetMiniMapDotsIn would return an excess violation if no dots were found. Because it would be setting a length of '-1'.
Added a try and except block:
SCAR Code:
function GetMiniMapDotsIn(WhatDot: string; x1, y1, x2, y2: Integer): TPointArray;
var
Color: Integer;
begin
WhatDot := LowerCase(WhatDot);
case WhatDot Of
'npc', 'yellow': Color := 60909;
'cape', 'blue': Color := 12742980;
'item', 'red': Color := 789758;
'player', 'white': Color := 16711422;
'friend', 'green': Color := 61440;
else
srl_Warn('GetMiniMapDotsIn', '"' + WhatDot + '" is not a valid dot type', warn_AllVersions);
end;
FindColorsSpiralTolerance(MMCX, MMCY, Result, Color, x1, y1, x2, y2, 0);
RAaSTPA(Result, 4);
if (WhatDot = 'player') or (WhatDot = 'white') then
try
InvertTPA(Result);
SetLength(Result, Length(Result) - 1);
InvertTPA(Result);
except srl_Warn('GetMiniMapDotsIn', 'No Dots of '+WhatDot+' Found', warn_AllVersion);
end;
end;