Results 1 to 16 of 16

Thread: My first script, power miner, please post improvements

  1. #1
    Join Date
    Jun 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default My first script, power miner, please post improvements

    Ok its my first script, you have to set up the colours of the rock to mine, the tolerance and how many loads.

    I spent quite a while making the antiban and all that stuff, so the actual mining part is a bit rushed. It doesnt have a progress report yet. The anti randoms arent tested, and the gas detection and pick head finder may not work either, so please test it and dont blame me if anything goes wrong.

    Please post improvements

    Feel free to edit it or use parts of it in your own scripts just please gimme credit.

    It works with Scar 2.03 and SRL 3.6 , not sure if it works with anything else.
    V 1.1 ---Ok added a small progress report, and changed it so it definately wont pick up ores. Also It has mangaged to solve old man random three times.
    V 1.2 ---Made the antirandom better but its still not tested, added more failssafes, and I finally managed to figure out how to make it only mine when its finished mining the last ore thanks to pwntby ownt for help with that
    SCAR Code:
    {My first script
    Credits to
    JAD for his amazing tutorials
    WT-Fakawi for his also amazing anti random
    Pwnt by Pwnt for helping with orefinding and only mining when neccessary
    Anyone else who posted on the thread in a useful way
    And of course kaitnieks the creator of scar and the SRL manual
    edit lines 17-20 to set script up
    The anti random/gas/pick head finder isn't tested
    Please post improvements on forums
    Feel free to edit anythin in this, or use anything but gimme credit please}

    program PowerMiner;
    {.include SRL\SRL.Scar}
    {.include SRL\SRL/skill/Mining.scar}
    var
      loadsdone, k, l,ttlloads,progreps,mine,InvNo1,InvNo2,minedtimes2: integer;

    const
      loadswanted = 5; //how many loads per player
      minecolor = 5541861; //color of rock to mine
      tol = 5; //what tolerance to use
      minedtimes = 50; //how many times for it to try to mine unsuccesfully
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 8;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '-------';
      Players[0].Pass := '-------';
      Players[0].Nick := '-------';
      Players[0].Active := True;


      Players[1].Name := '-------';
      Players[1].Pass := '-------';
      Players[1].Nick := '-------';
      Players[1].Active := false;

      Players[2].Name := '-------';
      Players[2].Pass := '-------';
      Players[2].Nick := '-------';
      Players[2].Active := True;

      Players[3].Name := '-------';
      Players[3].Pass := '-------';
      Players[3].Nick := '-------';
      Players[3].Active := True;

      Players[4].Name := '-------';
      Players[4].Pass := '-------';
      Players[4].Nick := '-------';
      Players[4].Active := True;

      Players[5].Name := '-------';
      Players[5].Pass := '-------';
      Players[5].Nick := '-------';
      Players[5].Active := True;

      Players[6].Name := '-------';
      Players[6].Pass := '-------';
      Players[6].Nick := '-------';
      Players[6].Active := True;

      Players[7].Name := '-------';
      Players[7].Pass := '-------';
      Players[7].Nick := '-------';
      Players[7].Active := True;


      NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
    end;

    procedure switchplayer;
    begin
      if (Loadsdone = Loadswanted) then
      begin
        NextPlayer(True);
        Loadsdone := 0; //change this variable
        HighestAngle;
        MakeCompass('N');
        Writeln('Players have been switched');
      end;
    end;

    function FindFastRandoms: Boolean; //By WT-Fakawi.
    var
      i: Integer;
    begin
      for i := 1 to 9 do
      begin
        case I of
          1: if FindDead then
              Result := True;
          2: if FindMod then
              Result := True;
          3: if FindMime then
              Result := True;
          4: if FindMaze then
              Result := True;
          5: if FindQuiz then
              Result := True;
          6: if FindDemon then
              Result := True;
          7: begin
              if NoGameTab then
              begin
                Result := True;
                Players[CurrentPlayer].loc := 'No GameTab';
                Logout;
                Exit;
              end;
            end;
          8: begin
              if InBlack then
              begin
                Result := True;
                Players[CurrentPlayer].loc := 'InBlack';
                Logout;
                Exit;
              end;
            end;
          9: RC;
        end;
        wait(1);
      end;
    end;

    ///////////////////////////////////////////////////////////////////////////

    procedure FindRandoms;
    begin
      FindFastRandoms;
      FindNormalRandoms;
      FindPick;
      if (FindFight = true) then
            begin
             RunAwayDirection('N');
             Wait(10000 + random(2000));
             RunBack;
            end;

    end;

    procedure Makemereal;
    begin
      if (not (LoggedIn)) then
        Exit;
      case Random(14) of
        0: Antiban;

        1: RandomRClickEvery(5 + random(5));

        2: LeaveScreenEvery(16 + random(5));

        3: PickupMouseEvery(10 + random(3));

        4: BoredEvery(3 + random(3));

        5: begin
            case Random(18) of
              0: begin
                  HoverSkill('attack', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              1: begin
                  HoverSkill('strength', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              2: begin
                  HoverSkill('Defence', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              3: begin
                  HoverSkill('Range', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              4: begin
                  HoverSkill('Prayer', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              5: begin
                  HoverSkill('Mage', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              6: begin
                  HoverSkill('RuneCrafting', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              7: begin
                  HoverSkill('HP', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              8: begin
                  HoverSkill('Crafting', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              9: begin
                  HoverSkill('Mining', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              10: begin
                  HoverSkill('Smithing', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              11: begin
                  HoverSkill('Cooking', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              12: begin
                  HoverSkill('Fishing', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              13: begin
                  HoverSkill('Firemaking', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              14: begin
                  HoverSkill('Woodcutting', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              15: begin
                  HoverSkill('Slayer', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              16: begin
                  HoverSkill('Mining', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              17: begin
                  HoverSkill('Mining', false);
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
            end;
          end;

        6: RotateEvery(3 + random(3));

        7: MouseBox(0, 0, 765, 500, 3);

        8: MouseBox(MSX1, MSY1, MSX2, MSY2, 3);

        9: MouseBox(MIX1, MIY1, MIX2, MIY2, 3);

        10: SleepAndMoveMouse(5000 + random(5000));

        11: begin
            GameTab(1);
            wait(2000 + random(1000));
            SetFightMode(random(4));
          end;

        12: begin
            case random(10) of
              0: begin
                  TypeSend('Mining lvls');
                  wait(5000 + random(1000));
                  Gametab(2);
                  SayCurrentLevels('mining');
                  wait(1000 + random(1000));
                  GameTab(4);
                end;
              1: TypeSend('Booooringgg');
              2: TypeSend('Gotta love mining');
              3: TypeSend('I got 99 mining');
              4: TypeSend('Why cant mining be more fun');
              5: TypeSend('If your happy and you know it clap your hands');
              6: TypeSend('Someone think of something more fun to do');
              7: TypeSend('whats everyones highest lvl?');
              8: TypeSend('My fave skill is smithing but i need ores');
              9: TypeSend('how much are rune picks worth?');
            end;
          end;

        13: begin
            HighestAngle;
            MakeCompass('N');
            wait(100 + random(100));
            LowestAngle
              MakeCompass('E');
            wait(100 + random(100));
            HighestAngle;
            MakeCompass('S');
            wait(100 + random(100));
            LowestAngle;
            MakeCompass('W');
            wait(100 + random(100));
            HighestAngle;
            MakeCompass('N');
            wait(1000 + random(500));
          end;

        14: RandomChatEvery(14 + Random(4));
      end;
    end;

    procedure Mining;
    begin
      if FindObj(k,l,'Rocks',minecolor,tol)
        then begin
        minedtimes2 :=0;
        InvNo1 := 0;
        InvNo2 := 0;
        InvNo1 := InvCount;
        FindGas(k,l);
        FindPick;
        Mouse(k, l, 0, 0, true);
        wait(100 + random(100));
        mine := mine + 1;
        FindRandoms;
        InvNo2 := InvCount;
      end;
      if (InvNo2=InvNo1)
         then begin
         repeat
         minedtimes2 := minedtimes2 + 1;
          if  (minedtimes2 = 60)
             then begin
                   repeat
                   Mining;
                   until (mine = minedtimes);
                  end;
         FindRandoms;
         FindGas(k,l);
         FindPick;
         InvNo2 := 0;
         InvNo2 := InvCount;
         wait (100+random(100));
         until (InvNo2=(InvNo1+1)) ;
              end;
      if (InvFull)
        then begin
            mine := 0;
        DropAll;
        Loadsdone := Loadsdone + 1;
        TtlLoads := TtlLoads + 1;
        FindRandoms;
      end;
     if (mine = minedtimes)
        then begin
        Writeln('somethings not right')
        NextPlayer(False);
        Loadsdone := 0;
        HighestAngle;
        MakeCompass('N');
        Writeln('Players have been switched');
      end;
    end;

    procedure login;
    begin
      if (not (loggedin))
        then begin
        writeln('logging in');
        Loginplayer;
        HighestAngle;
        wait(1000 + random(5000))
          FindPickHeadColor
          wait(1000 + random(1000))
      end;
    end;
    procedure proggy;
    begin
    if (TtlLoads>progreps)
     then begin
    ClearDebug;
    Writeln('----------------------------------------');
    Writeln('--------NGHT SPUD`s Power Miner!--------');
    Writeln('----------------------------------------');
    Writeln('Total Time Running: ' + TimeRunning);
    Writeln('Total Loads: ' + inttostr(TtlLoads));
    SRLRandomsReport;
    progreps := progreps + 1;
          end;
    end;
    begin

      ClearDebug;
      ActivateClient;
      SetUpSRL;
      SetupSRLMining
      DeclarePlayers;
      Equippick := false;
      repeat
        switchplayer;
        login;
        FindRandoms;
        case Random(4) of
          0: wait(1);
          1: Makemereal;
          2: wait(1);
          3: wait(1);
        end;
        Mining;
        proggy;
      until (false);

    end.

    Thanks for your comments

  2. #2
    Join Date
    May 2007
    Location
    Canada eh :p
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    looks not to bad, i really like your anti ban you obiously worked hard on that.

  3. #3
    Join Date
    Jun 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Yer anti Ban took the longest time to make, but wasnt too hard after learning how everything works.

  4. #4
    Join Date
    Apr 2007
    Location
    California
    Posts
    259
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If i'm not mistaken (and this is just from looking at it) the method you use to find the rock only checks the color, not the name. Meaning that it would also pick up dropped iron ores, because they have the same color. Try researching the different kinds of FindObj and see which you like best. You can find them in SRL/core/object.scar

    Edit: Also, it doesn't seem liked the integer "mined" is used anywhere. You declare it as 0 at one point, and then declare it as 1 at another, but it doesn't seem to do anything. Unless i missed where you use it.

  5. #5
    Join Date
    Jun 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Ok I changed some things, but can anyone give me and idea about how to make it know when it has mined an ore.

    Edit: Figured out how to make it know when it has mined an ore, so just post improvements please

  6. #6
    Join Date
    Feb 2007
    Posts
    433
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hmmmmmm it looks pretty good, and like i havent tested it yet but as NewToAutoing said, you should put in there something like
    SCAR Code:
    const
    TreeColor = 622696;//Set the color of the tree
    TypeOfTree = 'Tree';//What Kind Of Tree To Chop
    TimeToWait = 5000;//Time Before Clicking Next Tree
    StartPlayer = 0;
    NumberOfUsers = 6;
    LoadsPerPerson = 15;//How many loads for each player?
    this is out of my powercutter3 but u should change it to mined and type of ore and stuff, and something like this below for the mining procedure
    SCAR Code:
    //-----=-----=-----=-----=Tree Finding=-----=-----=-----=-----\\
    procedure FindTheTree;
    begin
    If(FindColorSpiral(x,y,TreeColor,MSX1,MSY1,MSX2,MSY2))then
      begin
       Writeln('Found Tree');
      end;
    end;

    //-----=-----=-----=-----=Tree Cutting=-----=-----=-----=-----\\
    procedure CutTheTree;
    var
      WaitMark:Integer;
      TheMarkTime:Integer;
    begin
    MarkTime(WaitMark)
    repeat
    TheMarkTime:=TimeFromMark(WaitMark)
    Writeln(inttostr(TheMarkTime))
    Wait(50+random(51))
    Cleardebug;
    until(TheMarkTime>=TimeToWait)

    begin
    repeat
    MMouse(x,y,0,0)
      Until IsUpTextMulti('Cho','dow',TypeOfTree);
      If IsUpTextMulti('Cho','dow',TypeOfTree) then
      begin
        GetMousePos(x,y);
        Mouse(x,y,0,0,false);
        wait(1000+random(100));
        ChooseOption(x,y,''+TypeOfTree+'');
        wait(100+random(10));
        DoAntiRandoms;
       If(IsFKeyDown(12))then terminatescript;
      end;
     end;
      If not (FindColorSpiral(x,y,TreeColor,MSX1,MSY1,MSX2,MSY2)) then
      begin
       HighestAngle;
       PerfectNorth;
     end;
    end;

  7. #7
    Join Date
    Jun 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I have added something so it only clicks on the rocks, but unlike trees, rocks are called rocks no matter what type of ore your mining.

    Code:
     if FindObj(k,l,'Rocks',minecolor,tol)
    atleast i think thats what that does.

  8. #8
    Join Date
    Feb 2007
    Posts
    433
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    lol thats funny where u said, "I finally managed to figure out how to make it only mine when its finished mining the last ore" cuz i helped u with it lol idc but some cred would be nice lol

  9. #9
    Join Date
    Jun 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Oh kk sry I forgot

  10. #10
    Join Date
    Apr 2007
    Location
    California
    Posts
    259
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by nght spud View Post
    I have added something so it only clicks on the rocks, but unlike trees, rocks are called rocks no matter what type of ore your mining.

    Code:
     if FindObj(k,l,'Rocks',minecolor,tol)
    atleast i think thats what that does.
    Yes, that should do it. Normally I use FindObj3(x,y,'ine',RockColor,tol) FindObj3 i chose myself because according to its description it searches from center of screen out, but theres other kinds too. As for 'ine' i don't remember why i chose that, but if i chose 'Rocks' i would have used 'ocks' because i believe capitals can mess it up sometimes, or at least i think i read that somewhere.

  11. #11
    Join Date
    May 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lolz all this looks very complicated =/

  12. #12
    Join Date
    Feb 2007
    Posts
    433
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Azle i can see your new but if you want help learning how to script i would be glad to help you ;-)

  13. #13
    Join Date
    Apr 2007
    Location
    Finland
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    There's the same mistake in the FindFastRandoms as it is in many other scripts

    SCAR Code:
    function FindFastRandoms: Boolean; //By WT-Fakawi.
    var
      i: Integer;
    begin
      for i := 1 to 8 do
      begin
        case I of
          1: if FindDead then
              Result := True;
          2: if FindMod then
              Result := True;
          3: if FindMime then
              Result := True;
          4: if FindMaze then
              Result := True;
          5: if FindQuiz then
              Result := True;
          6: if FindDemon then
              Result := True;
          7: begin                              /// 7 Look below
              if NoGameTab then
              begin
                Result := True;
                Players[CurrentPlayer].loc := 'No GameTab';
                Logout;
                Exit;
              end;
            end;
          7: begin                              /// HERE'S 7 TOO!!!
              if InBlack then
              begin
                Result := True;
                Players[CurrentPlayer].loc := 'InBlack';
                Logout;
                Exit;
              end;
            end;
          8: RC;
        end;
        wait(1);
      end;
    end;

  14. #14
    Join Date
    Jun 2006
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Ah lol, i copied that from here in a tut, may be why its in lots of scripts.

  15. #15
    Join Date
    Nov 2007
    Posts
    73
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    It says duplicate identifier 'mine' in line 14

  16. #16
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by rs cheata View Post
    It says duplicate identifier 'mine' in line 14
    05-18-2007, 11:43 AM

    Please do not gravedig/bump old topics.
    It is not a good thing to do.


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. My First Script - Power Miner
    By shadowrec0n in forum First Scripts
    Replies: 21
    Last Post: 07-05-2008, 11:49 AM
  2. Power Miner first script
    By dallas574 in forum First Scripts
    Replies: 4
    Last Post: 05-04-2008, 07:53 PM
  3. corl45's Power miner (2nd script)
    By corl455 in forum First Scripts
    Replies: 31
    Last Post: 01-05-2008, 07:08 AM
  4. The Lords Power Miner (h) First Script (h)
    By The Lord Ahmed in forum RS3 Outdated / Broken Scripts
    Replies: 5
    Last Post: 07-15-2007, 10:40 PM
  5. JADMiner (power miner) my first script!
    By JAD in forum RS3 Outdated / Broken Scripts
    Replies: 17
    Last Post: 04-08-2007, 11:16 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
  •