Results 1 to 4 of 4

Thread: TBox to ATPA?

  1. #1
    Join Date
    Jan 2012
    Location
    Long Island, NY
    Posts
    413
    Mentioned
    5 Post(s)
    Quoted
    95 Post(s)

    Default TBox to ATPA?

    This might seem a little weird but I want to convert an array of TBoxes to an array of TPAs.

    Normally I would just use TPA.toATPA() but the colors aren't unique in the area and it creates issues when splitting the box since the objects closer to the camera and larger than those further. However a grid of TBoxes is consistent and seems the best way to search. So I thought of something, and I could be wrong but try to follow my logic(it's early so I could be doing something far more difficult than needed).

    My objects are in a fixed grid, and I have 12 TBoxes to search for the colors inside of. So here's my logic behind the steps...
    Simba Code:
    fucntion clickThings() : Boolean;
    begin
      for i:=0 to 11 do
      begin
        if color in tbox[i] then
          create tpa from tbox[i];
      end;
      add tpa to atpa;
      sort atpa by distance;
      click on x,y;
    end;

    This is just rough code but the steps are:
    1)Search for color in each of our 12 TBoxes(as a TBox Array)
    2)If color exists in box(maybe do a color count) then create TPA for that box
    3)Add TPAs to ATPA
    4)Sort ATPA by distance
    5)Click on ATPA[i] if uptext is correct

    My only thing I don't see in the documentation is how to add multiple TPAs to the index of an ATPA.

    Like I said splitATPA just doesn't work for this situation(it does but the colors do get screwy and make it unreiable). This grid of TBoxes is 100% accurate and doesn't change in the game world.

    So 2 questions, how to I combine my TPAs(12 separate ones in this case into an ATPA). Or could I limit the search area for my color search to make a TPA and then splitATPA to the array of TBoxes? Other question, if there's an easier method or one that makes more sense please share. Thanks!

  2. #2
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    I'm not entirely clear what you are trying to do, but u can use TPAFromBox() to get tpa from a box, and for 'combine my TPAs(12 separate ones in this case into an ATPA)'
    Simba Code:
    SetLength(atpa, length(boxes));
    for i:=0 to high(boxes) do
      FindColors(atpa[i], ... boxes[i]);
    tpa := MergeATPA(atpa);

  3. #3
    Join Date
    Jun 2014
    Location
    Oklahoma
    Posts
    336
    Mentioned
    22 Post(s)
    Quoted
    231 Post(s)

    Default

    I really don't think there is reason to convert the Tboxes to an ATPA other then to sort it from distance. You could just have your original array of tboxes sorted by distance, then resort it based on if it has the color in it or not.

  4. #4
    Join Date
    Jan 2012
    Location
    Long Island, NY
    Posts
    413
    Mentioned
    5 Post(s)
    Quoted
    95 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    I'm not entirely clear what you are trying to do, but u can use TPAFromBox() to get tpa from a box, and for 'combine my TPAs(12 separate ones in this case into an ATPA)'
    Simba Code:
    SetLength(atpa, length(boxes));
    for i:=0 to high(boxes) do
      FindColors(atpa[i], ... boxes[i]);
    tpa := MergeATPA(atpa);
    Thanks was trying to figure out what function to use, that did the trick.

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
  •