Results 1 to 14 of 14

Thread: Tpa/atpa help

  1. #1
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default Tpa/atpa help

    Greetings, I am trying to create a function that checks the minimap if zulrah is spawned. However I want it not to return a false postive if the snakelins are found. So what I was thinking to create two atpas one for the yellow color of the dots on minimap clustered, and another with the main background of the zulrah area on minimap the green. Because if it finds the green and not the gray area it will only be zulrah. So take these two atpas filter the distance of the minimap radius, then use the middle point of each found yellow cluster to draw a box around the area maybe 5x5. This point looped through each atpa should then be used with nearbypointin function of the dark green cluster tpa to tell me if zulrah is spawned?

    Note this a rsps and I'm not using any includes.
    Last edited by imalama101; 10-22-2018 at 05:23 PM.

  2. #2
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    Uhm, i think you are making it way more complicated than it should be?

    Isnt zulrah way bigger than the snakelings? You should just filter the TPAs for bigger amount of pixels and the snakelings wont return positive anymore
    Formerly known as Undorak7

  3. #3
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    The thing is you can't really see the whole area from just standing at one point. There fore the monsters can be spawned and you might not be able to see them once in a while. Using the minimap works for me, I am just trying to nail this down in this manner described above.

  4. #4
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    No idea if this will work, was just a quick janky mock up.

    You will need to adjust the colors for the minimap and terrain.

    Simba Code:
    function FindZulrahMM(var pnt:Tpoint):boolean;
    var
      tpa:TPointArray;
      ATPA:T2DPointArray;
      i, x, y:integer;
      Bounds:Tbox;
    begin
      if FindColors(tpa, 4369, 570, 9, 714, 155) then
      begin
        ATPA := ClusterTPAEx(TPA, 1, 1);
        if Length(ATPA) < 1 then Exit;
        for i := 0 to high(ATPA) do
        begin
          Bounds := GetTPABounds(ATPA[i]);
          Bounds := [Bounds.X1-1, Bounds.Y1-1, Bounds.X2+1, Bounds.Y2+1];
          if FindColor(x, y, 12345, Bounds.X1, Bounds.Y1, Bounds.X2, Bounds.Y2) then
          begin
            pnt := MiddleTPA(ATPA[i]);
            exit(true);
          end;
        end;
        result := false;
      end;
    end;

  5. #5
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Haven't used simba in many months... how'd i do? It may need to be adjusted, and might not be the best way to do it. I based it off this picture



    Simba Code:
    {$I SRL/OSR.simba}

    var
      BOUNDS: TBox = [222, 129, 334, 242];

    function IsZulrahVisible(): boolean;
    var
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      //Find the greenish background
      if (SRL.FindColors(TPA, CTS2(6119247, 3, 11.81, 2.89), BOUNDS) > 0) then
      begin
        //return everything that isn't a part of it
        //the snakelings should be clustered in with the walkable 'u' shaped area
        TPA := ReturnPointsNotInTPA(TPA, BOUNDS);
        ATPA := ClusterTPA(TPA, 3);
        FilterTPAsBetween(ATPA, 0, 25);
        //45 is about the size of a minimap dot
        SortATPAFromSize(ATPA, 45, true);
        Result := (Length(ATPA) > 0) and InRange(Length(ATPA[0]), 35, 60);
      end;
    end;

    begin
      WriteLn(IsZulrahVisible());
    end.
    Last edited by jstemper; 10-22-2018 at 11:21 PM. Reason: used an include, thug life

  6. #6
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Thanks for the help guys not sure how well these work but im using jstempers version.

  7. #7
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Actually jstempers didnt work but dan your the man !!!! Yours worked with a bit of modification just as i needed! Thanks a bunch!

  8. #8
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

  9. #9
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Your approach works flawlessly, with some simple changes ofc.

  10. #10
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

  11. #11
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    I'll post my revisions when I get home from work and school in 7 hours.

  12. #12
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Dam phone double post, sorry

  13. #13
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Here is my adjusted version dan.

    Simba Code:
    function IsSpawned(): Boolean;
    var
      tpa:TPointArray;
      ATPA:T2DPointArray;
      i, x, y:integer;
      Bounds:Tbox;
    begin
      if FindColorsTolerance(tpa, 714213, 595, 51, 700, 159, 37) then
      begin
        FilterPointsDist(TPA, 0, 63, 651, 125);
        ATPA := ClusterTPAEx(TPA, 1, 1);
        FilterTPAsBetween(ATPA, 40, 100000);
        if Length(ATPA) < 1 then Exit;
        for i := 0 to high(ATPA) do
        begin
          Bounds := GetTPABounds(ATPA[i]);
          Bounds := [Bounds.X1-1, Bounds.Y1-1, Bounds.X2+1, Bounds.Y2+1];
          if FindColorTolerance(x, y, 4149321, Bounds.X1, Bounds.Y1, Bounds.X2, Bounds.Y2, 20) and not FindColorTolerance(x, y, 5791587, Bounds.X1, Bounds.Y1, Bounds.X2, Bounds.Y2, 20) then
          begin
            MiddleTPA(ATPA[i]);
            //writeln('zulrah is spawned');
            exit(true);
          end;
        end;
        result := false;
        writeln('zulrah is not spawned');
      end;
    end;

    Works pretty flawlessly for me, thanks for the setup!!

  14. #14
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

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
  •