Results 1 to 14 of 14

Thread: FindTree(TreeType : String; Tol : Integer): Boolean

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

    Default FindTree(TreeType : String; Tol : Integer): Boolean

    I was bored so i made a function:

    SCAR Code:
    function FindTree(var x,y : Integer; TreeType : String; Tol : Integer): boolean;
    var
      TreeColor : Integer;
      TPA : TPointArray;
      TPAA : T2DPointArray;
      Name : string;
      i,TTime : integer;
    begin
      case lowercase(TreeType) of
        'oak': TreeColor := 4615266; Name := 'ak';
        'willow': TreeColor := 4748399; Name := 'illow';
        'tree': TreeColor := 1520939; Name := 'ree';
        'yew': TreeColor := 3038299; Name := 'ree';
      else
        Writeln('Invalid option');
        Result := False;
      end;
      MarkTIme(TTime);
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, TreeColor, MSX1, MSY1, MSX2, MSY2, Tol);
      if length(TPA) > 0 then
      begin
        TPAA := TPAtoATPAEx(TPA, 25, 25);
        Writeln('Finding '+TreeType+' took: '+inttostr(TimeFromMark(TTime)));
        for i:=0 to high(TPAA) do
        begin
          MiddleTPAEx(TPAA[i], x, y);
          MMouse(x, y, 3, 3);
          wait(50+random(50))
          if isuptext(Name) then
          GetMousePos(x, y);
          Result := True;
        end;
      end else
      Result := False;
    end;

    Will find the nearest tree aviable.

    e.g:

    SCAR Code:
    if FindTree(x, y, 'Yew', 15) then Writeln('YaY');


  2. #2
    Join Date
    Dec 2006
    Location
    Program TEXAS home of AUTOERS
    Posts
    7,934
    Mentioned
    26 Post(s)
    Quoted
    237 Post(s)

    Default

    its good just need more colors

  3. #3
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Good job!
    ~Hermen

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

    Default

    Quote Originally Posted by Hermpie View Post
    Good job!
    hehe thanks
    Quote Originally Posted by p1nky View Post
    its good just need more colors
    Maybe it need more colors, becouse all trees has a dark face, thanks anyways.

    P.S: Can someone take pics of ents, gases, and send it to me ? im working on it.


  5. #5
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Why do people keep making functions like these when FindObjTPA already does it?


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

    Default

    Quote Originally Posted by Bobarkinator View Post
    Why do people keep making functions like these when FindObjTPA already does it?
    I posted it for feedback, for their opinion, not especially for using it.


  7. #7
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    I think its good.

    But what you could do is add in maple. As I found them good xp when I didn't quite have 60 wc.

  8. #8
    Join Date
    Dec 2006
    Location
    Program TEXAS home of AUTOERS
    Posts
    7,934
    Mentioned
    26 Post(s)
    Quoted
    237 Post(s)

    Default

    maples are good but i noticed it has more randoms :P ents,nests and so on

  9. #9
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Try cts 2 with these options:

    modifiers: (0.075, 0.075)
    color: 3368537
    tol: 30

    instead of adding colors

    another tip; replace TPAtoATPAEx(TPA, 25, 25) with SplitTPAEx(tpa, 6, 6) (maybe even more than 6)..
    Hup Holland Hup!

  10. #10
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Niels, may I ask you what tool you used to find the modifiers?
    And, telling us what tree that color is for wouldn't be bad either.. ^_^

    Edit: Wow, thanks!

  11. #11
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    I calculated those myself, but if I'd had to calculate them now, I'd use ACA v2. That color will find all trees. In my treefinder I'm looking for all the possible trees and then try to "see" what kind it is by the size.
    Hup Holland Hup!

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

    Default

    Maybe use an array, WillowCol e.t.c.

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

    Default

    Quote Originally Posted by nielsie95 View Post
    I calculated those myself, but if I'd had to calculate them now, I'd use ACA v2. That color will find all trees. In my treefinder I'm looking for all the possible trees and then try to "see" what kind it is by the size.
    I don't think it's possible to determine with size alone, since a far away oak could look as big as a close tree. Other things would need to be added, such as TPA length, (possibly) density, etc.

  14. #14
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    You're right
    That's why I try to "see" what kind it is by the size
    But I think size can help though.
    Hup Holland Hup!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. EatFood(What: String; TheHp: Integer): Boolean;
    By turbobk in forum Research & Development Lounge
    Replies: 6
    Last Post: 08-11-2008, 01:57 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
  •