Results 1 to 9 of 9

Thread: Won't Find the Tree :(

  1. #1
    Join Date
    Aug 2007
    Location
    Georgia, U.S.
    Posts
    890
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Won't Find the Tree :(

    This is from my willow cutter script. It keeps moving the mouse everywhere but won't click the tree. I have changed the colors tons of times but no matter what color i use it still doesn't find the tree.

    SCAR Code:
    procedure ChopTheTree;
    var
      TreeTPA: TPointArray;
      TreeSpot: TPoint;
    begin
      FindEnt(fx, fy, True);
      if not LoggedIn then Exit;
      repeat
        if not LoggedIn then Break;
        TreeColors[0] := 5796982;
        TreeColors[1] := 6589084;
        TreeColors[2] := 3293245;
        TreeColors[3] := 3033937;
        for i := 0 to 3 do
        FindColorsSpiralTolerance(MSCX,MSCY,TreeTPA,TreeColors[i],MSX1,MSY1,MSX2,MSY2,15);
        TreeSpot := MiddleTPA(TreeTPA);
        MMouse(TreeSpot.X,TreeSpot.Y,5,5);
        Wait(50+random(50));
        if IsUpText('hop')then
        begin
          GetMousePos(x,y);
          Mouse(x,y,3,3,true);
          FFlag(0);
          FindNormalRandoms;
          if FindFight then
          begin
            RunTo('N',false);
            Wait(10000 + random(2840));
            RunTo('S',false);
          end;
          Responder;
          RandomSpeak;
          MyAntiBannage;
          wait(5000 + random(1524));
        end;
      until(invfull);
    end;

  2. #2
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Try lowering the tolerance (as that is quite high and probably just finds grass most of the time). Also, did you only want the FindColorsSpiralTolerance to run in the for/to/do as you don't have an indent after nor a begin, so it's not clear.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  3. #3
    Join Date
    Aug 2007
    Location
    Georgia, U.S.
    Posts
    890
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I didn't realize i had the tolerance so high thanks.

  4. #4
    Join Date
    Sep 2007
    Posts
    415
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    okay, other than the tolerance, here's what i'd do

    SCAR Code:
    procedure ChopTheTree;
    var
      TreeTPA: TPointArray;
      TreeSpot: TPoint;
    begin
      FindEnt(fx, fy, True);
      if not LoggedIn then Exit;
      repeat
        if not LoggedIn then Break;
        TreeColors[0] := 5796982;
        TreeColors[1] := 6589084;
        TreeColors[2] := 3293245;
        TreeColors[3] := 3033937;
        for i := 0 to 3 do
        FindColorsSpiralTolerance(MSCX,MSCY,TreeTPA,TreeColors[i],MSX1,MSY1,MSX2,MSY2,15);
        if length(TreeTPA) > 5 then //edit this line
        begin
        TreeSpot := MiddleTPA(TreeTPA);
        MMouse(TreeSpot.X,TreeSpot.Y,5,5);
        Wait(50+random(50));
        if IsUpText('hop')then
        begin
          Writeln('found tree with ' + inttostr(length(TreeTPA)));
          GetMousePos(x,y);
          Mouse(x,y,3,3,true);
          FFlag(0);
          FindNormalRandoms;
          if FindFight then
          begin
            RunTo('N',false);
            Wait(10000 + random(2840));
            RunTo('S',false);
          end;
          Responder;
          RandomSpeak;
          MyAntiBannage;
          wait(5000 + random(1524));
        end;
        end else writeln('found wrong color with ' + inttostr(length(Treetpa)));
      until(invfull);
    end;

    and run that, when it finds a tree, it will tell you what length it found the tree at, you should edit that line for best performance
    Quote Originally Posted by That guy that wrote forefeathers
    <munklez>haha im too lazy, girls annoy me
    <munklez> they always wanna like, do stuff
    <munklez> and i just wanna program
    <munklez> and they always take all my money

  5. #5
    Join Date
    Aug 2007
    Location
    Georgia, U.S.
    Posts
    890
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks. ill put that in the next version of this script.

  6. #6
    Join Date
    Sep 2007
    Posts
    415
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    actually, that wouldn't have worked anyway lol, forgot you didn't put it into an APTA.. if you wanna do that you need to make it an ATPA before the length thig
    Quote Originally Posted by That guy that wrote forefeathers
    <munklez>haha im too lazy, girls annoy me
    <munklez> they always wanna like, do stuff
    <munklez> and i just wanna program
    <munklez> and they always take all my money

  7. #7
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Sorry, all wrong except for drizzt.

    And another thing, if you do multiple FindColorsSpiralTolerances for the same TPA, it just gets the points of the last color, you need an ATPA to do like ATPA[i], and then combine them, then do a TPAToATPA(ex), a for loop.

  8. #8
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function FindTree : Boolean;
    var
      TreePointArray : TPointArrayArray;
      TreePoints : TPointArray;
      Centre : TPoint;
      TreeBox : TBox;
      X, Y, I, K, U : Integer;
      CTS : Integer;
    begin
      CTS := GetColorToleranceSpeed;
      MarkTime(U);
      ColorToleranceSpeed(2);
      Centre := IntToPoint(MSCX, MSCY);
      FindColorsTolerance(TreePoints, 2910042, MSX1, MSY1, MSX2, MSY2, 10);
      TreePointArray := SplitTPA(TreePoints, 20);
      SortATPAFrom(TreePointArray, Centre);
      K := TimeFromMark(U);
      for I := 0 to High(TreePointArray) do
      begin
        TreeBox := GetTPABounds(TreePointArray[i]);
        MMouse((TreeBox.X1 + TreeBox.X2)/2, (TreeBox.Y1 + TreeBox.Y2)/2, 3, 3);
        Wait(50 + Random(50));
        if IsUpText('hop') then
        begin
          GetMousePos(X, Y);
          Mouse(X, Y, 0, 0, True);
          Result := True;
          WriteLn(IntToStr(K));
          ColorToleranceSpeed(CTS);
          Exit;
        end;
      end;
    end;
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  9. #9
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    SCAR Code:
    MMouse((TreeBox.X1 + TreeBox.X2)/2, (TreeBox.Y1 + TreeBox.Y2)/2, 3, 3);

    SCAR Code:
    MMouse(TreeBox.X2 - TreeBox.X1 shr 1, TreeBox.Y2 - TreeBox.Y1 shr 1, 3, 3);

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Find Tree Stump?
    By D1zl3 in forum OSR Help
    Replies: 2
    Last Post: 12-13-2008, 07:07 AM

Posting Permissions

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