Results 1 to 13 of 13

Thread: Too many TPA boxes in wood cutting procedure

  1. #1
    Join Date
    Nov 2015
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default Too many TPA boxes in wood cutting procedure

    Hey guys, just wanted to let you all know this is my first time posting although i've been on the forums for some time now. I have just been browsing the forums and looking at guides with some friends help and trying to figure things out by myself. unfortunately i cant figure this one problem out and was hoping someone might help. And yes i know my code looks sloppy right now because i usually clean up after, but its whatever you guys recommend. i have to give credit for the mayor's tut's for coming up with this, especially the clay miner.

    My issue is that theirs too many ATPA boxs on the screen, i picked out the right colors its just to many, and when it looks for it, a bunch of the boxes pop up but i dont need maybe 1 or 2 for each tree. Is their an easy way of doing this? ive only being scripting for like 2 weeks now so i still dont know much. novice here. I'll post a picture of what i mean with all the boxes if you cant run my mess of a script.

    Here's my code below

    Code:
    {$DEFINE SMART}              // Always have this to load smart
    {$I SRL-6/SRL.simba}         // To load the SRL include files
    {$I SPS/lib/SPS-RS3.Simba}   // To load the SPS include files
    
    procedure declarePlayers();
    begin
      setLength(players, 1);
    
      with players[0] do
      begin
        loginName := '';
        password := '';
        isActive := true;
        isMember := false;
      end
      currentPlayer := 0;
    end;
    
    
    ////////////////*************SCRIPT*****************\\\\\\\\\\\\\\\\\\\\\\\\\\\
    
    
    
    
    
      //RunToTrees
    procedure runToTrees();
    
    var
      pathToTrees: TPointArray;
    begin
         if not isLoggedIn() then
        exit;
    
      pathToTrees := [Point(49, 35), Point(54, 45), Point(68, 61), Point(73, 75), Point(79, 96), Point(85, 114), Point(93, 149), Point(95, 172), Point(95, 189), Point(100, 216), Point(104, 242),Point(125, 252)];
    
      if SPS.walkPath(pathToTrees) then
        minimap.waitPlayerMoving()
      else
        writeLn('We failed to walk to the trees');
    end;
    
    
      //chopTrees
    procedure chopTrees();
    var
      x, y, i, r: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
      mineTimer: TTimeMarker;
    
    begin
      if not isLoggedIn() then
        exit;
    
        minetimer.start();
    //  if random(50) = 4 then
     // MyRandomCompass();
    
    
    
      repeat
        wait(randomRange(1000, 2600));
        findColorsSpiralTolerance(x, y, TPA, 2575198, mainScreen.getBounds(), 6, colorSetting(2, 0.28, 0.54));
    
          if not isLoggedIn() then
        exit;
    
        if (Length(TPA) < 1) then
        exit;
    
        ATPA := TPA.toATPA(20, 20);
        ATPA.filterBetween(0, 6);
        ATPA.sortFromMidPoint(mainscreen.playerPoint);
        smartImage.debugATPA(ATPA);
    
       // if mainscreen.isPlayerAnimating() then
     //   repeat
      //  if random(50) = 4 then
      //  smallRandomMouse(80 + random(100));
      //  wait(randomRange(500, 1000));
      //  writeLn('waiting to finish mining rock');
      //  until not mainscreen.isplayeranimating();
    
        for i := 0 to high(ATPA) do
        begin
        if random(9) = 4 then
          smallRandomMouse(80 + random(100));
        if random(20) = 5 then
          sleepAndMoveMouse(randomRange(250, 750));
        //if random(100) = 2 then
         //  MyRandomCompass();
    
        mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
        inc(r);
          if isMouseOverText(['hop','down','ree'], 100)   then
    
           begin
            if random(30) = 1 then
            begin
              wait(randomRange(100, 200));
              fastClick(MOUSE_RIGHT);
              chooseOption.select(['hop','down','ree']);
              smartImage.clear();
              break;
            end;
            if random(100) = 4 then
           // begin
           //   antiban();
           // end;
            if random(200) = 4 then
            smallRandomMouse(10 + random(10));
            //
            fastClick(MOUSE_LEFT);
            //
            if random(200) = 4 then
            fastClick(MOUSE_LEFT);
    
            wait(1000 + random(500));
            //if mainscreen.isPlayerAnimating() then
           // begin
          //    writeLn('Player is Animating');
           //   if random(100) = 4 then
           //   begin
           //   antiban();
           //   writeLn('Doing antiban While Waiting');
           //   wait(10 + random(50));
           //   end;
           // end;
            if random(50) = 5 then
            sleepAndMoveMouse(randomRange(1000, 1400));
            //
            smartImage.clear();
            break;
            end;
    
      end;
        tabBackpack.waitForShift(2500);
        claimSpinTicket();
           if (tabBackpack.isItemInSlot(28)) then
           begin
               wait(100)
           //chooseOption.select(['rop','']);
           //writeLn('BackPack Is Full. Banking now.');
    
           end;
    
    
      until tabBackpack.isFull();
    
    
    
      minimap.setAngle(MM_DIRECTION_NORTH);
    
    
    
    end;
    
    procedure  packIsFull();
    
    begin
         if tabBackpack.isFull() then
          writeln('The backpack is full!');
                   tabBackpack.dropItems();
    
    
    end;
    
    
    
    
    
    // main loop
    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();
    
      SPS.setup('Clay_miner01',RUNESCAPE_OTHER);
    
      if not isLoggedIn() then
      begin
        players[currentPlayer].login();
        exitTreasure();
        minimap.setAngle(MM_DIRECTION_NORTH);
        mainScreen.setAngle(MS_ANGLE_HIGH);
      end;
    
    
     // packIsFull();
     repeat
    
      repeat
      chopTrees();
      until tabBackPack.isFull
    
     if tabBackPack.isFull() then
        begin
      packIsFull();
           end;
    
      until false;
    
    
    
    
    end.
    Im just trying to work on the chopTrees procedure so i can nail down the most important part, since i havent implemented the other procedures i just drop them using another procedure "packIsFull"
    Thanks again for anys feedback.
    Picture below----------------
    Tree_tpaPoints.png
    Attached Images Attached Images

  2. #2
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    You can try tpa.cluster() instead of toATPA().
    Also atpa.filterbetween()

    A more advanced method would be something like this: https://villavu.com/forum/showthread.php?t=83795

    Simba Code:
    procedure packIsFull();
    begin
      if tabBackpack.isFull() then  //this check is redundant because you already checked in the mainloop.
        writeln('The backpack is full!');
      tabBackpack.dropItems();
    end;


    Using simba tags instead of code will make your script easier to read: [ simba] your script here [ /simba]
    Simba Code:
    {$DEFINE SMART}              // Always have this to load smart
    {$I SRL-6/SRL.simba}         // To load the SRL include files
    {$I SPS/lib/SPS-RS3.Simba}   // To load the SPS include files

    procedure declarePlayers();
    begin
      setLength(players, 1);

      with players[0] do
      begin
        loginName := '';
        password := '';
        isActive := true;
        isMember := false;
      end
      currentPlayer := 0;
    end;


    ////////////////*************SCRIPT*****************\\\\\\\\\\\\\\\\\\\\\\\\\\\





      //RunToTrees
    procedure runToTrees();

    var
      pathToTrees: TPointArray;
    begin
         if not isLoggedIn() then
        exit;

      pathToTrees := [Point(49, 35), Point(54, 45), Point(68, 61), Point(73, 75), Point(79, 96), Point(85, 114), Point(93, 149), Point(95, 172), Point(95, 189), Point(100, 216), Point(104, 242),Point(125, 252)];

      if SPS.walkPath(pathToTrees) then
        minimap.waitPlayerMoving()
      else
        writeLn('We failed to walk to the trees');
    end;


      //chopTrees
    procedure chopTrees();
    var
      x, y, i, r: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
      mineTimer: TTimeMarker;

    begin
      if not isLoggedIn() then
        exit;

        minetimer.start();
    //  if random(50) = 4 then
     // MyRandomCompass();



      repeat
        wait(randomRange(1000, 2600));
        findColorsSpiralTolerance(x, y, TPA, 2575198, mainScreen.getBounds(), 6, colorSetting(2, 0.28, 0.54));

          if not isLoggedIn() then
        exit;

        if (Length(TPA) < 1) then
        exit;

        ATPA := TPA.toATPA(20, 20);
        ATPA.filterBetween(0, 6);
        ATPA.sortFromMidPoint(mainscreen.playerPoint);
        smartImage.debugATPA(ATPA);

       // if mainscreen.isPlayerAnimating() then
     //   repeat
      //  if random(50) = 4 then
      //  smallRandomMouse(80 + random(100));
      //  wait(randomRange(500, 1000));
      //  writeLn('waiting to finish mining rock');
      //  until not mainscreen.isplayeranimating();

        for i := 0 to high(ATPA) do
        begin
        if random(9) = 4 then
          smallRandomMouse(80 + random(100));
        if random(20) = 5 then
          sleepAndMoveMouse(randomRange(250, 750));
        //if random(100) = 2 then
         //  MyRandomCompass();

        mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
        inc(r);
          if isMouseOverText(['hop','down','ree'], 100)   then

           begin
            if random(30) = 1 then
            begin
              wait(randomRange(100, 200));
              fastClick(MOUSE_RIGHT);
              chooseOption.select(['hop','down','ree']);
              smartImage.clear();
              break;
            end;
            if random(100) = 4 then
           // begin
           //   antiban();
           // end;
            if random(200) = 4 then
            smallRandomMouse(10 + random(10));
            //
            fastClick(MOUSE_LEFT);
            //
            if random(200) = 4 then
            fastClick(MOUSE_LEFT);

            wait(1000 + random(500));
            //if mainscreen.isPlayerAnimating() then
           // begin
          //    writeLn('Player is Animating');
           //   if random(100) = 4 then
           //   begin
           //   antiban();
           //   writeLn('Doing antiban While Waiting');
           //   wait(10 + random(50));
           //   end;
           // end;
            if random(50) = 5 then
            sleepAndMoveMouse(randomRange(1000, 1400));
            //
            smartImage.clear();
            break;
            end;

      end;
        tabBackpack.waitForShift(2500);
        claimSpinTicket();
           if (tabBackpack.isItemInSlot(28)) then
           begin
               wait(100)
           //chooseOption.select(['rop','']);
           //writeLn('BackPack Is Full. Banking now.');

           end;


      until tabBackpack.isFull();



      minimap.setAngle(MM_DIRECTION_NORTH);



    end;

    procedure  packIsFull();

    begin
         if tabBackpack.isFull() then
          writeln('The backpack is full!');
                   tabBackpack.dropItems();


    end;





    // main loop
    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();

      SPS.setup('Clay_miner01',RUNESCAPE_OTHER);

      if not isLoggedIn() then
      begin
        players[currentPlayer].login();
        exitTreasure();
        minimap.setAngle(MM_DIRECTION_NORTH);
        mainScreen.setAngle(MS_ANGLE_HIGH);
      end;


     // packIsFull();
     repeat

      repeat
      chopTrees();
      until tabBackPack.isFull

     if tabBackPack.isFull() then
        begin
      packIsFull();
           end;

      until false;




    end.
    and [ img] tags for images
    Last edited by Citrus; 11-28-2015 at 07:38 PM.

  3. #3
    Join Date
    Nov 2015
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    No its still not coming up for just a single box or 2. It seems with the tpa.cluster(); it did decrese the amount of boxes to choose from (which i assumed would do and cluster them closer together). Theres a few other bugs that are apparent that i want to try to work those out myself if i can. Thanks for the help though, i appreciate it

    By the way if you knew or anybody else, how can you target something like trees or maybe hill giants that have so much of just a few colors that take up a decent amount of surface area that are scattered around? i just want to stick with using colors though
    Last edited by krogh424; 11-29-2015 at 05:39 AM.

  4. #4
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default

    I would just find TPA of brownish trunk , second TPA of green treetop (just be careful to not include green surface) and filter first TPA by the second.


    Simba Code:
    FilterTPADistTPA(TPA_brown,1,50,TPA_green);
    then use SplitTPA instead of TPAtoATPA.

  5. #5
    Join Date
    Nov 2015
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Thanks, will let you know when i implement it.

  6. #6
    Join Date
    Nov 2015
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Question? when you use the FilterTPADistTPA procedure is that just what it looks like below?

    Simba Code:
    procedure FilterPointsDist(var Points: TPointArray; const MinDist, MaxDist: Extended; Mx, My: Integer);

    Can you explain it a bit in more?

  7. #7
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    FilterPointsDist:
    Removes the points from the TPointArray Points that are not within the radius MinDist (Min Distance) and MaxDist
    from the origin Mx and My
    bg5's function compares two TPointArrays as opposed to one TPointArray and one TPoint.

  8. #8
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default

    Quote Originally Posted by krogh424 View Post
    Question? when you use the FilterTPADistTPA procedure is that just what it looks like below?

    Simba Code:
    procedure FilterPointsDist(var Points: TPointArray; const MinDist, MaxDist: Extended; Mx, My: Integer);

    Can you explain it a bit in more?
    No it's a procedure from my plugin: https://villavu.com/forum/showthread.php?t=83795.

    It returns all points from TPA1 ,which have any point from TPA2 in given distance.

    In this particular example: it will return only those brown pixels, which are in the neighbourhood of leaf-color. So it will filter-out all brown objects, which are not trees (like furnitures inside the building)

  9. #9
    Join Date
    Nov 2015
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Ok so this is probably a redundant question but i keep getting an error: Unknown declaration "FilterTPADistTPA"

    Simba Code:
    procedure chopTrees();
    var
      x, y : integer;
      TPA: TPointArray;
      TPA_Brown: TPointArray;
      TPA_Green: TPointArray;
      ATPA: T2DPointArray;
      treeTimer: TTimeMarker;
      //PlayerDots: Array of TPointArray;

    begin
      if not isLoggedIn() then
        exit;

        treetimer.start();

      repeat
        wait(randomRange(500, 1500));
        //spiral tolerance starts x,y first and then spirals out
        findColorsSpiralTolerance(x, y, TPA_Brown, 1977389, mainScreen.getBounds(), 2, colorSetting(2, 1.16, 1.91));
        findColorsSpiralTolerance(x, y, TPA_Green, 2386517, mainScreen.getBounds(), 4, colorSetting(2, 0.56, 1.33));

        if not isLoggedIn() then
        exit;

        if (Length(TPA_Brown) < 1) and (Length(TPA_Green) then
        exit;

        FilterTPADistTPA(TPA_Brown,1,50,TPA_Green);
        ATPA := TPA_Brown.split(10);
        ATPA.filterBetween(0, 10);
        ATPA.sortFromMidPoint(mainscreen.playerPoint);
        smartImage.debugATPA(ATPA);


    I know im missing a variable somewhere, not sure why im seeing this but anyways what do you think of so far?

  10. #10
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by krogh424 View Post
    Ok so this is probably a redundant question but i keep getting an error: Unknown declaration "FilterTPADistTPA
    You need bg5's plugin

    also missing condition here
    Simba Code:
    if (Length(TPA_Brown) < 1) and (Length(TPA_Green) then
        exit;

    I think cluster is preferred over split if distance < 100
    http://docs.villavu.com/simba/script...tml#clustertpa
    Last edited by Citrus; 09-06-2016 at 06:54 PM.

  11. #11
    Join Date
    Nov 2015
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Ok, so not sure if i installed the plugin right. i downloaded the .rar file and extracted the .dll file and placed it in my plugins folder. Its chilling their, and im still getting the error. what now?

  12. #12
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Simba Code:
    {$loadlib AND_TPA}

  13. #13
    Join Date
    Nov 2015
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Ahh yes that was it! thank you guys again i got it working now, so now im just gonna finish it up and work out some bugs. I appreciate the help btw i used cluster instead of split
    Last edited by krogh424; 12-02-2015 at 04:19 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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