Log in

View Full Version : GetMiniMapDots ?



bg5
05-16-2012, 06:06 PM
GetMiniMapDots doesn't work for me ,always returns empty tpa. Anyone can test and confirm?

Harry
05-16-2012, 06:11 PM
What kind of dots are you searching for?

bg5
05-16-2012, 06:22 PM
white , yellow , red.

Brandon
05-16-2012, 06:29 PM
white , yellow , red.

try:

'player', 'npc', 'item'.

Does that work? Did you select the client? Maybe all the colours changed again :S

bg5
05-16-2012, 06:38 PM
Everything other is running well.

Maybe all the colours changed again

That's what I think ,colours changed or it's something wrong with my simba.

Brandon
05-16-2012, 06:49 PM
Everything other is running well.


That's what I think ,colours changed or it's something wrong with my simba.

Can I have the version of Simba your running? Click the help menu then about and paste all the about info here.. Specifically the version and FPC version.

WHY? Because when I run:

{$DEFINE SMART}
{$I SRL/SRL.Simba}

begin
Smart_Server := 72;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
writeln(GetMiniMapDots('npc'));
end.


It results in:

Compiled successfully in 1077 ms.
SRL Compiled in 15 msec
SMART Initialized.
Loaded: Server 72, Members: True, Signed: True, Super Detail: False.
[]
Successfully executed.


Which is false as there is 10+ NPC's on my screen at Zanaris bank.

Now I got someone on MSN to test it with a different version and it works for them. I want to confirm if you have the same version as I. If your version is 984 then it's the include. If your version is 990 then it's Simba.

bg5
05-16-2012, 06:57 PM
I have 990 too

Simba is released under the GPL license.
You are currently using version: 990
Compiled with FPC version 2.4.4

But why only this function doesn't work? I have bunch of FindcolorsTolerance with cts2 and finding DTMs with cts1 in script ,and they works corectly.

Brandon
05-16-2012, 07:05 PM
I have 990 too


But why only this function doesn't work? I have bunch of FindcolorsTolerance with cts2 and finding DTMs with cts1 in script ,and they works corectly.

Iunno :S That's the odd part lol. I tested other functions and they work..

That GetMinimap function seems to have the same problem as the MakeCompass.

Both of them findcolorspie for 65536 which is black. Makecompass was fixed by setting it to 0 or adding a tolerance.. This one unfortunately that doesn't fix it.

Brandon
05-16-2012, 07:27 PM
Figured it out.. Any function using FilterPointsPie or FindColorsPie is broken.. That's for sure. Something is wrong with that function in Simba 990

Thus any minimap functions are going to be broken.. You can even confirm this by:

{$DEFINE SMART}
{$I SRL/SRL.Simba}

function GMM(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;

FindColorsTolerance(TPA, 65536, MMX1, MMY1, MMX2, MMY2, 1);
writeln(TPA); //TPA Will print everything found.. This is a hell of a lot!
FilterPointsPie(TPA, 0.0, 360.0, 0.0, 75.0, MMCX, MMCY);

writeln(TPA); //This prints absolutely nothing! Also tested other minimap functions, all that use filterpoints or findcolorspie are broken.
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;

var
X, Y: Integer;
begin
Smart_Server:= 72;
Smart_Members:= True;
Smart_Signed:= True;
Smart_SuperDetail:= False;

SetupSRL;
MakeCompass('N'); //To test if it's broken.. It's not.. It does not use FindColorsPie or FilterPointsPie..
writeln(GMM('npc', MMX1, MMY1, MMX2, MMY2)); //Completely broken..
end.



Running ToggleXPBar will throw errors at you as well.. Just downgrade and save yourself for now.. if u can.

ReadySteadyGo
05-16-2012, 07:31 PM
https://github.com/MerlijnWajer/Simba/commit/56a74cf624463ad4278308103552609cfff755a1

Looking into it.

Brandon
05-16-2012, 07:35 PM
https://github.com/MerlijnWajer/Simba/commit/56a74cf624463ad4278308103552609cfff755a1

Looking into it.

Works with:

Function FilterPointsCircle(TPA: TPointArray; MX, MY, Radius: Integer): TPointArray;
var
I, L: Integer;
begin
L:= High(TPA);
For I:= 0 To L do
begin
if (InCircle(TPA[I].X, TPA[I].Y, MX, MY, Radius)) then
begin
SetLength(Result, Length(Result) + 1);
Result[I + 1]:= TPA[I];
end;
end;
end;

function GMM(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;

FindColorsTolerance(TPA, 65536, MMX1, MMY1, MMX2, MMY2, 1);
TPA:= FilterPointsCircle(TPA, MMCX, MMCY, 75);

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;

var
X, Y: Integer;
NPCs: TPointArray;
begin
Smart_Server:= 72;
Smart_Members:= True;
Smart_Signed:= True;
Smart_SuperDetail:= False;

SetupSRL;
MakeCompass('N'); //To test if it's broken.. It's not.. It does not use FindColorsPie or FilterPointsPie..
NPCs:= GMM('npc', MMX1, MMY1, MMX2, MMY2);
SortTPAFrom(NPCs, Point(MMCX, MMCY));
MMouse(NPCs[0].X, NPCs[0].Y, 0, 0);
end.

ReadySteadyGo
05-16-2012, 07:42 PM
EndD is returning 0.0 when 360.0 is the input?

bg5
05-16-2012, 07:50 PM
Any function using FilterPointsPie or FindColorsPie is broken..
I know now why...

Everywhere in SRL include there is:

FilterPointsPie(TPA, 0, 360, 0, 12, 534, 63);

So it's mean: filter all points from angle 0 to 360...
But basically angle 0 = 360 ,lol. So somewhere in function FilterPointsPie there is iteration from 0 to 0...
I didn't look enought into tpa.pas to check how angle is converted ,but if you change 0 to 0.1 it works. So no need to downgrade ,just change in SRL everywhere first angle:

FilterPointsPie(TPA, 0.01, 360, 0, 12, 534, 63);

ReadySteadyGo
05-16-2012, 07:52 PM
Don't do that beginner5! It just needs fixing. :)

I'll submit a pull request after tea.

E: Done. https://github.com/MerlijnWajer/Simba/pull/108

masterBB
05-17-2012, 02:32 PM
Sorry guys ;)

I committed Richard his code but forgot to check if it worked.