Results 1 to 7 of 7

Thread: Amazing Tree finder

  1. #1
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Amazing Tree finder

    I made an any tree finder, I have only tested it with willows, oaks, trees and yews. I read lorax's tut about in HSL and decided to experiment with HSL, and got this:
    SCAR Code:
    Function FindTree(Var X, Y : Integer): Boolean;
    Var
      TPA, TPA2 : TPointArray;
      ATPA : T2DPointArray;
      I, J, lastCol, Took : Integer;
      L : TExtendedArray;
      LTol, H, S, tempH, tempS, tempL : Extended;
    Begin
      LTol := 10.0;
      Took := GetTickCount;
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5869445, MSX1, MSY1, MSX2, MSY2, 15);
      If Length(TPA) = 0 Then
        Exit;
      SetLength(L, Length(TPA));
      For I := 0 To High(TPA) Do
        ColorToHSL(GetColor(TPA[I].X, TPA[I].Y), H, S, L[I]);
      lastCol := GetColor(TPA[Low(TPA)].X, TPA[Low(TPA)].Y);
      For J := 0 To High(TPA) Do
      Begin
        ColorToHSL(lastCol, tempH, tempS, tempL);
        If (iAbs(Round(LTol) - Round(Abs(tempL - L[J]))) < 10) And ((Round(tempH) > 15) And (Round(tempH) < 25)) Then
        Begin
          LTol := tempL - L[J];
          SetLength(TPA2, Length(TPA2) + 1);
          TPA2[High(TPA2)] := TPA[J];
        End;
        lastCol := GetColor(TPA[J].X, TPA[J].Y);
      End;
      Result := Length(TPA2) <> 0;
      If Result Then
      Begin
        Writeln('Found Tree in: ' + IntToStr(GetTickCount - Took) + 'ms');
        ATPA := TPAtoATPAex(TPA2, 25, 25);
        For I := 0 To High(ATPA) Do
        Begin
          MiddleTPAex(ATPA[I], X, Y);
          MMouse(X, Y, 5, 5);
          Wait(100 + Random(100));
          If IsUpText('hop') Then
          Begin
            Result := True;
            GetMousePos(X, Y);
            Writeln('Luminance Tolerance = ' + FloatToStr(Abs(LTol)));
            Exit;
          End;
        End;
      End;
      Result := False;
    End;
    You can change the isuptext('hop') to the uptext of your tree. It takes between 30 - 100 ms to find the tree, depends on how many trees are on the screen. It has never missed a tree


  2. #2
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Looks great!
    You should have added your own credits at the top!

    Nice Job with this, Im sure we will all see it in plenty of scripts to come

  3. #3
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Finding a tree is the easy part. Figuring out what kind of tree it is without moving the mouse to it is the hard part.

  4. #4
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by bullzeye95 View Post
    Finding a tree is the easy part. Figuring out what kind of tree it is without moving the mouse to it is the hard part.
    That is too hard, there is almost no difference between yews, trees and oaks. I have tried with different colors and things, but the only difference between them is the size. The only findable tree(F2P) is the willow(in colors). The good about this function that doesn't hover any other object than trees.


  5. #5
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    I managed to do it pretty well once, but the biggest problem is when two trees overlap each other. Then it gets hard.

  6. #6
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Can i use this in my script?

    I'll credit..

  7. #7
    Join Date
    Mar 2007
    Posts
    1,700
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Here's what I got from my test..




Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Creating a pick head finder, and gas finder
    By Tom_Gower in forum OSR Help
    Replies: 7
    Last Post: 11-07-2008, 07:06 AM
  2. SkullBr00d Tree Finder
    By skullbr00d in forum First Scripts
    Replies: 6
    Last Post: 10-31-2007, 10:23 PM
  3. Help with tree Finder
    By daddyproboot in forum OSR Help
    Replies: 2
    Last Post: 06-26-2007, 05:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •