Results 1 to 13 of 13

Thread: Mining Procedure Help

  1. #1
    Join Date
    Dec 2007
    Location
    Indiana
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Mining Procedure Help

    I am making a guild miner/ banker, and im stuck on a problem. I dont know how to make the script wait until my char is done mining a rock, to start mining a new one. get wat im saying? right now im using timed mining, and that is ineffecient and kinda skechy looking. so is there a way that i can make scar detect when a rock has no more ore? here is my procedure.

    Code:
     Procedure MinetheCoal;
    var MiningTime: Integer;
    Begin
      MarkTime(MiningTime);
    repeat
      if(not(LoggedIn))then
      Exit;
      GameTab(4);
      FindColorSpiral(x, y, 2834239, 0, 0, 517, 337);
      MMouse(x,y,0,0);
      if(IsUpText('ine'))then
      begin
        GetMousePos(x,y);
        Mouse(x,y,0,0,true);
        Flag;
        Wait(10000+random(3000));
      end;
    until(InvFull) or (TimeFromMark(MiningTime) > 600000+random(60000));
    writeln(' Your iventroy is full, im going to empty it into your bank.');
    end;
    Soved

  2. #2
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Well when the ore is gone the rock changes to that greyish color.

    Maybe you could do something with that color to determine if it's gone?

  3. #3
    Join Date
    Dec 2007
    Location
    Indiana
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hmmm, i wonder how... i could tell it 2 move on when it finds that greyish color, but then wats to stop it from looking all over the sceen? how could it know wich rock to find as grey? ill try and figure it out. thanx, and especialy for ur speedy reponse

  4. #4
    Join Date
    Jun 2007
    Location
    Belgium
    Posts
    333
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This is what i used in my goldminer

    SCAR Code:
    function CountItemDtm(Dtm: Integer): Integer;
    var
      i, x, y: Integer;
      TB: Tbox;
    begin
      if (not (LoggedIn)) then
        Exit;
      Result := 0; // Same thing as in Setup
      GameTab(4);
      for i := 1 to 28 do
      begin
        TB := InvBox(i);
        if ExistsItem(i) then
          if FindDtm(Dtm, x, y, TB.x1, TB.y1, TB.x2, TB.y2) then
            Inc(Result);
      end;
    end;

    Procedure WaitUntilMined;
    Var
      Slevel, i: Integer;
    begin
      if (not (LoggedIn)) then
        Exit;
      if FindBlackChatMessage('vailable') then
        Exit;
      Repeat
        If (Not (LoggedIn)) or (InvFull) or (LostRock) then
          Break;
        NewTotal := CountItemDtm(dtmGold);
        Inc(i);
        If (not(NewTotal > LastTotal)) then
          Wait(500 + Random(200));
      until (NewTotal > LastTotal) or (i >= 15);
      if (NewTotal > LastTotal) then
        begin
          LastTotal := NewTotal;
          MiningRock := 0;
        end;
    end;

    After you start mining the rock and call this, it will count number of ores in your inventory and compare it to the last count.

  5. #5
    Join Date
    Jan 2008
    Location
    Norway
    Posts
    39
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The above example is very good. But if your gonna find it the color way do this:
    SCAR Code:
    Procedure MinetheCoal;
    var MiningTime, MapPosX1, MapPosX2, MapPosY1, MapPosY2: Integer;
    FoundSecondColor: boolean;
    Begin
      MarkTime(MiningTime);
    repeat
      x := MSCX; //Center of mainscreen so it finds the rock thats closest to player
      y := MSCY;
      FoundSecondColor := False;
      if(not(LoggedIn))then
      Exit;
      GameTab(4);
      FindColorSpiral(x, y, 2834239, 0, 0, 517, 337);  //Now it searches from center and out
      //And replaces the x,y with stone position
      MMouse(x,y,0,0);
      if(IsUpText('ine'))then
      begin
        GetMousePos(x,y);
        Mouse(x,y,0,0,true);
        Flag;
        MapPosX1 := x-5;
        MapPosY1 := x+5;
        MapPOSX2 := x+5;
        MapPosY2 := x-5;
        repeat
        Wait(100+random(100));
        if(FindColorSpiral(x, y, {Grey color}, MapPosX1, MapPosY1, MapPosX2, MapPosY2")) then
        begin
        FoundSecondColor := True;
        end;
        until(FoundSecondColor)
      end;
    until(InvFull) or (TimeFromMark(MiningTime) > 600000+random(60000));
    writeln(' Your iventroy is full, im going to empty it into your bank.');
    end;

    Not tested tho, but should work in theory.

  6. #6
    Join Date
    Jun 2007
    Location
    Belgium
    Posts
    333
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Aye, that should work also, just have to include a follow rock procedure, cause your x,y will be off after you walked to the rock. Also, you'll need to make a procedure to find the middle of the rock, cause if you click on the rockside and it's next to one you just mined, you'll get a false positieve for finding the empty rock.

  7. #7
    Join Date
    Dec 2007
    Location
    Indiana
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Psychor: it looks good, and i understand what it does, but i dont know it would be used in my loop...

    JanOve: also looks good, but like Psychor said,
    your x,y will be off after you walked to the rock
    .
    thats exactly what happend. so ive got to now figure out how to keep that x,y and how to find the middle of the rock... i dont know how lol
    thanx guys

  8. #8
    Join Date
    Jan 2008
    Location
    Norway
    Posts
    39
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, my bad :S

    You could also use the chat window to find out if a ore has been mined. (The game chat window gices a detailed report when it started mine at the rock and when it got a ore) But I think Psychor's method would be best here

  9. #9
    Join Date
    Dec 2007
    Location
    Indiana
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks. phyco's method looks effecient, and pretty failproof, but i realy dont understand it. i dont want to have things in my script that i dont understand, because that is just copying and pasting. and leeching. id like to learn, and i dont think im there yet. instead im using the text finding method. it works 80% of the time. the other times, it cant see teh text, because some1 said somthing right at the same time as i finished. it doesnt much up my loop, but looks a lil un-natural, but i dont know a better way yet. anyway thanx every1. here it is.

    Code:
    Procedure MinetheCoal;
    var MiningTime, OreTime: Integer;
    Begin
      MarkTime(MiningTime);
      repeat
          if(not(LoggedIn))then
          Exit;
          GameTab(4);
          if(FindColorSpiral(x, y, 2834239, 0, 0, 517, 337))then
          begin
            MMouse(x,y,0,0);
            if(IsUpText('ine'))then
            MarkTime(OreTime);
            begin
              GetMousePos(x,y);
              Mouse(x,y,0,0,true);
              Flag;
              repeat
                Wait(1000+random(300));
              until(FindBlackChatMessage('anage'))or
              (FindBlackChatMessage('vailable')) or
              (TimeFromMark(OreTime) > 30000+random(100));
            end;
          end;
          if(not(FindColorSpiral(x, y, 2834239, 0, 0, 517, 337)))then
          begin
            GoToMiningSymbol;
          end;
        until(InvFull) or (TimeFromMark(MiningTime) > 600000+random(60000));
      writeln('Load done');
    end;

  10. #10
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    use FindColorsTolerance in a box around the previous location of the rock, then check the length of the array, then the new location is found with MiddleTPA, this follows the rock and checks for its existance(if the length is less then 5 its gone)
    Infractions, reputation, reflection, the dark side of scripting, they are.

  11. #11
    Join Date
    Jun 2007
    Location
    Belgium
    Posts
    333
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If you turn public chat off, then you shouldn't have that problem anymore, course, you can't use an autoresponder then if you where.

  12. #12
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Maybe something like that?

    SCAR Code:
    function Followcolor(rx, ry, color, tol: Integer): Boolean;
    var timeout, noflag : integer;
    begin
    marktime(timeout);
      repeat
        wait(10);
        Result := FindColorSpiralTolerance(rx, ry, color, rx - 15, ry - 15, rx + 15, ry + 15, tol);
      until(timefrommark(timeout) > 5000) or (not flagpresent ) or (not result);
      if result then
      begin
      marktime(noflag);
        repeat
          wait(10);
          Result := FindColorSpiralTolerance(rx, ry, color, rx - 15, ry - 15, rx + 15, ry + 15, tol);
        until(timefrommark(noflag)> 700) or (not Result);
      end;
    end;

    function Getfreeinvspot : integer;
    begin
      for InvSpot := 1 to 28 do
      if not(ExistsItem(InvSpot))then
      begin
        result := invspot;
        exit;
      end;
    end;

    procedure Mining;
    begin
      repeat
        if (FindNormalRandoms) or (not loggedin) then exit;  
        slot := getfreeinvspot;      
        if FindObj(a, b ,'ine' ,orecolor, oretol) and (not FindGas(a, b - 20)) then
        begin
          mouse(a, b , 0, 0, true);
          MarkTime(MineStart);
          wait(300);
          FindTalk;
          repeat

            if not followcolor(a, b, orecolor, oretol) then break;
            if existitem(slot) then break;
            Findpick;
            If FindGas(a, b-20) then
            begin
              MouseFlag(mmcx, mmcy, 4, 4, true);
              Wait2(25000 + random(15000), true);
              Highestangle;
              MakeCompass('n');  
            end;  
            ftwait(2);      
     
          until TimeFromMark(MineStart) > MaxMineingTime
        end;  
      until (InvFull);
    end;


    Edit: To make Findpick work you'll need to do FindPickHeadColors; somewhere in player setup
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

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

    Default

    @Mass: I suggest using FindColorSpiralTolerance, the color doesn't stay same forever.

    You might want to make your own, but for new rocks:

    SCAR Code:
    Function FindRockVein(Var Rx, Ry, C: Integer; x1, y1, x2, y2: Integer): Boolean;
    Var
      L, I, Mx, My, P, CTS: Integer;
      TPA, TPA2, TPA3: TPointArray;
      Box, B2: TBox;
      TP: TPoint;
    Begin
      If Not LoggedIn Then Exit;
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      Box := IntToBox(MSCX - 15, MSCY - 20, MSCX + 15, MSCY + 20);
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, C, x1, y1, x2, y2, 15);
      L := High(TPA);
      For I := 0 To L Do
      Begin
        TP := TPA[i];
        If(Not(PointInBox(TP, Box)))Then
        Begin
          FindColorsTolerance(TPA2, 736344, TP.x - 10, TP.y - 10, TP.x + 10, TP.y + 10, 15);
          If(GetArrayLength(TPA2) >= 100)Then
          Begin
            MiddleTPAEx(TPA2, TP.x, TP.y);
            B2 := IntToBox(TP.x - 10, TP.y - 10, TP.x + 10, TP.y + 10);
            Mx := B2.x2 - B2.x1 shr 1;
            My := B2.y2 - B2.y1 shr 1;
            FindColorsSpiralTolerance(Mx, My, TPA3, C, B2.x1, B2.y1, B2.x2, B2.y2, 15);
            If(GetArrayLength(TPA3) >= 15)Then
            Begin
              P := Round((GetArrayLength(TPA3) / GetArrayLength(TPA2)) * 100);
              If(P > 3) And (P < 20)Then
              Begin
                Result := True;
                MiddleTPAEx(TPA3, Rx, Ry);
                C := GetColor(TPA3[0].x, TPA3[0].y);
                Break;
              End;
            End;
          End;
        End;
      End;
      ColorToleranceSpeed(CTS);
    End;
    credit me if using...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Mining procedure
    By weequ in forum OSR Help
    Replies: 6
    Last Post: 04-10-2008, 01:08 PM
  2. help with my mining procedure
    By stuckman in forum OSR Help
    Replies: 4
    Last Post: 06-01-2007, 06:31 AM
  3. help w/ mining procedure...
    By stupedspam in forum OSR Help
    Replies: 7
    Last Post: 04-04-2007, 02:32 AM
  4. Mining Procedure
    By stol3n in forum OSR Help
    Replies: 6
    Last Post: 04-03-2007, 07:09 AM
  5. Mining Procedure
    By ben123321 in forum OSR Help
    Replies: 9
    Last Post: 11-25-2006, 09:33 PM

Posting Permissions

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