Results 1 to 10 of 10

Thread: My first PowerMiner

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

    Default My first PowerMiner

    When I first came here, I didn't expect I'd be writing scripts but I now realize that leeching is really "asshatty" and so I decided to read some tutorials and try to make my own script.

    Now, I haven't tested the following script because I'm 95% sure that it won't work. I'm also sure that I messed up somewhere in the script and it won't compile correctly. Therefore, I'm accepting ANY help or advice to try to make it better in hopes of me learning to become a better scripter.

    Perhaps I've gone beyond my limitations by making it do up to 6 different rocks (Tin, Copper, Iron, Coal, Mithril, Admantine) but I tried it.

    This is my powerminer. There are no AntiRandoms, no Multiplayer, no AutoLogin, nothing special. The only thing I hope this will do is go up to a rock and mine it. Then when the inventory is full, I hope it will drop all the rocks.

    You will need ScarScape in order to use this which can be found here:
    http://freewebs.com/jk2fakefiles/ScarScape/Run.Html - Credits to JuKKa.

    VERSION 1.0
    Code:
    program KoldPowerMiner;
               
    {                                 Instructions
               1. You MUST use ScarScape for this script to work. Normal
                                RuneScape will NOT work.
                     You may find ScarScape at the following website:
          http://freewebs.com/jk2fakefiles/ScarScape/Run.Html - Credits to JuKKa
                           2. You must have a pickaxe equipped.
                     3. You must be near the rocks you wish to mine.
                       4. You must start with an empty inventory.
                       
                          THIS SCRIPT ONLY WORKS WITH OLD ROCKS!
                           NEW ROCKS DO NOT WORK IN THIS SCRIPT!                   }
    
    
    const
    HowManyLoads = 10; //How many loads (full inventories) you wish your player to mine before the script stops.
    WaitPerRock = 5000; //The time to wait while mining a rock. (1000 = 1 second)
    Version = '1.0'; //This is just for me. This won't affect the mining procedure. Please Don't change it.
    RockToMine = ''; //What rock would you like to mine? Choose from below.
    Tin = 8553100;       //DON'T EDIT!
    Copper = 4153733;    //DON'T EDIT!
    Iron = 2305610;      //DON'T EDIT!
    Coal = 3163461;      //DON'T EDIT!
    Mithril = 5979710;   //DON'T EDIT!
    Admantine = 5992795; //DON'T EDIT!
    
    var
    x,y: Integer;
    
    Procedure MiningRocks;
    begin
      repeat
        if(FindColorTolerance(x, y, RockToMine, 0, 0, 700, 500, 4))then
        begin
          Mouse(x, y, 0, 0, true);
          Wait(WaitPerRock + Random(1000));
        end else
          Writeln('Could not find specified rock.')
        Wait(200 + Random(50));
      until(InvFull)
    end;
    
    Procedure Drop;
    begin
      DropToPosition(1, 28);
      HowManyLoads:=HowManyLoads + 1;
    end;
    
    Procedure Thanks;
    begin
      ClearDebug;
    
        Writeln('Thanks for using KoldPowerMiner V. ' + Version +);
    end.
    VERSION 1.1
    Code:
    {                                  Instructions
               1. You MUST use ScarScape for this script to work. Normal
                                RuneScape will NOT work.
                     You may find ScarScape at the following website:
          http://freewebs.com/jk2fakefiles/ScarScape/Run.Html - Credits to JuKKa
                           2. You must have a pickaxe equipped.
                     3. You must be near the rocks you wish to mine.
                       4. You must start with an empty inventory.
                       
                          THIS SCRIPT ONLY WORKS WITH OLD ROCKS!
                           NEW ROCKS DO NOT WORK IN THIS SCRIPT!                   }
    
    
    const
      HowManyLoads = 10; //How many loads (full inventories) you wish your player to mine before the script stops.
      WaitPerRock = 5000; //The time to wait while mining a rock. (1000 = 1 second)
      Version = '1.0'; //This is just for me. This won't affect the mining procedure. Please Don't change it.
      RockToMine = ''; //What rock would you like to mine? Choose from below.
      Tin = 8553100;       //DON'T EDIT!
      Copper = 4153733;    //DON'T EDIT!
      Iron = 2305610;      //DON'T EDIT!
      Coal = 3163461;      //DON'T EDIT!
      Mithril = 5979710;   //DON'T EDIT!
      Admantine = 5992795; //DON'T EDIT!
    
    var
      x,y: Integer;
      LoadsDone: Integer;
      
    Procedure MiningRocks;
    begin
      repeat
        if(FindColorTolerance(x, y, RockToMine, 0, 0, 700, 500, 4))then
        begin
          Mouse(x, y, 0, 0, true);
          Wait(WaitPerRock + Random(1000));
        end else
          Writeln('Could not find specified rock.')
        Wait(200 + Random(50));
      until(InvFull)
    end;
    
    Procedure Drop;
    begin
      DropToPosition(1, 28);
      LoadsDone:= LoadsDone+ 1;
    end;
    
    begin
    repeat
      MiningRocks;
      Drop;
    until(LoadsDone > LoadsToDo);
    
    Procedure Thanks;
    begin
      ClearDebug;
        Writeln('Thanks for using KoldPowerMiner V. ' + Version +);
    end;
    
    begin
      Thanks;
    end.
    Once again, thanks for any help. It's greatly appreciated and necessary.

  2. #2
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Good work for a first try

    The first thing you need to understand is that a script isn't just made from procedures; they are the building blocks of the script, but you need a "Main Line" to put them together.

    For your script, a very simple, basic example would be:

    SCAR Code:
    begin
    repeat
      MiningRocks;
      Drop;
    until(false);

    However, this could be improved by using the HowManyLoads constant. You can implement this by adding this to your variable declarations:

    SCAR Code:
    var
      x,y: Integer;
      LoadsDone : integer;

    And in your drop procedure:

    SCAR Code:
    Procedure Drop;
    begin
      DropToPosition(1, 28);
      LoadsDone:= LoadsDone+ 1;
    end;
    Using the constant would have been wrong because that would simply add to the 10 or whatever value they set. Anyway, having set this, in your "Main Line" you can use this:

    SCAR Code:
    begin
    repeat
      MiningRocks;
      Drop;
    until(LoadsDone > LoadsToDo);

    Keep these things in mind, and keep working at this script. Congratulations on your first effort, keep it up

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

    Default

    Those are some awesome points there! Thanks. I'll implement it in the next version.

    Really... Thanks.

    EDIT:

    New version is up.

    Is that what you meant, Agent83?

    Also, I'm fully aware that this isn't a script to use. It doesn't have AntiRandoms or anything. But could you tell me if this script will get me banned instantly or if it's actually a little ban-proof ie. mouse movements, exc.

    Lastly, I'm getting the following error when trying to compile.

    Line 52: [Error] (52:60): Type mismatch in script C:\Users\Oliver\Desktop\Kold PowerMiner V.1.1.scar

    Could anybody help me fix it? I have no idea what's wrong.

  4. #4
    Join Date
    Nov 2007
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I ran for 15 mins, pretty good. With antirandoms you would have a l33t script here man.

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

    Default

    John, shut up, you've been spamming all day and now lying too, the script doesn't compile.

  6. #6
    Join Date
    Dec 2007
    Location
    Vancouver
    Posts
    60
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well could you possibly help me fix the non-compilation? I have no idea what's wrong with it.

  7. #7
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    OK, I'll edit stuff in in a minute

    EDIT1: Your main line was in the wrong place. Fixed that.
    And also, the problem is on this line:

    if(FindColorTolerance(x, y, RockToMine, 0, 0, 700, 500, 4))then

    You defined RockToMine as a string constant, it has to be a number. Wait while I find a workaround.

    EDIT2: Just noticed another thing. At the beginning of your script, you always need to have
    SCAR Code:
    Program Name;
    //If you want to use SRL you have to put
    {.include SRL/SRL.scar}

    //then at the beginning of the main line you also have to put

    begin
      SetUpSRL;
      Script here;
    end.

    OK, last edit for now. I made a little function to get the right colour, I'm sure there's a better way but I can't seem to think of anything else right now. There was also a tiny problem in the writeln() in Thanks, I deleted the erroneous trailing + sign.

    SCAR Code:
    program New;
    {.include SRL/SRL.scar}
    {                                  Instructions
               1. You MUST use ScarScape for this script to work. Normal
                                RuneScape will NOT work.
                     You may find ScarScape at the following website:
          [url]http://freewebs.com/jk2fakefiles/ScarScape/Run.Html[/url] - Credits to JuKKa
                           2. You must have a pickaxe equipped.
                     3. You must be near the rocks you wish to mine.
                       4. You must start with an empty inventory.

                          THIS SCRIPT ONLY WORKS WITH OLD ROCKS!
                           NEW ROCKS DO NOT WORK IN THIS SCRIPT!                   }



    const
      HowManyLoads = 10; //How many loads (full inventories) you wish your player to mine before the script stops.
      WaitPerRock = 5000; //The time to wait while mining a rock. (1000 = 1 second)
      Version = '1.1'; //This is just for me. This won't affect the mining procedure. Please Don't change it.
      RockToMine = 'Tin'; //What rock would you like to mine? Choose from below.

    var
      x,y: Integer;
      LoadsDone: Integer;

    function PickRockColour(Colour : string) : integer;
    begin
      case Colour of
        'Tin' : Result := 8553100;
        'Copper' : Result := 4153733;
        'Iron' : Result := 2305610;
        'Coal' : Result := 3163461;
        'Mithril' : Result := 5979710;
        'Admantine' : Result := 5992795;
      end;
    end;

    Procedure MiningRocks;
    begin
      repeat
        if(FindColorTolerance(x, y, PickRockColour(RockToMine), 0, 0, 700, 500, 4))then
        begin
          Mouse(x, y, 0, 0, true);
          Wait(WaitPerRock + Random(1000));
        end else
          Writeln('Could not find specified rock.')
        Wait(200 + Random(50));
      until(InvFull)
    end;

    Procedure Drop;
    begin
      DropToPosition(1, 28);
      LoadsDone:= LoadsDone+ 1;
    end;

    Procedure Thanks;
    begin
      ClearDebug;
        Writeln('Thanks for using KoldPowerMiner V. ' + Version);
    end;

    begin
    repeat
      MiningRocks;
      Drop;
    until(LoadsDone > HowManyLoads);
    Thanks;
    end.

  8. #8
    Join Date
    Dec 2007
    Location
    Vancouver
    Posts
    60
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wow, um... Thanks a lot, Agent.

    I just have one question about the resulting script. Everything else makes complete sense to me but I don't understand what the

    "case Color of"

    part is about. Could you somehow explain that to me? I've never seen that used before.

  9. #9
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hm, I'll try to explain as best I can, but I find it's best to just play around with it to learn.

    The basic unit is
    SCAR Code:
    case ... of
    ...
    end;

    Between case and of goes your selector, in this case, the selector was the input variable for the function (Colour, which in this case was a string).

    Between the case declaration and the end, you have to put in stuff to do, paired with identifiers, for example:

    SCAR Code:
    'Tin' : Result := 8553100;

    'Tin' is the identifier, and the instructions (Result:=) go after the colon. So basically, the script matches the value of the selector (Color) with an identifier within the case ('Tin'). It carries out the instructions depending on this.

    If I wasn't clear, I think there are some good tuts around about cases.

  10. #10
    Join Date
    Dec 2007
    Location
    Vancouver
    Posts
    60
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah I still don't really understand. I'll look around.

    However, I believe yours was one of the tuts I read back when I was a total noob at scripting so I have you to thank for a bunch of this anyways.

    Also. The script now compiles but it doesn't work. So I'm at a loss. I gave it my best. As I said, I may have started too big for my capabilities. I may have to start smaller first.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. powerminer
    By tpm1164 in forum First Scripts
    Replies: 5
    Last Post: 07-15-2007, 12:41 AM
  2. My Powerminer v. 3.00
    By GoF in forum RS3 Outdated / Broken Scripts
    Replies: 17
    Last Post: 01-22-2007, 02:08 AM
  3. Need Help On My First PowerMiner
    By Buckleyindahouse in forum OSR Help
    Replies: 3
    Last Post: 12-23-2006, 06:08 PM
  4. powerminer
    By shadowblade in forum OSR Help
    Replies: 20
    Last Post: 12-15-2006, 12:34 AM
  5. my powerminer
    By shadowblade in forum OSR Help
    Replies: 3
    Last Post: 12-09-2006, 03:04 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
  •