Results 1 to 5 of 5

Thread: Finding colors within a a specified distance of a ATPA?

  1. #1
    Join Date
    Mar 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default Finding colors within a a specified distance of a ATPA?

    How would I cycle through a T2DPointArray using a for loop ofc, I can't find a size function in the docs.

    Also for each TPA in the array I need to search through a list of colors/ATPA's and find the closest one to the original ATPA.

    Not sure if this make sense.
    I'm trying to identify siphoning nodes in runespan.

  2. #2
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    wait, you need to find the closest tpa to a array of tpas? Or the tpa in a 2d array that is closest to another tpa?

  3. #3
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by JJordan View Post
    How would I cycle through a T2DPointArray using a for loop ofc, I can't find a size function in the docs.

    Also for each TPA in the array I need to search through a list of colors/ATPA's and find the closest one to the original ATPA.

    Not sure if this make sense.
    I'm trying to identify siphoning nodes in runespan.
    For the first question, if I understand correctly:

    Simba Code:
    ATPA : T2DPointArray;
    i : Integer;

    //...

    for i := 0 to high(ATPA) do
    begin
      ATPA[i].anyFunction //ATPA[i] will give you the i(th) index of the ATPA, meaning you are working with a TPA and can use any TPA functions you want
    end;

    For the second one, I assume you mean "close" as in distance because of the title of the thread. For that, you should use a sorting function. There are many (look through the Simba docs to see them) but here's an example of one. I'm not sure what you mean by "the TPA closest to the ATPA" because all TPAs are inside of the bounds of the ATPA so there's not really a "closest" when they're all inside.

    Simba Code:
    ATPA.sortFromMidPoint(mainScreen.getCenterPoint());

    So that sorts all the TPAs in the ATPA based on the center of the mainscreen. Then ATPA[0] would be closest to the center of the screen. You just need to figure out what point you're sorting from, because you're kinda vague about that.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  4. #4
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

  5. #5
    Join Date
    Mar 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    Quote Originally Posted by 3Garrett3 View Post
    For the first question, if I understand correctly:

    Simba Code:
    ATPA : T2DPointArray;
    i : Integer;

    //...

    for i := 0 to high(ATPA) do
    begin
      ATPA[i].anyFunction //ATPA[i] will give you the i(th) index of the ATPA, meaning you are working with a TPA and can use any TPA functions you want
    end;

    For the second one, I assume you mean "close" as in distance because of the title of the thread. For that, you should use a sorting function. There are many (look through the Simba docs to see them) but here's an example of one. I'm not sure what you mean by "the TPA closest to the ATPA" because all TPAs are inside of the bounds of the ATPA so there's not really a "closest" when they're all inside.

    Simba Code:
    ATPA.sortFromMidPoint(mainScreen.getCenterPoint());

    So that sorts all the TPAs in the ATPA based on the center of the mainscreen. Then ATPA[0] would be closest to the center of the screen. You just need to figure out what point you're sorting from, because you're kinda vague about that.

    Thanks this is what I was looking for, I'm not really sure how to accomplish my goal so I'm just going through trial and error. I hate pascal as a language it seems like it tries to hard to be different than other languages.

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
  •