SRL Archive - RS3 Help

Help with a function


Element17

2014-07-05 02:57:55

I just don't know how to do it really. I guess I could make a box around the player and search for the player dot inside the box.
It is also late here sorry… :/

{

Want to search X-distance from yourself and then give result for below function

}
function checkForPlayer(): boolean;
var
dot: TPointArray;
begin
if not isloggedIn() then
exit;
dot := minimap.getDots(MM_DOT_PLAYER, minimap.getBounds());
if (length(dot) > 2) then
begin
writeln('Found' +toStr(length(dot)) + 'Players on the minimap');
result := true;
exit;
end;
writeln('Not enough players found on the minimap to care');
end;

The Mayor

2014-07-05 07:21:28

From: Element17
I just don't know how to do it really. I guess I could make a box around the player and search for the player dot inside the box.
It is also late here sorry… :/

{

Want to search X-distance from yourself and then give result for below function

}
function checkForPlayer(): boolean;
var
dot: TPointArray;
begin
if not isloggedIn() then
exit;
dot := minimap.getDots(MM_DOT_PLAYER, minimap.getBounds());
if (length(dot) > 2) then
begin
writeln('Found' +toStr(length(dot)) + 'Players on the minimap');
result := true;
exit;
end;
writeln('Not enough players found on the minimap to care');
end;


Something like:


function checkForPlayer(distance: integer): boolean; //distance parameter
var
dots: TPointArray;
begin
if not isLoggedIn() then
exit;
// Put all player dots in TPA
dots := minimap.getDots(MM_DOT_PLAYER, minimap.getBounds());

//exclude points that are outside of the min/max (which is 0 and distance) and sorted from minimap middle
dots.excludePointsDist(0, distance, minimap.getBounds.getMiddle.x, minimap.getBounds.getMiddle.y)

if (length(dots) > 2) then
begin
writeln('Found' +toStr(length(dots)) + 'Players on the minimap');
exit(true);
end;

writeln('Not enough players found on the minimap to care');

end;

Element17

2014-07-05 13:32:20

Looks great! Testing right now thank you! Credits will be given!