SRL Archive - RS3 Help

How does getMinimapDotsIn work?


rj

2014-02-09 13:19:57

How does this function work?

function GetMiniMapDotsIn(WhatDot: String; x1, y1, x2, y2: Integer): TPointArray;
var
I, Dif, Radius, Hi, C: Integer;
TPA: TPointArray;
begin
case LowerCase(WhatDot) of
'npc', 'n', 'yellow', 'y': Dif := 4369;
'item', 'i', 'red', 'r': Dif := 23;
'player', 'p', 'white', 'w': Dif := 1907997;
'friend', 'f', 'green', 'g': Dif := 5376;
'team', 't', 'blue', 'b', 'cape': Dif := 2171941;
{'clan', 'c', 'orange', 'o': Dif := -1;}
else
srl_Warn('GetMiniMapDotsIn', '"' + WhatDot + '" is not a valid dot type', warn_AllVersions);
end;
Freeze;
Radius := Max((x2-x1)div 2, (y2-y1)div 2);
FindColorsPie(TPA, 65536, 0, 0, 360, 0, radius, x1, y1, x2, y2, (x1+x2)div 2, (y1+y2)div 2);
Hi := High(TPA);
SetLength(Result, Hi + 1);
if (Hi < 0) then
begin
UnFreeze;
Exit;
end;
C := 0;
for I := 0 to Hi do
begin
if (GetColor(TPA[I].X-1, TPA[I].Y-1) - GetColor(TPA[I].X, TPA[I].Y-1) = Dif) then
begin
Result[C] := Point(TPA[I].x, TPA[i].y - 2);
Inc(C);
end;
end;
Unfreeze;
SetLength(Result, C);
end;


More specifically, what is the significance of the variable 'dif'

I am trying to get all the reds dots on a 317 server, and I have tried putting all numbers from 0 to 40,000 for dif (literally added an extra parameter to the function and did a 0 to 40,000 for loop with no results) and none of them find the red dots on the minimap


Doubt these people are active but they are the Authors:

@Nava;
@Rasta Magician;

masterBB

2014-02-09 13:23:26

Dif is the difference between two colors. It is actually a VERY bad method of comparing method. GetColor returns red * 1 + green * 256 + blue * 65536

Someone should rewrite this one with a more useful color compare.

e: Nvm this, it is all static. my memory so bad.

The Mayor

2014-02-09 13:24:34

E: sorry, getting confused ;) SRL6 has got to me

rj

2014-02-09 13:27:20

From: masterBB
Dif is the difference between two colors. It is actually a VERY bad method of comparing method. GetColor returns red * 1 + green * 256 + blue * 65536

Someone should rewrite this one with a more useful color compare.


So the red dots are different colors this means this is inaccurate?

masterBB

2014-02-09 13:29:27

Ah, I remember how it worked again. it was the difference in color between two specific points in the dot. This difference was always static. Therefor the accuracy wasn't important.

e: post an image of the mm and I will draw arrows and stuff to explain.

rj

2014-02-09 13:33:57

From: masterBB
Ah, I remember how it worked again. it was the difference in color between two specific points in the dot. This difference was always static. Therefor the accuracy wasn't important.

e: post an image of the mm and I will draw arrows and stuff to explain.



Tried to different colors - 65536 for the dif

masterBB

2014-02-09 13:38:03


Pick the colors of the bottom two yellow points. There difference should be Dif. The black shadow is what you search for with findcolorspie.

E:
Shadowcolor is 65536.
Dif = 56797 - 52428 (not sure if negative)

rj

2014-02-09 14:04:44

From: masterBB

Pick the colors of the bottom two yellow points. There difference should be Dif. The black shadow is what you search for with findcolorspie.

E:
Shadowcolor is 65536.
Dif = 56797 - 52428 (not sure if negative)


thanks

masterBB

2014-02-09 16:40:40

I love these kind of questions.

rj

2014-02-09 16:45:55

From: masterBB
I love these kind of questions.


Usually I can figure out how to convert most of the SRL5 functions to my own, and sometimes for something that seems like a small change required requires a near complete rewrite (724 getChooseOptions and 317 choose options)