Results 1 to 5 of 5

Thread: Need help for Yewcutting function

  1. #1
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Need help for Yewcutting function

    ok im makeing a yew cutter, and at the moment im working on a function that once you start cutting a tree, it checks to see if the tree is still there. now origionaly i was doing this:

    Code:
    function TreeAtMouse: Boolean;
    begin
      if(IsUpText('ew')) then Result := true;
      if(not IsUpText('ew')) then Result := false;
    end;
    (sorry i couldnt find the scar tags on this new forum o.O)

    ok so yes i know what your all saying this is horrible cause theres no mouse movement, you just click and leave the mouse on the tree and when it disapears then you know to move onto the next tree. well i thought i could maby simulate somone afk training where they click on the tree and then take there hand off the mouse to watch tv or something, so then i threw in that liftmouse antiban function to look like they were takeing there hand off it.. i donno if it realy works but eh i havent been banned yet lol.

    ok so now i had a new idea, if i record the color of the tree at the mouse's coordinates when it clicks, then all i have to do is change my function to this and it frees up the mouse to do antiban or w.e else i want

    Code:
    function TreeAtMouse: Boolean;
    begin
      if(GetColor(TreeX, TreeY) = ClickColor)then Result := True;
      if(GetColor(TreeX, TreeY) = ClickColor)then Result := True;
    end;
    now one problem with this is when your charicture cuts trees he is prone to move about, changing the x and y position of the tree.. now i thought maby i could write an equasin that calculates the new position of objects acording to where you are before and after you click... but instead it would be way easyer to just some how use tolerance with the ClickColor. at the moment in my tree cutting function, right after i do

    Code:
    Mouse(x,y,2,2true)
    then i have
    Code:
    ClickColor = GetColor(x,y);
    TreeX := x;
    TreeY := y;
    but yeah... idk im still new to programing if any one could just show me a better way? or a way to incorperate tolerance into the GetColor(x,y) function.

    thanks
    Lance. Da. Pants.

  2. #2
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    to use SCAR tags to [ Highlight="SCAR ] [/ Highlight ]



    and for the function..

    SCAR Code:
    function CutTree: boolean;
    var
      tx, ty: integer;
      Cutting, Sleeping: boolean;
    begin
      if(FindColorTolerance(tx, ty, TreeColor, MSX1, MSY1, MSX2, MSY2, 7))then
      begin
        MMouse(tx-5, ty-5, 2, 2);
        if(IsUpText('Yew'))then
        begin
          Result := True;
          GetMousePos(tx, ty);
          case random(2) of
            0: begin
                 Mouse(tx, ty, 0, 0, True);
                 Cutting := True;
               end;
               
            1: begin
                 Mouse(tx, ty, 0, 0, False);
                 Wait(RandomRange(25, 50));
                 ChooseOption('Yew');
                 Cutting := True;
               end;
          end;
        if(Cutting)then
        begin
          Sleeping := True;
          SleepAndMoveMouse(RandomRange(1000, 10000));
        end;
        Sleeping := False;
      end;
    end;
    end;

    I just wrote that on here so I don't think it works.. but you get the idea

    and also.. I would use TPA's

    (the reason for the tx-5, ty-5 is because it tends to find a color on the very edge of the tree and if you move the mouse to the right it will mess up, this will move it to the top left )

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

    Default

    Scar Code:
    var
     x, y : Integer;
    begin
      however you want to find and click the tree...
      GetMousePos( x, y);
      while IsUpText('ew') do
      wait(100);
      ...go for next tree?
    end;

    Something like that would work, ofcourse you would want to add more to it.
    Last edited by NCDS; 03-22-2009 at 10:08 PM.

  4. #4
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    function FindWillow(var fx, fy: Integer): Boolean;
    var
      x, y: Integer;
      TPA, xTPA: TPointArray;
      ATPA: T2DPointArray;
      I, H: Integer;
      Colors: TIntegerArray;
    begin
      Result := False;
      if not LoggedIn then Exit;
     
      if Random(5) = 0 then
        MakeCompass(IntToStr(RandomRange(180, 360)));
     
      Colors := [4355164, 3297881];     //  9811876 6587509
      ColorToleranceSpeed(3);
      SetColorspeed3Modifiers(1);
      for I := 0 to 1 do
      begin
        FindColorsTolerance(xTPA, Colors[I], MSX1, MSY1, MSX2, MSY2, 2);
        //Wait(200);
        //DebugTPA(TPA, IntToStr(I));
        TPA := CombineTPA(xTPA, TPA);
      end;

      if High(TPA) = -1 then
        Exit;
       
      ATPA := SplitTPA(TPA, 10);
      SortATPAFrom(ATPA, Point(MSCX, MSCY));
      SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
      //DebugATPA(ATPA, 'WillowEx');
     
      H := High(ATPA);
      Debug('FindWillow: Found ' + IntToStr(H + 1) + ' possible Trees.');
      for I := 0 to H do
      begin
        if High(TPA) <= 199 then Continue;
        MiddleTPAEx(ATPA[I], x, y);
        MMouse(x, y, 4, 4);
        Wait(RandomRange(80, 150));
        if IsUpText('illow') then
        begin
          Result := True;
          GetMousePos(fx, fy);
          Debug('FindWillow: Found Willow at ' + IntToStr(fx) + ', ' + IntToStr(fy));
          Break;
        end;
      end;

      ColorToleranceSpeed(2);
    end;

    function TrackWillow(fx, fy: Integer): TBox;
    var
      Pts: TPointArray;
      sL: Integer;
    begin
      if not LoggedIn then Exit;
     
      SetColorSpeed2Modifiers(0.38, 1.05);
      FindColorsTolerance(Pts, 3035202, fx - 10, fy - 10, fx + 10, fy + 10, 12);
     
      if Random(RandomRange(4, 7)) = 0 then
      begin
        Mouse(fx, fy, 0, 0, False);
        Wait(80 + Random(50));
        ChooseOption('hop');
      end else
        Mouse(fx, fy, 0, 0, True);

      while IsMoving(150) and LoggedIn do
      begin
        Wait(10);
        MiddleTPAEx(Pts, fx, fy);
        FindColorsTolerance(Pts, 3035202, fx - 10, fy - 10, fx + 10, fy + 10, 12);
        Inc(sL);
        if sL mod 30 = 0 then Debug('TrackWillow: Willow Moved To ' + IntToStr(fx) + ', ' + IntToStr(fy));
      end;
      Wait(Random(30));
     
      Result := GetTPABounds(Pts);
      SetColorSpeed2Modifiers(0.2, 0.2);
    end;

    function AreWeChopping: Boolean;
    var
      CoordsTPA: TPointArray;
      Ints: TIntegerArray;
      RInt, I, fx, fy: Integer;
    begin
      Result := False;
      if not LoggedIn then Exit;
      CoordsTPA := [Point(MSCX - 5, MSCY), Point(MSCX, MSCY - 5), Point(MSCX + 5, MSCY),
                    Point(MSCX, MSCY + 5), Point(MSCX, MSCY)];
      Ints := GetColors(CoordsTPA);
      Wait(100 + Random(50));
      for I := 0 to 4 do
        if FindColor(fx, fy, Ints[I], CoordsTPA[I].x - 2, CoordsTPA[I].y - 2, CoordsTPA[I].x + 2, CoordsTPA[I].y + 2) then
          Inc(RInt);
      Result := RInt < 5;
    end;

    function ChopTheTrees: Boolean;
    var
      x, y, C, TC: Integer;
      Pts: TPointArray;
      B: TBox;
      iC, iCTime: Integer;
    begin
      Result := False;
      if not LoggedIn then Exit;
      Debug('ChopTheTrees');
      SetAngle(True);
      SetRun(False);
     
      while (not InvFull) and LoggedIn do
      begin
        if not FindWillow(x, y) then
        begin
          Debug('Could not find tree to chop.');
          Inc(TC);
          if TC < 3 then
          begin
            Wait(RandomRange(1000, 1500));
            Continue;
          end;
          Reason('Could not find tree to chop.');
          LogOut;
          Exit;
        end;
        TC := 0;
       
        B := TrackWillow(x, y);

        SetColorSpeed2Modifiers(0.38, 1.05);
        FindColorsTolerance(Pts, 3035202, B.x1, B.y1, B.x2, B.y2, 12);

        C := Length(Pts);
        //Debug(IntToStr(C) + ' occurances of Tree Color found, before waiting.');
       
        iC := InvCount;
        iCTime := GetTimeRunning + 15000;
        while (AreWeChopping or (Length(Pts) > (C - 10))) and (not InvFull) do
        begin
          Status('ChopTheTrees: Waiting while chopping...');
          if Random(3) = 0 then
            SleepAndMoveMouse(400 + Random(100))
          else
            Wait(RandomRange(400, 500));
          if Random(4) = 0 then
            FindRandoms;
          FindColorsTolerance(Pts, 3035202, B.x1, B.y1, B.x2, B.y2, 12);
          if Random(8) = 0 then
            AntiBan;
          if not AreWeChopping then
            Wait(200);
          if BirdsNestCheck then Break;
          if GetTimeRunning > iCTime then
            if iC = InvCount then
              Break
            else
            begin
              iC := InvCount;
              iCTime := GetTimeRunning + 15000;
            end;
        end;
        SetColorSpeed2Modifiers(0.2, 0.2);
       
        Wait(RandomRange(200, 600));
      end;
      Result := True;
    end;

    Here are mine, don't just use them, try and read through and repeat it, but using your own skills

    Btw, ignore AreWeChopping... It doesn't work o.O
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  5. #5
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok first to 99_ thanks for the help but im looking for a function to just check if the yew is up, i already am working on a TPA for cutting it, pluss i dont realy see how that would work.. i mean theres nothing to check if the tree is gone xD

    NCDS thats pretty much what i was doing before but i desided the lack of mouse movement is very robotish and i dont want anyone gettin banned.

    Nava2... wow.. you are much beyond my skills haha im still very much a noob at TPA's. yeah i was thinking of something kinda similar to your tracking tree function... i just wasnt exactly sure how to do it lol. ill try to replicate it in my own way thanks this might be what i was looking for xD

    EDIT: Nava do i need some includes to use IsMoving()? ive never seen that function before in my life haha.

    ok so im just gonna show you the code i have, yeah i know im not useing a TPA lol i tried makeing one and failed so im just using objects for now :P
    SCAR Code:
    function TreeAtMouse: Boolean;
    begin
      Writeln('Check(' + IntToStr(TreeX) + ',' + IntToStr(TreeY) + ') = ' + IntToStr(ClickColor));
      if(GetColor(TreeX, TreeY) = ClickColor)then Result := True;
      if(GetColor(TreeX, TreeY) = ClickColor)then Result := True;
    end;


    function CutYew: Boolean;
    var
       x, y: integer;
       Color: TpointArray;
       i : integer;
       Colors: TIntegerArray;

    begin
      if(InFight or InvFull) then Exit;
      Result := False;
      //Color := [4820866, 2648669, 3240805, 4359803, 4424052, 2385497, 1325361, 1124644, 2381903, 665632, 2977122];
      for i := 0 to 7 do
      begin
        //FindObjTPA(x, y, Color, 7, -1, 30, 30, 4, ['ew', 'Yew']);
        if(not FindObjCustom(x, y, ['Yew', 'ew'], [4820866, 2648669], 4)) then Exit;
        FindObjCustom(x, y, ['Yew', 'ew'], [4820866, 2648669], 4);
        begin
          SWait;
          MMouse(x, y, 3, 3);
          if IsUpText('ew') then
          begin
            Mouse(x, y, 4, 4, True);
            Wait(Random(1000)+1000); //this gives your charicture time to walk to the tree, once this time is up the coordinates will be taken.
            ClickColor := GetColor(x, y);/////////////ADDED THIS LIL THINGGY
            TreeX := x;
            TreeY := y;
            Writeln('Nclick(' + IntToStr(x) + ',' + IntToStr(y) + ') = ' + IntToStr(ClickColor));
            Writeln('Tclick(' + IntToStr(TreeX) + ',' + IntToStr(TreeY) + ') = ' + IntToStr(ClickColor));
            Result := true;
            //MMove(Random(500), Random(500), 2, 2);
          end;
          if(Result) then Exit;
        end;
      end;
    end;


    begin
      repeat
        CutYew;
        repeat
          SWait;
        until(not TreeAtMouse or InFight or InvFull);
        {then the rest of my main loop}
      until(not Loggedin);
    end.

    and i keep getting these results =S

    Code:
    Nclick(212,151) = 2385240
    Tclick(212,151) = 2385240
    Check(212,151) = 2385240
    Nclick(197,151) = 1523510
    Tclick(197,151) = 1523510
    Check(197,151) = 1523510
    Check(197,151) = 1523510
    Check(197,151) = 1523510
    Check(197,151) = 1523510
    Check(197,151) = 1523510
    Nclick(191,147) = 3762784
    Tclick(191,147) = 3762784
    Check(191,147) = 3762784
    Check(191,147) = 3762784
    Check(191,147) = 3762784
    Check(191,147) = 3762784
    Nclick(202,160) = 2582876
    Tclick(202,160) = 2582876
    this is all on one tree.. so as you can see its not working =[

    scratch that. i know why its not working. the runescape mainscreen shifts ever 10 seconds or so by like 1 pixle. its not even noticeable unless you realy look for it haha. so my system wouldnt work cause every time the pixles shift the color will change =[ and thats realy bad cause they will be able to see that i click right after the pixle shift which is probably one way they find bots im guessing.
    Last edited by Lance; 03-23-2009 at 06:28 PM.
    Lance. Da. Pants.

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
  •