Results 1 to 5 of 5

Thread: Clusters of People

  1. #1
    Join Date
    Dec 2009
    Location
    Newcastle, Australia
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Clusters of People

    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.
    SCAR Code:
    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,
    Last edited by Bad Boy JH; 02-04-2010 at 10:55 AM.

  2. #2
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    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?
    Last edited by Sex; 02-04-2010 at 12:41 PM.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  3. #3
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    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.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  4. #4
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

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

    SCAR Code:
    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.

  5. #5
    Join Date
    Dec 2009
    Location
    Newcastle, Australia
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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...
    Last edited by Bad Boy JH; 02-05-2010 at 05:35 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •