Results 1 to 17 of 17

Thread: A means to an end.

  1. #1
    Join Date
    Jan 2007
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default A means to an end.

    Well, I've taken it upon myself to learn some SCAR (go figure) so I decided to write myself a little powermining script to start things off. The script is below:

    SCAR Code:
    {BT's wonderfully simple first script.

    A Small Warning: Using this at this stage in development will certainly be grounds for a ban. :)

    As I develop this a little further, you might have a better shot at sticking
    it to Fagex.}


    program BTminer;
    {.include SRL/SRL.scar}
    {.include SRL/SRL/skill/Mining.scar}

    const
      Color1 = 7754064;//A color from the rock you want mine.
      Color2 = 7490893;//Another color from the rock.
      Color3 = 7688015;//Yet another color on the rock.
      Loads = 1;//Loads to mine?
      MineTime = 5000;//Average time to mine an ore?
      OreType = 'mith';//Type of ore you're mining?
                     //(iron, copper, tin, gold, mith, addy, rune)

    var
      x,y,ores,xp,perore,loadsleft :integer;

    procedure OreXp;//Specificies the xp per ore for the proggy.
    begin
      case(OreType)of
      'iron': perore:= 35;
      'copper': perore:= 17;
      'tin': perore:= 17;
      'gold': perore:= 65;
      'mith': perore:= 80;
      'addy': perore:= 95;
      'rune': perore:= 125;
        else
        exit;
      end;
    end;

    procedure SendProggy; //Blatantly simple progress report.
    begin
    xp := ores * perore;
    Writeln('/----------------------------\');
    Writeln('   BTs No-Frills Proggy!      ');
    Writeln('       Ore Type:' + OreType);
    Writeln('       Ores Mined: ' + inttostr(ores));
    Writeln('       Xp Gained: ' + inttostr(xp));
    Writeln('\----------------------------/');
    end;

    procedure MineOre;
    begin
    if not(loggedin) then Exit;
    MakeCompass('N');
    repeat
      if(FindObjCustom(x,y,['ine'],[Color1,Color2,Color3],7)) then
      MMouse(x,y,4,4);
        repeat
          Wait(100 + Random(100));
          Mouse(x,y,0,0,true);
          Wait(MineTime + Random(500));
        until(IsBlackText('anage',8) = true);
    until(InvFull);
    end;

    procedure DropOre;
      var x:integer;
    begin
    if not(InvFull) then Exit;
    x := 2;
    repeat
    DropItem(x);
    x := x+1;
    until(x = 29);
    loadsleft := loadsleft - 1;
    SendProggy;
    end;

    procedure SetupScript;
    begin
    ClearDebug;
    SetupSRL;
    SetupMining;
    loadsleft := Loads;
    end;

    begin
    SetupScript;
    OreXp;
    ActivateClient;
    Repeat
      MineOre;
      DropOre;
    Until(loadsleft = 0);
    end.

    Now, it works. Sorta. And that is a big "Sorta". Why, sure it mines, however, if you don't quite make it to the rock, it'll stash those coords and just walk off into the sunset while clicking on the X,Y cords it stored for the rock. You see, its on the wrong place on the screen, etc.

    As you can see, I have made a good faith effort to integrate some SRL elements into the script, but as I said earlier, this is barely equatable to a first script. Once I get my "Scripting Legs" I'll crank out something a little more worthwhile for you all to drool at.

    Anyway, I could use some constructive criticism. Please none of these:

    -LAWL N0oB.
    -That script sux0rs.

    Please, do include some of these:

    -Well, you could save yourself some time by: etc.
    -This feature would be nice:

    Thanks everyone, I hope I entertained you a bit. Now go look at the script damnit!

  2. #2
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure MineOre;
    begin
    if not(loggedin) then Exit;
    MakeCompass('N');
    repeat
      if(FindObjCustom(x,y,['ine'],[Color1,Color2,Color3],7)) then
      MMouse(x,y,4,4);
        repeat
      Flag;      
      Wait(100 + Random(100));
          Mouse(x,y,0,0,true);
          Wait(MineTime + Random(500));
        until(IsBlackText('anage',8) = true);
    until(InvFull);
    end;

  3. #3
    Join Date
    Jan 2007
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by TheVoiceInYourHead View Post
    SCAR Code:
    procedure MineOre;
    begin
    if not(loggedin) then Exit;
    MakeCompass('N');
    repeat
      if(FindObjCustom(x,y,['ine'],[Color1,Color2,Color3],7)) then
      MMouse(x,y,4,4);
        repeat
      Flag;      
      Wait(100 + Random(100));
          Mouse(x,y,0,0,true);
          Wait(MineTime + Random(500));
        until(IsBlackText('anage',8) = true);
    until(InvFull);
    end;
    Alright, now what'll that do for me?

  4. #4
    Join Date
    Mar 2008
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure MineOre;
    begin
    if not(loggedin) then Exit;
    MakeCompass('N');
    repeat
      if(FindObjCustom(x,y,['ine'],[Color1,Color2,Color3],7)) then
      MMouse(x,y,4,4);
        repeat
          Wait(100 + Random(100));
          Mouse(x,y,0,0,true);
          Wait(MineTime + Random(500));
        until(IsBlackText('anage',8) = true);
    until(InvFull);
    end;

    For stuff like this, do

    SCAR Code:
    procedure MineOre;
    begin
    if not(loggedin) then Exit;
    MakeCompass('N');
    repeat
      if(FindObjCustom(x,y,['ine'],[Color1,Color2,Color3],7)) then
      repeat
        MMouse(x,y,4,4);
        Wait(100 + Random(100));
        if isuptext('whatever') then
        begin
          Mouse(x,y,0,0,true);
          Wait(MineTime + Random(500));
        end;
      until(IsBlackText('anage',8) = true);
    until(InvFull);
    end;

    That kinda thing , didnt really look farther than that, but i hope it gives you some ideas

  5. #5
    Join Date
    Jan 2007
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by sirlaughsalot View Post
    SCAR Code:
    procedure MineOre;
    begin
    if not(loggedin) then Exit;
    MakeCompass('N');
    repeat
      if(FindObjCustom(x,y,['ine'],[Color1,Color2,Color3],7)) then
      MMouse(x,y,4,4);
        repeat
          Wait(100 + Random(100));
          Mouse(x,y,0,0,true);
          Wait(MineTime + Random(500));
        until(IsBlackText('anage',8) = true);
    until(InvFull);
    end;

    For stuff like this, do

    SCAR Code:
    procedure MineOre;
    begin
    if not(loggedin) then Exit;
    MakeCompass('N');
    repeat
      if(FindObjCustom(x,y,['ine'],[Color1,Color2,Color3],7)) then
      repeat
        MMouse(x,y,4,4);
        Wait(100 + Random(100));
        if isuptext('whatever') then
        begin
          Mouse(x,y,0,0,true);
          Wait(MineTime + Random(500));
        end;
      until(IsBlackText('anage',8) = true);
    until(InvFull);
    end;

    That kinda thing , didnt really look farther than that, but i hope it gives you some ideas
    Oh wow. Yea, thanks. There's the whole "gate" I was looking for. Geez that works nicely.

  6. #6
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Add a Flag; after MMouse(x,y,4,4);

  7. #7
    Join Date
    Mar 2008
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I looked a bit further, in the DropOre Procedure, have it click by DTM rather than what we like to call "blind" clicking, if you need a tutorial of what a DTM is and how to use one, either use the "search" function on these forums or i can post a link.

    Add some "AntiBan" as-in, what to do while mining. Read up on loops as well

  8. #8
    Join Date
    Jan 2007
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by sirlaughsalot View Post
    I looked a bit further, in the DropOre Procedure, have it click by DTM rather than what we like to call "blind" clicking, if you need a tutorial of what a DTM is and how to use one, either use the "search" function on these forums or i can post a link.

    Add some "AntiBan" as-in, what to do while mining. Read up on loops as well
    All good things to add. Like I said, I'm well aware this is primitive stuff. Thanks for all the input.

    Also, if there is some way to check the rock before I start clicking, like to make sure that the color is actually, actually there. So that you don't go off clicking the rock while there's no ore on the rock.

    Any ideas?

  9. #9
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    if IsUpText('Rock') then
    Mouse(x, y, 0, 0, True);

    Or you could have it right click and check for ChooseOption('Mine');

  10. #10
    Join Date
    Jan 2007
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright, thanks to you fine folks I now have a working powerminer. It's actually not to shabby either.

    SCAR Code:
    {BTMiner v0.1

    The script will now mine properly(yay!). In addition, there will be Anti-Ban soon}


    program BTminer;
    {.include SRL/SRL.scar}
    {.include SRL/SRL/skill/Mining.scar}

    const
      RockColor = 2173767;//A color from the rock you want mine.
      RockColor2 = 2766939;//Another color from the rock.
      Loads = 2;//Loads to mine?
      MineTime = 5000;//Average time to mine an ore?
      OreType = 'iron';//Type of ore you're mining?
                     //(iron, copper, tin, gold, mith, addy, rune)
    var
      x,y,ores,xp,perore,loadsleft :integer;

    procedure OreXp;//Specificies the xp per ore for the proggy.
    begin
      case(OreType)of
      'iron': perore:= 35;
      'copper': perore:= 17;
      'tin': perore:= 17;
      'gold': perore:= 65;
      'mith': perore:= 80;
      'addy': perore:= 95;
      'rune': perore:= 125;
        else
        exit;
      end;
    end;

    procedure SendProggy; //Blatantly simple progress report.
    begin
    xp := ores * perore;
    Writeln('/----------------------------\');
    Writeln('   BTs No-Frills Proggy!      ');
    Writeln('       Ore Type:' + OreType);
    Writeln('       Ores Mined: ' + inttostr(ores));
    Writeln('       Xp Gained: ' + inttostr(xp));
    Writeln('\----------------------------/');
    end;

    function CheckRock:Boolean;
    begin
    If (IsBlackText('vailable',8)) then
    Result := False else
    Result := True;
    end;

    procedure MineOre;
    begin
    if not(loggedin) then Exit;
    MakeCompass('N');
    repeat
      if (FindObjCustom(x,y,['ine'],[RockColor,RockColor2],7)) then
        MMouse(x,y,4,4);
        Flag;
        Wait(100 + Random(100));
        if IsUpText('ine') then
        begin
          Mouse(x,y,0,0,true);
            if
            CheckRock = False then
            Break;
          repeat
          Wait(MineTime + Random(500));
          until IsBlackText('anage',8) = True;
        Ores := Ores + 1;
        end;
    until(InvFull);
    end;


    procedure DropOre;
      var x:integer;
    begin
    if not(InvFull) then Exit;
    x := 2;
    repeat
    DropItem(x);
    x := x+1;
    until(x = 29);
    loadsleft := loadsleft - 1;
    SendProggy;
    end;

    procedure SetupScript;
    begin
    ClearDebug;
    SetupSRL;
    SetupMining;
    loadsleft := Loads;
    Ores := 0;
    end;

    begin
    SetupScript;
    OreXp;
    ActivateClient;
    Repeat
      MineOre;
      DropOre;
    Until(loadsleft = 0);
    end.

    Next on the plate:
    -AntiBan
    -AntiRandoms
    -More witty humor

  11. #11
    Join Date
    Nov 2007
    Location
    Nowhereville
    Posts
    1,155
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Hey nice beginners script. Work on standards. Here's a thing you can do to make this cooler.

    SCAR Code:
    case Random(2) of
      0: Mouse(x, y, 0, 0, true);
      1: begin
            Mouse(x, y, 0, 0, false);
            Wait(60+random(20));
            ChooseOption('ine');
          end;
    end;

    This can randomize which type of mouse click you use to select mine

    Just keep learning!

    Cut em2 it
    Formerly known as Cut em2 it

  12. #12
    Join Date
    Jan 2007
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright, one last thing and I might have a really nice script on my hands:
    [Runtime Error] : Out Of Range in line 1087 in script C:\Program Files\SCAR 3.15\includes\SRL/SRL/Core/AntiRandoms/AntiRandoms.scar

    Ouch. I think it has to do with the BoredHuman;

  13. #13
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    >.< I meant add the Flag; right after you clicked with the mouse.

  14. #14
    Join Date
    Jan 2007
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by TheVoiceInYourHead View Post
    >.< I meant add the Flag; right after you clicked with the mouse.
    Yep, fixed it up. Thanks for noticing. Any idea about the out of range?

    Oh and @ Cut Em2: I fixed those standards up just for you

  15. #15
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    {BTMiner v0.1

    The script will now mine properly(yay!). In addition, there will be Anti-Ban soon}


    program BTminer;
    {.include SRL/SRL.scar}
    {.include SRL/SRL/skill/Mining.scar}

    const
      RockColor = 2173767;//A color from the rock you want mine.
      RockColor2 = 2766939;//Another color from the rock.
      Loads = 2;//Loads to mine?
      MineTime = 5000;//Average time to mine an ore?
      OreType = 'iron';//Type of ore you're mining?
                     //(iron, copper, tin, gold, mith, addy, rune)
    var
      x,y,ores,xp,perore,loadsleft :integer;

    procedure OreXp;//Specificies the xp per ore for the proggy.
    begin
      case LowerCase(OreType)of
        'iron': perore:= 35;
        'copper': perore:= 17;
        'tin': perore:= 17;
        'gold': perore:= 65;
        'mith': perore:= 80;
        'addy': perore:= 95;
        'rune': perore:= 125;
      end;
    end;

    procedure SendProggy; //Blatantly simple progress report.
    begin
      xp := ores * perore;
      Writeln('/----------------------------\');
      Writeln('   BTs No-Frills Proggy!      ');
      Writeln('       Ore Type:' + OreType);
      Writeln('       Ores Mined: ' + inttostr(ores));
      Writeln('       Xp Gained: ' + inttostr(xp));
      Writeln('\----------------------------/');
    end;

    function CheckRock:Boolean;
    begin
      Result := not IsBlackText('vailable', 8);
    end;

    procedure MineOre;
    begin
      if not LoggedIn then Exit;
      MakeCompass('N');
      repeat
        if (FindObjCustom(x,y,['ine'],[RockColor,RockColor2],7)) then
        begin
          MMouse(x,y,4,4);
          Wait(100 + Random(100));
          if IsUpText('ine') then
          begin
            Mouse(x,y,0,0,true);
            Flag;
            if not CheckRock then
              Break;
            repeat
              Wait(MineTime + Random(500));
            until IsBlackText('anage',8) = True;
          Ores := Ores + 1;
          end;
        end;
      until(InvFull);
    end;


    procedure DropOre;
    var x:integer;
    begin
      if not(InvFull) then Exit;
      x := 2;
      repeat
        DropItem(x);
        x := x+1;
      until(x = 29);
      loadsleft := loadsleft - 1;
      SendProggy;
    end;

    procedure SetupScript;
    begin
      ClearDebug;
      SetupSRL;
      SetupMining;
      loadsleft := Loads;
      Ores := 0;
    end;

    begin
      SetupScript;
      OreXp;
      ActivateClient;
      repeat
        MineOre;
        DropOre;
      until(loadsleft = 0);
    end.

    You phailed at the standards. I fixed them as well.

  16. #16
    Join Date
    Jan 2007
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright, almost ready for release. Now say I wanted to put in the antirandoms? Would I have to include the player array for that?

  17. #17
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes.

    DeclarePlayers.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Don't understand what this error means
    By mexicoman100 in forum OSR Help
    Replies: 4
    Last Post: 12-03-2008, 04:12 PM
  2. Replies: 0
    Last Post: 06-11-2008, 07:28 AM
  3. No avatar means lower cup
    By Boreas in forum SRL Site Discussion
    Replies: 0
    Last Post: 10-25-2006, 05:19 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
  •