Results 1 to 4 of 4

Thread: Mining coal procedure

  1. #1
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default Mining coal procedure

    I am just fiddling around trying to make a guild coal miner/banker, but as of yet haven't written any procedures for walking because I am struggling to work out which method will be the best for what I am doing.

    Never the less, this is my current coal mining procedure which works reasonably well at the moment. A few questions -

    - Once the script finds the initial color (the slightly lighter rock color) I then want it to draw the ATPA boxes and check to see if the dark "coal present" color is within that box, before moving the mouse and clicking. At present it simply searches for the light color and then checks the uptext, if thats wrong it will rotate the camera angle and move on until it finds one with the appropriate uptext. but this looks rather 'bot-like' and would prefer it just recognised the coal before it moved and clicked with the uptext being more of a failsafe than a necessary procedure.

    - It's currently using FindColorsSpiralTolerance and I have it set to spiral from the centre of the main screen. However, it seems to like clicking rocks on the outer edges of the main screen even when there are coal-filled rocks right near my character.. Any ideas as to why that's happening?

    Simba Code:
    procedure MineCoal;
    var
      i,C,T,CTS: integer;
      MyTPA: TPointArray;
      TPAA: T2DPointArray;
      M: TPoint;
    begin
      if not LoggedIn then
      TerminateScript else
      if not FindNormalRandoms then
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      if not FindColorsSpiralTolerance(MSCX,MSCY,MyTPA,4688547,MSX1,MSY1,MSX2,MSY2,3) then
      FindColorsSpiralTolerance(MSCX,MSCY,MyTPA,789773,MSX1,MSY1,MSX2,MSY2,3) else
      if FindColorsSpiralTolerance(MSCX,MSCY,MyTPA,4688547,MSX1,MSY1,MSX2,MSY2,3) then
      begin
      ColorToleranceSpeed(CTS);
      TPAA := TPAToATPAEx(MyTPA, 26, 24);
      SortATPASize(TPAA, True);
      for i:= 0 to High(MyTPA) do
      M:= MyTPA[i];
      WriteLn(IntToStr(High(MyTPA)));
      MMouse(M.x-1,M.y-1,3,3);
      end else
      begin
        repeat
        CompassMovement(10,180,False);
        WriteLn('Couldnt Find Coal, Exiting');
        Exit;
        until (FindColorsSpiralTolerance(MSCX,MSCY,MyTPA,789773,MSX1,MSY1,MSX2,MSY2,3)) or (FindColorsSpiralTolerance(MSCX,MSCY,MyTPA,4688547,MSX1,MSY1,MSX2,MSY2,3))
      end;
      if WaitUpTextMulti(['oal'],600) then
      begin
        C:= InvCount;
        ClickMouse2(True);
        FFlag(0);
        MarkTime(T);
        While IsMining do
        Wait(RandomRange(500,1000));
        if FindBlackChatMessage('o ore') or FindBlackChatMessage('anage') or (InvCount <> C) or (T > 10000) then
        Exit;
      end else
      WriteLn('Couldnt Find UpText, Try Again');
      CompassMovement(10,180,False);
      Exit;
    end;

    Also, if there are any recommendations for failsafes I should add in, different, easier or more human-like ways to do any of this procedure please let me know. Any feedback and criticism is welcome and appreciated.

  2. #2
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Try something like this?:

    Excerpt from 'a lowdown on WizzyPlugin':

    GetTPABounds

    PHP Code:
    {*******************************************************************************
    function 
    GetTPABounds(TPATPointArray): TBox;
    DescriptionReturns the boundaries of the TPA as a TBox.
    *******************************************************************************} 
    This is one more useful function, it seems that the most used functions seem to be included at the end :/. What GetTPABounds does is that it makes a box around all the points 'TPA' and returns the Boundaries in the form of data type TBox.
    A picture:



    Usage:
    SCAR Code:
    {.Include SRL/SRL.Scar}
    Var
      TPA : TPointArray;
      TB : TBox;      
    Begin
      SetupSRL;
      FindColorsTolerance(TPA, ClBlack, MSX1, MSY1, MSX2, MSY2, 50);
      TB := GetTPABounds(TPA);
      MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, 1);
    End.

    What this script does it that it stores all the occurances of the color black, found in the RuneScape mainscreen to the TPA. It then gets the boundaries of the TPA and clicks randomly inside the box using MouseBox();.

  3. #3
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    Just what i was looking for! Thank you, will give this a try when I get home from work.
    Any ideas on the spiral and why it always chooses further away rocks?

  4. #4
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by p1ng View Post
    Just what i was looking for! Thank you, will give this a try when I get home from work.
    Any ideas on the spiral and why it always chooses further away rocks?
    I have no idea, In fact I see it's been happening to me too.

    however, if you use GetTPABounds and replace MSX1, MSY1, MSX2, MSY2 with the bound of the TPA, you may be able to stop that.

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
  •