Results 1 to 10 of 10

Thread: Simple Coal Powerminer

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

    Default Simple Coal Powerminer

    It does exactly what the title says it does, power mines coal . Try it out and let me know what you think when you get the chance.

    how to use:
    1. Set your character up in front of a bunch of coal rocks (tested working at mining guild).

    note: if using at the mining guild set your camera to the highest angle facing south otherwise you will eventually mine your way to the gate and the screen won't be able to find anymore rocks.

    2. Copy and paste the script into simba

    3. Hit run

    Bug report: please post all your bugs so that I can work on them, although I'll probably need some help

    todo list:
    1. add multi path walking
    2. add banking

    Simba Code:
    program simplecoalpowerminer;
    {$DEFINE SMART}
    {$i srl/srl.simba}

    // If using this in the miners guild a high angle looking South is recommended.

    var
     StartingXp, OriginalXp, CoalMined, TimeOut: Integer;


    const
     (********************Begin Setup*********************************)

    SRLStats_Username = '';  // your SRL stats username
    SRLStats_password = '';  // your srl stats password
    Version = '1.0';
    CustomMouseSpeed = 15;

        procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := '';    // Username?
      Players[0].Pass := '';    // Password?
      Players[0].Nick := '';  // 3 letters of your username (not the first letter)
      Players[0].Active := True;
    end;
     (***************************End Setup******************************)

    {Begin: Modified from MKHerbCleaner2.7 by GetDropped69}
    procedure Antiban;
      begin
        case Random(1500) of
          0..25:
            begin
              HoverSkill('Mining',false);
              MouseBox(645,169,670,203,1);
            end;
          100..150:
            begin
              Sleep(1500+Random(1500));
            end;
          350..400:
            begin
              GameTab(tab_Friends);
              Sleep(80+Random(225));
              MouseBox(644,168,669,202,1);
            end;
          600..650:
            begin
              Mouse(260,160,5,6,false);
              Sleep(200+Random(100));
              MMouse(190,276,10,30);
              Sleep(250+Random(100));
              MMouse(495,45,50,50);
            end;
          800..850:
            begin
              ToggleMoneyPouch(true);
              Sleep(200+Random(250));
              Mouse(532,98,10,10,false);
              WaitOptionMulti(['Examine money','money pouch'],200);
              Sleep(500+Random(200));
              ToggleMoneyPouch(false);
            end;
          900..950:
            begin
              SleepAndMoveMouse(2000+Random(2000));
            end;
        end;
      end;
      {End: Modified from MKHerbCleaner2.7 by GetDropped69}

    function XPPerHour(Runtime,Gained:Extended):Extended;
    begin
      Result:=((Gained * 3600) / (Runtime / 1000));
    end;

    Function GainedXP:Extended;
    begin
      Result:= GetXPBarTotal - StartingXp;
    end;

    procedure ProgressReport;
    var
      TimeGone, CurrentXp, XpGain, CoalInInv: Integer;
    begin
      ClearDebug;
      TimeGone := (GetTimeRunning/1000);
      if(TimeGone = 0) then
       exit;
      CoalInInv := InvCount
      CurrentXp := GetXPBar(1);
      originalxp := GetXPBarTotal;
      XpGain  := (currentxp-originalxp);
          begin
            writeln('****************************************************************************');
            writeln('****************************************************************************');
            writeln('****************************************************************************');
            writeln('****************************************************************************');
            writeln('*Simple Coal Powerminer Version One*');
            writeln('*We have mined: ' +IntToStr(CoalMined) + 'coal*');
            writeln('*We have gained: ' + floattostr(GainedXp) + ' xp');
            Writeln('Thats ' + FloatToStr(XpPerHour(GetTimeRunning,GainedXp))+ ' Xp Per Hour*');
            writeln('*Total Running Time: ' + IntToStr(GetTimeRunning/60000) + ' Minutes*');
            writeln('*****************************************************************************');
            writeln('*****************************************************************************');
            writeln('*****************************************************************************');
            writeln('*****************************************************************************');
         end;
    end;

    function AutoCoalColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL, R, G, B: Integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(1.20, 0.19);

      if not (FindColorsTolerance(arP, 2237475, MSX1, MSY1, MSX2, MSY2, 7)) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToRGB(arC[i], R, G, B);

        if (R >= 17) and (R <= 52) and (G >= 17) and (G <= 54) and (B >= 16) and (B <= 52) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
          Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    Function MineCoal :Boolean;
    var
      a: Integer;
      TPA  : TPointArray;
      ATPA : T2DPointArray;
      MP   : TPoint;
      tmpCTS : Integer;
      PlusOne: Integer;
      counter: Integer;
    begin
      FindNormalRandoms;
      PlusOne := InvCount+1;
      if(not(LoggedIn))then Exit;
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(1.39, 0.10); //Hue and Sat here

      FindColorsTolerance(TPA, AutoCoalColor, MSX1, MSY1, MSX2, MSY2, 7); //Color and tolerance here
      SortTPAFrom(TPA, Point(MSCX, MSCY));
      ATPA := TPAtoATPAEx(TPA, 25, 25);
      SortATPAFromSize(ATPA, 500, true);

      for a := 0 to High(ATPA) do
      begin
        MP := MiddleTPA(ATPA[a]);
        MMouse(MP.X, MP.Y, 4, 4);
        if WaitUptext('Mine Coal', 2000) then //Uptext of mining the rock
        begin
          FindNormalRandoms;
          ClickMouse2(mouse_left);
          Result := True;
          flag;
          marktime(counter);
          repeat
            FindNormalRandoms;
            antiban;
            wait(1000);
            if invcount = plusone then
            writeln('you add an ore of coal to your inventory');
            until (invcount=PlusOne) or (TimeFromMark(counter) > 8000);
          Break;
        end;
      end;
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    end;

    procedure FailSafe;
    var
      Time, MaxTime: Integer;
    begin
      Time := 0;
      maxTime := (RandomRange(10000, 20000));

      MarkTime(Time)

      repeat
        if (TimeFromMark(Time) >= MaxTime) then
          logout;
          TerminateScript;
      until(False);
    end;

    procedure Dropcoal;
    Var
      I : Integer;
      B : TBox;
    begin
      FindNormalRandoms;
      for i := 1 to 28 do
        begin
          If(ExistsItem(I))then
            Begin
              FindNormalRandoms;
              B := InvBox(I);
              If(CountColorTolerance(autocoalcolor, B.x1, B.y1, B.x2, B.y2, 20) > 50)then
                Begin
                  MouseItem(I, mouse_Right);
                  WaitOption('rop', 100+Random(500));
                  FindNormalRandoms;
                End;
            End;
        End;
    End;

    //credits: A big thanks to all the guys in the help section that helped
    //me get this script into a working order.

    begin
    SetupSRL;
    DeclarePlayers;
    ActivateClient;
    if not (LoggedIn) then
      LogInPlayer;
    if not(IsXPBarOpen) then
      ToggleXPBar(True);
    StartingXp := GetXPBarTotal;
    MarkTime(TimeOut);
    MouseSpeed := CustomMouseSpeed;
     repeat
      FindNormalRandoms;
      marktime(TimeOut);
      if (TimeFromMark(TimeOut) >30000) then
      begin
        FailSafe;
      end;
        MineCoal;
        CoalMined := CoalMined + 1;
        Dropcoal;
        progressreport;
     until(false);
    end.

    credits: A big thanks to all the guys in the help section , couldn't have finished this without you guys.
    Last edited by samuri51; 05-31-2012 at 03:56 AM.

  2. #2
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Nice nice not a bad first script at all congratulations!
    I see some YoHoJo-esque stuff in there !

    if invcount = plusone then

    Aww yeah, PLUSONE!

  3. #3
    Join Date
    May 2012
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yeah haha the first thing I did to teach myself was look over your tutorials

  4. #4
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh yeah! Part of my function is inside

    Scripts looks nice. Keep it up

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

    Default

    I should be making WC by Friday I'll give this a go.

    Yet to find any working power miners for mining guild Hope this will do the trick

  6. #6
    Join Date
    May 2012
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    if you run into any problems please lemme know and i'll do my best to fix them C:

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

    Default

    gonna add walking/ banking to this, stay tuned c:.

  8. #8
    Join Date
    Nov 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I mean this in the nicest way, but who in their right mind would powermine coal???

  9. #9
    Join Date
    May 2012
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    lol it was meant more as a test script then for practical usage, there's already a million iron powerminers on here, i'll be adding banking to it though

  10. #10
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    I think checking for randoms twice per ore dropped is a bit excessive but good script

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
  •