SRL Archive - SRL Archives

Autocolor NPCs + GetNPCsIn();


marpis

2009-05-06 17:22:41

I made this function to find all NPCs in MM.
It is very accurate, but if the NPCs are right next to each other it sometimes only notices the other. That shouldn't be a big deal anyway…


edit: removed autocolor, because it was proved useless :( b-b-but i did my best!
edit2: now its even shorter

// GetNPCsIn by marpis
function GetNPCsIn(x1, y1, x2, y2: integer): TPointArray;
begin
FindColorsSpiralTolerance(MMCX, MMCY, result, 1179390, x1, y1, x2, y2, 18);
RAaSTPA(result, 4);
SortTPAFrom(result, Point(MMCX, MMCY));
end;


Naike

2009-05-06 18:30:19

Ain't MM NPC/Drop dots static?

Nice anyways..

Floor66

2009-05-06 18:37:52

Nope. They aren't static ;(

nielsie95

2009-05-06 19:27:16

Are we talking about those yellow dots? Because I'm pretty sure they all have 195836 (static) in them.

Naum

2009-05-06 19:46:37

Won't be added, I did something like this before:

{*******************************************************************************
function DotsOnMap(WhatDot : String) : integer;
By: Idea By footballjds Extended by NaumanAkhlaQ
Description: Counts the specified dot on the minimap,
not including your own player.
Usage : 'npc', 'yellow' : Yellow Dot;
'cape', 'blue' : Blue Dot;
'item', 'red' : Red Dot;
'player', 'white' : White Dot;
'friend', 'green' : Green Dot;
*******************************************************************************}
function DotsOnMap(WhatDot : String) : integer;
var
Dotz : TPointArray;
Col0r : Integer;
begin
Case LowerCase(WhatDot) Of
'npc', 'yellow' : Col0r := 60909;
'cape', 'blue' : Col0r := 12742980;
'item', 'red' : Col0r := 789758;
'player', 'white' : Col0r := 16711422;
'friend', 'green' : Col0r := 61440;
end;
FindColorsTolerance(Dotz, Col0r, MMx1, MMy1, MMx2, MMy2, 19);
RAaSTPA(Dotz, 4);
Result := GetArrayLength(Dotz);
if (LowerCase(WhatDot) = 'player' or 'white') then Dec(Result);
If Result = 0 Then
WriteLn('No '+IntToStr(WhatDot)+' Dots FOUND On Map');
end;

lordsaturn

2009-05-06 20:04:48

From: Floor66
Nope. They aren't static ;(


Every color in every mm dot is static.

marpis

2009-05-06 21:44:38

From: NaumanAkhlaQ
Won't be added, I did something like this before:


I think your function would be better if it returned TPA


function DotsOnMap(WhatDot : String) : TPointArray;
var
Dotz : TPointArray;
Col0r : Integer;
begin
Case LowerCase(WhatDot) Of
'npc', 'yellow' : Col0r := 60909;
'cape', 'blue' : Col0r := 12742980;
'item', 'red' : Col0r := 789758;
'player', 'white' : Col0r := 16711422;
'friend', 'green' : Col0r := 61440;
end;
FindColorsTolerance(Dotz, Col0r, MMx1, MMy1, MMx2, MMy2, 19);
RAaSTPA(Dotz, 4);
Result := Dotz;
SortTPAFrom(result, Point(MMCX, MMCY));
If Length(Result) = 0 Then
WriteLn('No '+WhatDot+' Dots FOUND On Map');
end;
didnt test this one tho'

n3ss3s

2009-05-06 21:53:32

Autocoloring MM dots is fail…

Floor66

2009-05-06 21:57:25

From: lordsaturn
Every color in every mm dot is static.


;O really.

Shuttleu

2009-05-06 22:01:37

yellow dots are static (take a look at UCB) it uses the banker dots to walk up to the bank booth

~shut

Floor66

2009-05-06 22:11:59

Ah. My chopper uses a DTM of the bankers (works too :p)

Nava2

2009-05-08 01:37:45

{*******************************************************************************
function GetMiniMapDotsIn(WhatDot: String; x1, y1, x2, y2: Integer): TPointArray;
By: footballjds, NaumanAkhlaQ and Nava2
Description: Results the dots specified by WhatDot in x1, y1, x2, y2.
Usage : 'npc', 'yellow' : Yellow Dot;
'cape', 'blue' : Blue Dot;
'item', 'red' : Red Dot;
'player', 'white' : White Dot;
'friend', 'green' : Green Dot;
*******************************************************************************}
function GetMiniMapDotsIn(WhatDot: String; x1, y1, x2, y2: Integer): TPointArray;
var
Color: Integer;
begin
Case LowerCase(WhatDot) Of
'npc', 'yellow' : Color := 60909;
'cape', 'blue' : Color := 12742980;
'item', 'red' : Color := 789758;
'player', 'white' : Color := 16711422;
'friend', 'green' : Color := 61440;
end;
FindColors(Result, Color, x1, y1, x2, y2);
RAaSTPA(Result, 4);
if (LowerCase(WhatDot) = 'player' or 'white') then Dec(Result);
end;

{*******************************************************************************
function GetMiniMapDotsIn(WhatDot: String): TPointArray;
By: Nava2
Description: Results the dots specified by WhatDot on the Minimap. See GetMiniMapDots
in for more information.
*******************************************************************************}
function GetMiniMapDots(WhatDot: String): TPointArray;
begin
Result := GetMinimapDotsIn(WhatDot, MMX1, MMY1, MMX2, MMY2);
end;

{*******************************************************************************
function CountDots(WhatDot: String): integer;
By: Nava2
Description: Counts the occurance of WhatDot on the MiniMap. See GetMiniMapDots
in for more information.
*******************************************************************************}
function CountDots(WhatDot: String): integer;
begin
Result := Length(GetMinimapDots(WhatDot));
end;

Committed.