Results 1 to 8 of 8

Thread: Two Problems With Mining Script...

  1. #1
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Two Problems With Mining Script...

    I'm having some problems with the mining script I wrote (ie. modified the script from Kyle's tutorial) for mining copper rocks. There are two things in my script so far that aren't working.

    1. It doesn't stop clicking while mining the rock, it keeps clicking at about 1 sec intervals.

    2. When my inventory is full, it doesn't go on to my next procedure (dropping the ore), even though I specified to repeat...until(InvFull).

    I was wondering if i could get help for any of these problems

    Simba Code:
    procedure MineRock();
    var
      x, y : Integer;
      Box : TBox;
    begin
      if(not(LoggedIn))then Exit;
      MakeCompass('N');
      Box := IntToBox(MSCX - 10, MSCY - 25, MSCX + 15, MSCY + 15);
      repeat
        if(not(FindNormalRandoms))then
        begin
          if(FindRock(x, y))then
          begin
            Wait(RandomRange(150, 250));
            Mouse(x, y, 2, 2, mouse_Left);
            Wait(RandomRange(100, 300));
            while(Animating(Box, 750, 30))do
            begin
              AntiBan;
              Wait(RandomRange(100, 300));
            end;
          end else
            Exit;
        end;
      until(InvFull);
    end;

  2. #2
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default

    Try using pixelshift or didredclick
    Finished B.S. Program in Radiology!!

    Projects: A big one! Total secret! hehe

  3. #3
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    Quote Originally Posted by 14578 View Post
    Try using pixelshift or didredclick
    He is using pixelshift already. But yeah, an animation difference of 30 pixels in 750 ms is very low. I'm pretty sure that you get a pixelshift of 30 pixels when doing nothing already. So definately increase that amount. To get the right number you can use a code like this
    Simba Code:
    begin
      repeat
        Wait(100 + Random(200));
        WriteLn(''+IntToStr(PixelShift(IntToBox(220, 100, 290, 135), 1000))+'');
      until(PixelShift(IntToBox(220, 100, 290, 135), 1000)<900)
    end;
    This will look for animations in the box 220, 100, 290, 135 for 1000 ms aka 1 second until the pixelshift has passed 900. You can simply replace those numbers with the box you defined. Just keep testing it and look at the numbers it returns so you know what number to put in. Eventually you can replace the loop with a simple repeat, wait, until pixelshift loop.

    Also, for the InvFull part
    Simba Code:
    if GetCurrentTab = not(tab_Inv) then
      FTab(tab_Inv);
    Put that somewhere in your script because it relies on the inventory. If your inventory isn't visible the script can't determine if it's full. You can also use a failsafe by reading the chatbox text.

    The problem with that is that once you dropped all the ores, the chatbox text will still be visible. But you can put something after the repeat until loop like. If FindChatBoxText('full', 8, clBlack) then MarkTime(t).
    Then in your repeat until you can put or TimeFromMark(t)>60000. Then after the repeat until you can put it TimeFromMark(t)>60000 then if FindChatboxtext(blablabla) then t:=0; next procedure.

    Simba Code:
    program Test;
    {$i srl/srl.simba}

    function FindRock:Boolean;
    begin
      WriteLn('Found a rock');
      Result:=True;
    end;

    procedure Antiban;
    begin
      WriteLn('Antiban');
    end;

    procedure MineRock;
    var
      x, y, t : Integer;
      Box : TBox;

    begin
      if not(LoggedIn) then Exit;
      MakeCompass('N');
      MarkTime(t);
      Box := IntToBox(MSCX - 10, MSCY - 25, MSCX + 15, MSCY + 15);
      repeat
        if not(FindNormalRandoms) then
          begin
            if FindRock then
              begin
                Wait(RandomRange(150, 250));
                Mouse(x, y, 2, 2, mouse_Left);
                repeat
                  Wait(50 + Random(100));
                  AntiBan;
                  WriteLn(''+IntToStr(PixelShift(Box, 750))+'');
                until(PixelShift(Box, 750)<900)
                Wait(RandomRange(50, 150));
              end else
                Exit;
          end;
      until(InvFull) or ((TimeFromMark(t)>60000) and (FindChatBoxText('full', 8, clBlack)));
      if TimeFromMark(t)>60000 then
        t:=0;
    end;

    begin
      ActivateClient;
      MineRock;
    end.

    Should compile.
    Last edited by J J; 05-25-2012 at 07:51 AM.

    Script source code available here: Github

  4. #4
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by J J View Post
    He is using pixelshift already. But yeah, an animation difference of 30 pixels in 750 ms is very low. I'm pretty sure that you get a pixelshift of 30 pixels when doing nothing already. So definately increase that amount. To get the right number you can use a code like this
    Simba Code:
    begin
      repeat
        Wait(100 + Random(200));
        WriteLn(''+IntToStr(PixelShift(IntToBox(220, 100, 290, 135), 1000))+'');
      until(PixelShift(IntToBox(220, 100, 290, 135), 1000)<900)
    end;
    This will look for animations in the box 220, 100, 290, 135 for 1000 ms aka 1 second until the pixelshift has passed 900. You can simply replace those numbers with the box you defined. Just keep testing it and look at the numbers it returns so you know what number to put in. Eventually you can replace the loop with a simple repeat, wait, until pixelshift loop.

    Also, for the InvFull part
    Simba Code:
    if GetCurrentTab = not(tab_Inv) then
      FTab(tab_Inv);
    Put that somewhere in your script because it relies on the inventory. If your inventory isn't visible the script can't determine if it's full. You can also use a failsafe by reading the chatbox text.

    The problem with that is that once you dropped all the ores, the chatbox text will still be visible. But you can put something after the repeat until loop like. If FindChatBoxText('full', 8, clBlack) then MarkTime(t).
    Then in your repeat until you can put or TimeFromMark(t)>60000. Then after the repeat until you can put it TimeFromMark(t)>60000 then if FindChatboxtext(blablabla) then t:=0; next procedure.

    Simba Code:
    program Test;
    {$i srl/srl.simba}

    function FindRock:Boolean;
    begin
      WriteLn('Found a rock');
      Result:=True;
    end;

    procedure Antiban;
    begin
      WriteLn('Antiban');
    end;

    procedure MineRock;
    var
      x, y, t : Integer;
      Box : TBox;

    begin
      if not(LoggedIn) then Exit;
      MakeCompass('N');
      MarkTime(t);
      Box := IntToBox(MSCX - 10, MSCY - 25, MSCX + 15, MSCY + 15);
      repeat
        if not(FindNormalRandoms) then
          begin
            if FindRock then
              begin
                Wait(RandomRange(150, 250));
                Mouse(x, y, 2, 2, mouse_Left);
                repeat
                  Wait(50 + Random(100));
                  AntiBan;
                  WriteLn(''+IntToStr(PixelShift(Box, 750))+'');
                until(PixelShift(Box, 750)<900)
                Wait(RandomRange(50, 150));
              end else
                Exit;
          end;
      until(InvFull) or ((TimeFromMark(t)>60000) and (FindChatBoxText('full', 8, clBlack)));
      if TimeFromMark(t)>60000 then
        t:=0;
    end;

    begin
      ActivateClient;
      MineRock;
    end.

    Should compile.
    Thank you for the helpful post +rep.
    Lots of stuff you said doesn't make sense to me yet, but I'll figure it out.

  5. #5
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default

    Ahhh, didn't notice while Animation.
    Finished B.S. Program in Radiology!!

    Projects: A big one! Total secret! hehe

  6. #6
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    Quote Originally Posted by Opus View Post
    Thank you for the helpful post +rep.
    Lots of stuff you said doesn't make sense to me yet, but I'll figure it out.
    FindChatBoxText('full', 8, clBlack)));
    It reads the chatbox and looks for the text 'full' on line 8 of the chatbox, that is the bottom line, with the color Black (clBlack = Color Black)

    TimeFromMark(t)>60000
    if 60.000 milli seconds (60 seconds) have passed since starting a time marker (t) it will do something. It's like a stopwatch.

    t:=0;
    This resets the time t back to zero.

    Script source code available here: Github

  7. #7
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by J J View Post
    FindChatBoxText('full', 8, clBlack)));
    It reads the chatbox and looks for the text 'full' on line 8 of the chatbox, that is the bottom line, with the color Black (clBlack = Color Black)

    TimeFromMark(t)>60000
    if 60.000 milli seconds (60 seconds) have passed since starting a time marker (t) it will do something. It's like a stopwatch.

    t:=0;
    This resets the time t back to zero.
    That makes more sense, thank you

  8. #8
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Now I'm having another issue. There's a popup in my chatbox saying my inv is full, and not writing it on a line. I tried making a DTM to recognize the button when it came up, and then dropping the ore when it was recognized, but that didn't seem to work (I probly just have the order or something messed up)

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
  •