Results 1 to 14 of 14

Thread: Ideas on a Is Cutting function

  1. #1
    Join Date
    Jul 2007
    Location
    Ohio
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Ideas on a Is Cutting function

    So I'm working on a woodcutting script and I've gotten stuck on how could I make a function to know it is cutting or to detect if the tree is gone... I have tried numerous different ways, but none of them have worked. Oh and no reflection ideas because I am applying with this script. Just tell me your idea and tell me how I could do it.

    Edit* And yes I know my title is not grammatically correct. Sorry hah

    Thanks,
    King of the Nites

  2. #2
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This is what I used (a little over 2 years ago) in my old Varrock Lumberjack:

    SCAR Code:
    function Chopping: Boolean;

    var
      TPA: TPointArray;
      I: Integer;
     
    begin
      for I := 1 to 7 do
      begin
        FindColorsSpiralTolerance(x,y,TPA,939120,204,132,282,202,10);
        Result := GetArrayLength(TPA) - 1 > 6;
        if(Result)then
          Exit;
        wait(30+random(40));
      end;
    end;

    This just looks for the axe handle colors on the main screen right around your character. This was the best way I used. As a fail safe I also checked if the tree was there or not.
    Last edited by JAD; 08-13-2009 at 11:51 AM.

  3. #3
    Join Date
    Jul 2007
    Location
    Ohio
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    But wouldn't it detect the axe if someone is wielding it while not chopping too? Or can it only be used for people not wielding an axe?

  4. #4
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by King of the Nites View Post
    But wouldn't it detect the axe if someone is wielding it while not chopping too? Or can it only be used for people not wielding an axe?
    I can't remember what I did for that. I don't think that as many colors popped up in the TPA if you weren't chopping. Might have changed now with the new woodchopping animation.

    All I know is that it worked pretty flawless back in the day. Just try counting the colors using FindColorsTolerance while you are chopping and writelning how many there are when chopping and when not. In theory it may still work.

  5. #5
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    A simple way, but less advanced would be to do something like:

    SCAR Code:
    repeat
      AntiBan;
    until(not LoggedIn or not IsUpText('illow'));

    Of course, that's pretty basic, and if your AnitBan moves the camera angle or the mouse, it will immediately click another tree when the UpText changes.

    What I do in my Woodcutters is have the script check for the tree color in a 20 x 20 pixel box around where it clicked the tree, and if the amount of colors found is less than 8, then the tree is no longer there. Here's what I use:

    SCAR Code:
    function Cut_TreeCutDown: Boolean;
    var
      TPA : TPointArray;
    begin
      if not LoggedIn then Exit;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.18, 0.28);
      FindColorsTolerance(TPA, 4481105, TP.x - 10, TP.y - 10, TP.x + 10, TP.y + 10, 14);
      if(Length(TPA) < 8)then
      begin
        //Writeln('Length inside box: ' + IntToStr(Length(TPA)));
        Result := True;
      end;
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(1);
    end;

    Hopefully that helps you out.

    Also, good luck when you apply for members.

  6. #6
    Join Date
    May 2008
    Location
    Oregon, USA
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    IDK much about woodcutting scripts but you could look at some junior members woodcutting scripts for idea's just don't copy and paste. Or at least ask for permission and then credit the maker.

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

    Default

    Quote Originally Posted by Coh3n View Post
    A simple way, but less advanced would be to do something like:

    SCAR Code:
    repeat
      AntiBan;
    until(not LoggedIn or not IsUpText('illow'));

    Of course, that's pretty basic, and if your AnitBan moves the camera angle or the mouse, it will immediately click another tree when the UpText changes.

    What I do in my Woodcutters is have the script check for the tree color in a 20 x 20 pixel box around where it clicked the tree, and if the amount of colors found is less than 8, then the tree is no longer there. Here's what I use:

    SCAR Code:
    function Cut_TreeCutDown: Boolean;
    var
      TPA : TPointArray;
    begin
      if not LoggedIn then Exit;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.18, 0.28);
      FindColorsTolerance(TPA, 4481105, TP.x - 10, TP.y - 10, TP.x + 10, TP.y + 10, 14);
      if(Length(TPA) < 8)then
      begin
        //Writeln('Length inside box: ' + IntToStr(Length(TPA)));
        Result := True;
      end;
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(1);
    end;

    Hopefully that helps you out.

    Also, good luck when you apply for members.
    You stole my IDEA! xD die!
    ~Hermen

  8. #8
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Hermen View Post
    You stole my IDEA! xD die!
    Ahh I'm sorry! Please don't hurt me!

    *runs and hides in the corner*

  9. #9
    Join Date
    Jul 2007
    Location
    Ohio
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    A simple way, but less advanced would be to do something like:

    SCAR Code:
    repeat
      AntiBan;
    until(not LoggedIn or not IsUpText('illow'));

    Of course, that's pretty basic, and if your AnitBan moves the camera angle or the mouse, it will immediately click another tree when the UpText changes.

    What I do in my Woodcutters is have the script check for the tree color in a 20 x 20 pixel box around where it clicked the tree, and if the amount of colors found is less than 8, then the tree is no longer there. Here's what I use:

    SCAR Code:
    function Cut_TreeCutDown: Boolean;
    var
      TPA : TPointArray;
    begin
      if not LoggedIn then Exit;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.18, 0.28);
      FindColorsTolerance(TPA, 4481105, TP.x - 10, TP.y - 10, TP.x + 10, TP.y + 10, 14);
      if(Length(TPA) < 8)then
      begin
        //Writeln('Length inside box: ' + IntToStr(Length(TPA)));
        Result := True;
      end;
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(1);
    end;

    Hopefully that helps you out.

    Also, good luck when you apply for members.
    Yea I don't want to do the repeat until not uptext because if the mouse gets moved off by the antiban and other things and it looks kind of suspicious if you move the mouse back to the tree.

    That Cut_TreeCutDown function is a good idea... Would you mind if I used it? I will credit! I will probably change up the cts2 stuff just so I am not directly copying you.
    EDIT*
    I think I am going to go with Coh3ns function with a inventory count as a failsafe.
    Thanks Rasta Magician and everyone else and feel free to post more ideas!

    Thanks,
    King of the Nites
    Last edited by King of the Nites; 08-14-2009 at 03:11 AM.

  10. #10
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by King of the Nites View Post
    That Cut_TreeCutDown function is a good idea... Would you mind if I used it? I will credit! I will probably change up the cts2 stuff just so I am not directly copying you.
    Thanks,
    King of the Nites
    Yeah go for it! It makes me feel like I know what I'm doing when someone uses one of my functions.

  11. #11
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    http://www.villavu.com/forum/showthread.php?t=43037

    It's not finished yet, but by chance, it fits exactly what you need.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  12. #12
    Join Date
    Jul 2007
    Location
    Ohio
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Rasta: The only problem with using similar colors and uptext is that when you click on a tree, your player will walk a little bit towards the tree, maybe taking the uptext off and then your first color and second color will be from 2 totally different colors.
    Is there any way to counter this? I kind of have an idea, I will edit my post with what I am trying to do because it is just not coming to me right now.

    ~KotN

  13. #13
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by King of the Nites View Post
    Rasta: The only problem with using similar colors and uptext is that when you click on a tree, your player will walk a little bit towards the tree, maybe taking the uptext off and then your first color and second color will be from 2 totally different colors.
    Is there any way to counter this? I kind of have an idea, I will edit my post with what I am trying to do because it is just not coming to me right now.

    ~KotN
    I have a function that follows the tree while you're walking; I guess you could attempt something similar.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  14. #14
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by King of the Nites View Post
    Yea I don't want to do the repeat until not uptext because if the mouse gets moved off by the antiban and other things and it looks kind of suspicious if you move the mouse back to the tree.

    That Cut_TreeCutDown function is a good idea... Would you mind if I used it? I will credit! I will probably change up the cts2 stuff just so I am not directly copying you.
    Thanks,
    King of the Nites
    Coh3n has a pretty good function i guess. I'd probably make a function similar to that.
    and Rasta.. I know how to follow a tree to and such, but could you show me your method-- i wanna compare.

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
  •