Results 1 to 5 of 5

Thread: FindTree;

  1. #1
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    456
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default FindTree;

    This was working a few days ago, it's not now. I have changed added a new colour and cts settings etc but no luck. Can anyone help?

    Code:
    function FindTree : Boolean;
    var
      TempCTS, i, H : Integer;
      TPA  : TPointArray;
      TempTBox : TBox;
      ATPA : T2DPointArray;
    begin
      Result := False;
      TempCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.05, 0.97);
      FindColorsTolerance(TPA, 15029504, MSX1, MSY1, MSX2, MSY2, 10);
      ATPA := TPAToATPA(TPA, 50);
      SortATPASize(ATPA, True);
      H := High(ATPA);
      for i := 0 to H do
      begin
        TempTBox := GetTPABounds(ATPA[i]);
        if Distance(TempTBox.x1, TempTBox.y1, TempTBox.x2, TempTBox.y2) < 10 then
        begin
          SetArrayLength(ATPA, i);
          Break;
        end;
      end;
      H := High(ATPA);
      for i := 0 to H do
      begin
        MiddleTPAEx(ATPA[i], x, y);
        MMouse(x, y, 2, 2);
        if WaitUpTextMulti(['hop', 'own', 'ew' ], RandomRange(500, 1000)) then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, true);
          Result := True;
          Break;
        end;
      end;
      ColorToleranceSpeed(TempCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    end;

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

    Default

    Owning to the fact of you using TPAToATPA, making the TPA's into individual 50 radii circles. Your error is, I gather, in this line:

    SCAR Code:
    if Distance(TempTBox.x1, TempTBox.y1, TempTBox.x2, TempTBox.y2) < 10 then

    I don't really think the distance of any of you TPA Bounds will be less than ten, but rather greater. However, If you can explain what you're trying to do with that line hopefully it will make it more clear.

  3. #3
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    456
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Sorry yes, that use of that line is specific to the Edgeville yews. It makes sure it ignores the leaflike plants to the left of the two yew trees. I'm not getting an error, it just isn't finding the tree and moving the mouse to it.

  4. #4
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Have you tried debugging the TPA?
    {.Include SRL/SRL/misc/Debug.scar}

    and

    DebugTPA; or DebugATPA;

  5. #5
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    456
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Sorry should have done that. Will do.

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
  •