PDA

View Full Version : Help with a function



Element17
07-05-2014, 06:57 AM
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
07-05-2014, 11:21 AM
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
07-05-2014, 05:32 PM
Looks great! Testing right now thank you! Credits will be given!