Results 1 to 13 of 13

Thread: Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : I

  1. #1
    Join Date
    Oct 2007
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : I

    Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);

    What this procedure does is looks for the tree, if its found then it sais tree found, if its not found, it sais that tree is not found.

    Note that this works perfectly only if there is ONE tree of the same type on the runescape screen.This could be for example used at varrock north-east yew since there are no more trees than the one yew there.

    Here is the procedure.
    SCAR Code:
    Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);
    {FindTree('illo', 21313973, 10, 5847397, 5);}
    Var
      TX, TY : Integer;
      SX, SY : Integer;
      Found  : Boolean;
    Begin
     If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
     Begin
       MMouse(TX, TY, 15, 15);
       If(IsUpText(SomeLetters))Then
       WriteLn('Tree Found.');
       Found := True;
     End Else
     Begin
      If(Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol))Then
       WriteLn('Tree Not Found.');
       Found := False;
     End;
    End;

    Here is how to use the procedure.
    SCAR Code:
    Program Testing;
    {.Include SRL/SRL.Scar}

    Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);
    {FindTree('illo', 21313973, 10, 5847397, 5);}
    Var
      TX, TY : Integer;
      SX, SY : Integer;
      Found  : Boolean;
    Begin
     If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
     Begin
       MMouse(TX, TY, 15, 15);
       If(IsUpText(SomeLetters))Then
       WriteLn('Tree Found.');
       Found := True;
     End Else
     Begin
      If(Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol))Then
       WriteLn('Tree Not Found.');
       Found := False;
     End;
    End;

    Begin
    SetUpSRL;
    Begin
    FindTree('illo', 21313973, 10, 5847397, 5);
    End;
    End.

    Well i hope you liked it, please post comments and such. IF YOU CLAIM THIS AS YOUR OWN I PROMISE YOU, I WILL GET Y O U BANNED.
    Woot woot.

  2. #2
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    change it to a function that returns a boolean result.
    like this
    SCAR Code:
    function FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer) : boolean;
    then change the rest to look like this
    SCAR Code:
    function FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer) : boolean;
    {FindTree('illo', 21313973, 10, 5847397, 5);}
    Var
      TX, TY : Integer;
      SX, SY : Integer;
      Found  : Boolean;
    Begin
      Result := False;
      If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
      Begin
        MMouse(TX, TY, 15, 15);
        If(IsUpText(SomeLetters))Then
        WriteLn('Tree Found.');
        Result := True;
      End Else
      Begin
        If(Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol))Then
        WriteLn('Tree Not Found.');
      End;
    End;
    the you can use it like... if (function FindTree('illow', 123, 1, 123, 1)) then
    ClickTree;//or w/e you use to click your tree.
    also change it so it looks for the color with tol of 0 - Tree tol. so it find the tree. not somthing like the tree.
    IE.
    SCAR Code:
    repeat
      if (FindColorTolerance(x, y, TreeColor,MSX1, MSY1, MSX2, MSY2, ColorTolerance)) then
        break;
      ColorTolerance := ColorTolerance + 1;
    until (ColorTolerance >= TreeTol) or (not(LoggedIn));

    feel free to use my idea, and no need to credit.
    i hate ppl that just want credit.

    i use stuff like that for auto color all the time. its great!

  3. #3
    Join Date
    Nov 2007
    Location
    Nowhereville
    Posts
    1,155
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    I would recommend to have it be a function. Here is the revised version.

    SCAR Code:
    Function FindTree(x, y: integer; TreeColor, TreeTol, StumpColor, StumpTol : Integer): boolean;
    Begin
     If(FindObj(x, y, 'own', TreeColor, TreeTol))And(Not(FindObj(x, y, 'tump', StumpColor, StumpTol)))Then
     Begin
       MMouse(x, y, 15, 15);
       If(IsUpText('own'))Then
       WriteLn('Tree Found.');
       Result := True;
     End Else
     Begin
      If(Not(FindObj(x, y, 'own', TreeColor, TreeTol)))And(not(FindObj(x, y, 'tump', StumpColor, StumpTol))Then
       WriteLn('Tree Not Found.');
       Result := False;
     End;
    End;


    Notice that now that there are results, no need to put in uptext and coordinates:

    SCAR Code:
    if FindTree(x, y, TreeColor, TreeTol, StumpCol, StumpTol) then


    The boolean result allows you to see if it actually found the tree. When you just declare a variable locally inside a function, how would a person access that variable? I would also recommend learning tboxes so you can not use FindObj. FindObj moves the mouse vigorously around the screen looking for the uptext. Detectable. Use FindColorTolerance, or FindColorsSpiralTolerance(returns TPointArrays).

    Cut em2 it
    Formerly known as Cut em2 it

  4. #4
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    SCAR Code:
    function FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer) : boolean;
    {FindTree('illo', 21313973, 10, 5847397, 5);}
    Var
      TX, TY : Integer;
      SX, SY : Integer;
      Found  : Boolean;
    Begin
      If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
      Begin
        MMouse(TX, TY, 15, 15);
        If(IsUpText(SomeLetters))Then
        Result := True;
      End Else
        Result:= (Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol));
    End;
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

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

    Default

    agree with robot, the script you made, would send result := true self if it did not found the text. but the modefied v. robot made works.

  6. #6
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by U L T R A View Post
    Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);

    What this procedure does is looks for the tree, if its found then it sais tree found, if its not found, it sais that tree is not found.

    Note that this works perfectly only if there is ONE tree of the same type on the runescape screen.This could be for example used at varrock north-east yew since there are no more trees than the one yew there.

    Here is the procedure.
    SCAR Code:
    Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);
    {FindTree('illo', 21313973, 10, 5847397, 5);}
    Var
      TX, TY : Integer;
      SX, SY : Integer;
      Found  : Boolean;
    Begin
     If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
     Begin
       MMouse(TX, TY, 15, 15);
       If(IsUpText(SomeLetters))Then
       WriteLn('Tree Found.');
       Found := True;
     End Else
     Begin
      If(Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol))Then
       WriteLn('Tree Not Found.');
       Found := False;
     End;
    End;

    Here is how to use the procedure.
    SCAR Code:
    Program Testing;
    {.Include SRL/SRL.Scar}

    Procedure FindTree(SomeLetters : String; TreeColor, TreeTol, StumpColor, StumpTol : Integer);
    {FindTree('illo', 21313973, 10, 5847397, 5);}
    Var
      TX, TY : Integer;
      SX, SY : Integer;
      Found  : Boolean;
    Begin
     If(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol))And(Not(FindObj(SX, SY, 'tump', StumpColor, StumpTol)))Then
     Begin
       MMouse(TX, TY, 15, 15);
       If(IsUpText(SomeLetters))Then
       WriteLn('Tree Found.');
       Found := True;
     End Else
     Begin
      If(Not(FindObj(TX, TY, SomeLetters, TreeColor, TreeTol)))And(FindObj(SX, SY, 'tump', StumpColor, StumpTol))Then
       WriteLn('Tree Not Found.');
       Found := False;
     End;
    End;

    Begin
    SetUpSRL;
    Begin
    FindTree('illo', 21313973, 10, 5847397, 5);
    End;
    End.

    Well i hope you liked it, please post comments and such. IF YOU CLAIM THIS AS YOUR OWN I PROMISE YOU, I WILL GET Y O U BANNED.
    lol
    DIZ IZ MY OWNZ! HE ZTOLEZ IT!!!

    Why can't you just use findobj?
    Ex.
    SCAR Code:
    repeat
      if FindObj(x, y, treetext, color, tolerance) then break;
      if FindObj(x, y, 'tump', color, tolerance) then
        wait(3000);
      A:=A+1;
    until A = 5;
    You're making this too hard. Logically if you found the stump, then you could just do
    SCAR Code:
    MMouse(x, y, 1, 1);
    repeat
      wait(1);
      A:=A+1;
      if isuptext(treetext) then
      begin
        thingdoo := true;
        Break;
      end;
    until A=15000;
    if thingdoo = true then
    Mouse(x, y, 1, 1, True);
    or something to that effect.
    Active only during the Summer...

  7. #7
    Join Date
    Oct 2007
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well it now works like this for example:

    If(FindTree)Then
    Wait(5000); //Its supposed to do something like that.
    End Else
    If(Not(FindTree))Then
    DoSomethingHere;
    Woot woot.

  8. #8
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    Look how short I got it ^.^

    SCAR Code:
    function FindTree(Var TX, TY: Integer; SomeLetters: String; TreeColor, TreeTol, StumpColor, StumpTol: Integer): Boolean;
    Begin
      Result:= (Not(FindObj(TX, TY, 'tump', StumpColor, StumpTol))) And (FindObj(TX, TY, SomeLetters, TreeColor, TreeTol));
      If Result Then
        MMouse(TX, TY, 15, 15);
    End;

    Additionally, you could remove the mouse part and do it separate.

    SCAR Code:
    function FindTree(Var TX, TY: Integer; SomeLetters: String; TreeColor, TreeTol, StumpColor, StumpTol: Integer): Boolean;
    Begin
      Result:= (Not(FindObj(TX, TY, 'tump', StumpColor, StumpTol))) And (FindObj(TX, TY, SomeLetters, TreeColor, TreeTol));
    End;


    You got owned.
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  9. #9
    Join Date
    Oct 2007
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    But yours doesnt exactly say IF it found the tree or IF it didnt find the tree. .

    So actually, YOU got owned :P.
    Woot woot.

  10. #10
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by U L T R A View Post
    But yours doesnt exactly say IF it found the tree or IF it didnt find the tree. .

    So actually, YOU got owned :P.
    No you got owned

  11. #11
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    Actually, U L T R A, it does say IF the tree was found. Mmmkay?


    Did you not know that it is exactly the same as yours? (Accomplishes the same thing)

    And I will own you again

    NOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOB
    You, U L T R A, have been reported for being a NOOB.
    Your
    Current violations include
    1. Thinking you know stuff you don't for
    This brings you to a new total of (3) Noob Points!

    For more information on U L T R A please go Here.

    For more information from This database please go Here.

    For more information on The Noob Points System please go Here.

    For more information on Noobs please go Here.

    NOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOB
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  12. #12
    Join Date
    Jul 2007
    Location
    St. Louis, Missouri, USA.
    Posts
    575
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by R0b0t1 View Post
    Actually, U L T R A, it does say IF the tree was found. Mmmkay?


    Did you not know that it is exactly the same as yours? (Accomplishes the same thing)

    And I will own you again

    NOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOB
    You, U L T R A, have been reported for being a NOOB.
    Your
    Current violations include
    1. Thinking you know stuff you don't for
    This brings you to a new total of (3) Noob Points!

    For more information on U L T R A please go Here.

    For more information from This database please go Here.

    For more information on The Noob Points System please go Here.

    For more information on Noobs please go Here.

    NOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOBNOOB

    Thats a bit harsh.
    -You can call me Mick-



  13. #13
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    No its not, do noob points mean anything?

    I wanted to prove my point. And I did... I think :|
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. FindTree(TreeType : String; Tol : Integer): Boolean
    By Cazax in forum Research & Development Lounge
    Replies: 13
    Last Post: 04-07-2008, 09:01 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
  •