Results 1 to 8 of 8

Thread: Rock finding

  1. #1
    Join Date
    Sep 2010
    Posts
    305
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default Rock finding

    I am working on a clay mining script and it has progressed pretty far. I have gotten it to where it can mine a load bank and repeat with really no more problems. Besides adding things like antiban and more failsafes, I am looking to to make the script work better in general. Currently, I am looking to make the mining process smoother and quicker.

    Code:
    function ClayColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.03, 3.63);
    
      FindColorsSpiralTolerance(MSCX, MSCY, arP, 8239579, MSX1, MSY1, MSX2, MSY2, 11);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);
    
        if (X >= 30.46) and (X <= 69.28) and (Y >= 31.67) and (Y <= 70.48) and (Z >= 19.91) and (Z <= 35.95) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
          Break;
        end;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    
    Procedure FindClay;
    var
      x, y: Integer;
    
    begin
      if not LoggedIn then Exit;
      Randoms;
      if FindObjTPA(x, y, ClayColor, 5, 1, 25, 25, 5, ['lay rocks', 'y r', 'ine clay']) then
      begin
        Mouse(x, y, 7, 7, True);
        Writeln('Found clay.');
      end else
        Writeln('Clay not found.')
    end;
    
    
    Procedure MineClay;
    var
      PlayerBox: TBox;
    
    begin
      if not LoggedIn then Exit;
      Randoms;
      PlayerBox := IntToBox(245, 130, 285, 195);
      if AveragePixelShift(PlayerBox, 300, 1000) < 250 then
        FindClay;
    end;
    That is everything I am using for mining so far. I just added ACA today and it is finding the color almost every time, but it finds it a bit slower. What could I change that would help speed up the mining process without sacrificing any accuracy (possibly increasing accuracy)?

    Another thing I am looking to do is instead of checking the player for pixel shifting to determine when to try to mine again how can I use the color in the rock to determine that? For example, my idea of what would happen is the scripts would find a rock then draw a box around that, and once the clay color is no longer in the box it would find another. Is that something along the lines of what I could possibly do?

    I would appreciate if people don't post the exact code of how to do things, unless it is just a better function/procedure in SRL. I would rather be pointed to a tutorial or another source that could help me learn to develop the code on my own. Thanks.

  2. #2
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Hi there,

    I had this exact struggle when I was creating my mining script. I started with a Pixelshift check, but that just didn't cut it. I ended up setting my public chat to hide and looking at the game text changes to determine when a rock was mined.

    The problem with using color is that you find it and click it; but if you have to walk to the rock then you cannot use the TPA bounds to keep track of the rock colors anymore. You're forced to then re-find it after you've stopped moving which could result in finding the wrong rock. And I don't think I need to explain what kind of issues that could cause

    Good luck with whatever you end up doing.

  3. #3
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Quote Originally Posted by blother View Post
    Currently, I am looking to make the mining process smoother and quicker.
    I think runaway(might be someone else) recently released a crafting script at the crafting guild, and it mines clay. You can check the way he created his procedure, ad try to understand how to make it faster.

    Quote Originally Posted by blother View Post
    Another thing I am looking to do is instead of checking the player for pixel shifting to determine when to try to mine again how can I use the color in the rock to determine that? For example, my idea of what would happen is the scripts would find a rock then draw a box around that, and once the clay color is no longer in the box it would find another. Is that something along the lines of what I could possibly do?
    I'm pretty sure MSI does that, after clicking the rock, when your screen becomes still(ie. you are next to the rock) it searches for the ore color around you, creates a box where the ore color is concentrated and waits until the color is gone AND uses pixelshift just in case. (at least that's how I see it does it :P)You could try to check the mining file of MSI, though it might be hard to figure out since MSI is scripted very differently.
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  4. #4
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Just do what I did, wait for the xp to increase.

  5. #5
    Join Date
    May 2012
    Location
    Texas
    Posts
    365
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What do you do when someone else gets the rock? :/

  6. #6
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Based Lord View Post
    What do you do when someone else gets the rock? :/
    Hop worlds

  7. #7
    Join Date
    Sep 2010
    Posts
    305
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Shay View Post
    Just do what I did, wait for the xp to increase.
    That is probably a good idea except for what others have said about not getting the ore. ACA seems to have slowed it down, but the script is more consistent with it. Could the box be drawn after walking to the rock? Also, would this process make the script slower?

  8. #8
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by blother View Post
    That is probably a good idea except for what others have said about not getting the ore. ACA seems to have slowed it down, but the script is more consistent with it. Could the box be drawn after walking to the rock? Also, would this process make the script slower?
    It wouldn't make it slower since waiting to mine the ore is simply that; waiting. Make sure you factor in the chance that the color you're monitoring is not the color of the rock you just clicked. You should use a chat message/xp check failsafe (or another) to make sure you're not waiting for the wrong rock.

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
  •