SRL Archive - OSR Help

Clusters of People


Bad Boy JH

2010-02-04 05:52:09

Now for my upcoming script I am looking to find a group of people, because that would be a very good indicator of where the next tree will be, because people tend to cluster around the next tree to spawn, so here is what I have so far.
Procedure GroupofPeople;
var
x, y:integer;
TPA:TPointArray;
ATPA:T2DPointArray;
begin
findcolorstolerance(TPA, 16777215, MMX1, MMY1, MMX2, MMY2, 10);
RemoveDistTPointArray(MSCX, MSCY, 5, TPA, False);
ATPA := SplitTPAEx(TPA, 4, 4);
for i:=0 to high(ATPA) do
TPA[i] := middleTPA(ATPA[i]);
//so far each TPA value is a person
end;

So what I need is a function to find a cluster of the TPoints, which would indicate the largest grouping of people…

Just an update on how the script is going…
So far I have a pretty good woodcutting procedure and this will finish it off, and I have a fairly simple Radial Walking Procedure to get me to the willows,

Sex

2010-02-04 07:35:18

Well you could just try sorting the ATPA from size and use the first index..

Edit: Sorry, it is 5am, I'm not thinking correctly. How about splitting it into an ATPA and then checking the sizes of each index and whichever one is bigger is your cluster?

mixster

2010-02-04 12:00:20

SplitTPA/Ex creates an ATPA based on distances between a point and any other point in that cluster/array, so you can just assume the largest TPA in the ATPA is the place where the most people are gathered. TPAToATPA/Ex is what breaks them into groups that are no bigger than the specified params.

Naum

2010-02-04 12:16:46

Further to what mixster said, you can use the current function in MapWalk.Scar which grabs a TPA of all 'specified' dots.
For example:

Procedure GroupOfPeople(Dist : Integer);
Var ATPA : T2DPointArray;
TPA : TPointArray;
MaxDist, Index, I : Integer;
Begin
TPA := GetMiniMapDotsIn('white', MMX1, MMY1, MMX2, MMY2);
ATPA := SplitTPA(TPA, Dist);

For I := 0 To High(ATPA) Do
If Length(ATPA[I]) > MaxDist Then
Begin
MaxDist := Length(ATPA[I]);
Index := I;
End;

TP := MiddleTPA(ATPA[Index]);
Mouse(TP.x, TP.y, 0, 0);
End;

I typed this up in the edit, hence the fact i'm not sure it works. However, this should serve as an example of how to make it. :)

Bad Boy JH

2010-02-04 23:00:27

Thanks, didn't check out all the functions, It was fairly late here, when I was doing it, and so I just whipped it up…

Ok, I'll fix up your function if it doesn't work, and use it, thanks for the help man!

EDIT: SortATPASize, does what you tried to do with a couple of lines of code…I have it working now…