euphemism
2011-11-14 17:10:33
The dot-finding in SRL hasn't seemed to be working for me, so I wrote this to replace it. It doesn't have friend, team, or clan dots at the moment, but it appears to work very well.

E: Rewrote to provide backwards-compatibility with scripts using the current SRL functions. Supports NPCs, team capes, items, players, friends, and clan members. Team cape (blue) dots, and clan member (orange) dots remain untested; they should work, though. A random player in the game was nice enough to friend me so I could test the friend dot.
Note: I am using FindColorsPie inside GetMiniMapDotsIn because it is awfully convenient. Can I use other include functions like that? Also, FindColorsPie needs a center x and y, but GetMiniMapDotsIn doesn't have that, so I can't add parameters for the center x and y without breaking compatibility with current scripts. Thoughts?

E: Rewrote to provide backwards-compatibility with scripts using the current SRL functions. Supports NPCs, team capes, items, players, friends, and clan members. Team cape (blue) dots, and clan member (orange) dots remain untested; they should work, though. A random player in the game was nice enough to friend me so I could test the friend dot.
{*******************************************************************************
function GetMiniMapDotsIn(WhatDot: String; x1, y1, x2, y2: Integer): TPointArray;
By: euphemism
Description: Results the dots specified by WhatDot in the box x1, y1, x2, y2.
Usage : 'npc', 'yellow', 'n', 'y' : Yellow Dot;
'cape', 'blue', 'team', 't', 'b' : Blue Dot;
'item', 'red', 'i', 'r' : Red Dot;
'player', 'white', 'p', 'w' : White Dot;
'friend', 'green', 'f', 'g' : Green Dot;
*******************************************************************************}
function GetMiniMapDotsIn(WhatDot: String; x1, y1, x2, y2: Integer): TPointArray;
var
DotColor, Radius: Integer;
begin
case LowerCase(WhatDot) of
'npc', 'n', 'yellow', 'y': DotColor := 61937;
'item', 'i', 'red', 'r': DotColor := 237;
'player', 'p', 'white', 'w': DotColor := 15527148;
'friend', 'f', 'green', 'g': DotColor := 60160;
'team', 't', 'blue', 'b', 'cape': DotColor := 9917996;
'clan', 'c', 'orange', 'o': DotColor := 1604816;
else
srl_Warn('GetMiniMapDotsIn', '"' + WhatDot + '" is not a valid dot type', warn_AllVersions);
end;
Radius := Max((x2-x1)/2, (y2-y1)/2);
FindColorsPie(Result, DotColor, 0, 0, 360, 0, radius, x1, y1, x2, y2, (x1+x2)/2, (y1+y2)/2);
RAaSTPAEx(Result, 1, 1);
end;
Npc:
Player:
Friend:
Teammate:
Friend chat user:
Clanmate:
"P" symbol: