PDA

View Full Version : [Resolved] How does getMinimapDotsIn work?



rj
02-09-2014, 06:19 PM
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
02-09-2014, 06:23 PM
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
02-09-2014, 06:24 PM
E: sorry, getting confused ;) SRL6 has got to me

rj
02-09-2014, 06:27 PM
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
02-09-2014, 06:29 PM
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
02-09-2014, 06:33 PM
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.

http://img543.imageshack.us/img543/3210/hsfv.png

Tried to different colors - 65536 for the dif

masterBB
02-09-2014, 06:38 PM
http://i.imgur.com/FlQiav4.png

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
02-09-2014, 07:04 PM
http://i.imgur.com/FlQiav4.png

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
02-09-2014, 09:40 PM
I love these kind of questions.

rj
02-09-2014, 09:45 PM
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)