Results 1 to 3 of 3

Thread: Help finding Fairy Ring using color

  1. #1
    Join Date
    Feb 2018
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help finding Fairy Ring using color

    Hi, first of all allow me to thank you for all this work over the years.
    Now to my question. Right now as my first script I'm working on a karambwan fisher, basically it's supposed to fish karambwans at the DKP fairy ring, teleport and bank at Camelot, quest cape teleport and use the fairy ring there to teleport back to the Karambwan spot.
    Well so far I managed to do everything except for the fairy ring part because atleast for me it's impossible to find a unique color and even if I manage to, the clickboxes of the rings are really wacky. I've looked into the surface system (can't post links if I'm below 5 posts) but I think that it's outdated. Is there any way of getting similar results with AeroLib? Basically being able to detect the fairy ring as a whole? Obviously I don't except fleshed out code but a push into the right direction would be appreciated!

  2. #2
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Here is the function:
    Simba Code:
    function FindFairyRing(): TPoint;
    const
      COLOR = 4540484; //background color and tolerance
      TOL = 86;
    var
      BackgroundTPA, BoxTPA, InverseTPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      if FindColorsTolerance(BackgroundTPA, COLOR, 0, 0, 300, 300, TOL) then //just change the coordinate to the mainscreen
      begin
        BoxTPA := TPAFromBox([0, 0, 300, 300]); //use the mainscreen box
        InverseTPA := ClearTPAFromTPA(BoxTPA, BackgroundTPA);
        ATPA := ClusterTPA(InverseTPA, 1);
        FilterTPAsBetween(ATPA, 0, 5); //adjust these filters as needed
        FilterTPAsBetween(ATPA, 100, 1000000);
        ATPA := ClusterTPA(MergeATPA(ATPA), 20); //adjust cluster distance as needed
        SortATPASize(ATPA, True);
        if (Length(ATPA) < 1) then Exit;
        Result := MedianTPA(ATPA[0]);
      end;
    end;
    and here is the result:

    (a random picture I found online)

    You don't actually need more than one TPA variable, but I didn't want the logic to get too muddy.
    This will work too:
    Simba Code:
    ATPA := ClusterTPA(ClearTPAFromTPA(TPAFromBox([0, 0, 300, 300]), BackgroundTPA), 1);
    Last edited by Citrus; 03-08-2018 at 01:48 PM.

  3. #3
    Join Date
    Feb 2018
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you, I'll try implementing it into my script later today.

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
  •