Results 1 to 4 of 4

Thread: PakYakkistan's Gem Cutter

  1. #1
    Join Date
    Aug 2012
    Location
    The Dark Tower
    Posts
    154
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default PakYakkistan's Gem Cutter

    Whipped this up because I didn't want to do my 10k+ gems by hand (seriously, who does?). Figured it could be useful to the community since there isn't one ,that I am aware of , so here ya go. If I update this, it may be because I use it again and notice it doesn't finish doing all my gems. Should run until you run out of ALL uncut gems in your bank. Runs at pest control.

    Doesn't have a progress report of any kind, but it does have some nice on screen paint to remind you that i'm awesome.

    Make sure you have a chisel (more then one in your bank or it won't find it after the first round and you'll be S.O.L) and the uncut gem(s) visible in your bank whenever you start the script.

    You're going to need the reflection include, SRL-OSR include, and Flights AL functions include (you can find the link for that in Elfyyy's Pest control script(the include is flipping amazing)). I'm not going to go into detail on adding the includes or where to find the reflection and SRL include since you should have already checked out the tutorials for that in the other threads.

    Credits go to Flight(for AL functions), the reflection team, and anyone else that deserves credit that is not credited else were.


    Let me know how she works for you! Comments and such, post away! (Unless your asking about include stuff, then refer to the text written at the beginning of this post)

    Seriously tho, please don't just grab and go! I want to hear from you and see how it's working! Even if you're just stopping by to see what this script is about, let me know what I can improve on, fix, etc. If you do use it, let me know! Feedback helps us scripters better ourselves and the community, and with that, we can give you better scripts and help you learn in the long run as well.


    Simba Code:
    program PestControlGemCutter;

    {$DEFINE SMART8}
    {$I SRL-OSR/SRL.Simba}
    {$I SRL-OSR/SRL/misc/al_functions.simba}
    {$I SRL-OSR/SRL/Reflection/Reflection.simba}
    {$I SRL-OSR\SRL\misc\SmartGraphics.simba}

    //Credits to Flight for Al_Functions
    //Credits to Reflection team for Reflection
    //Credits to SRL devs for SRL
    //Credits to Ben for SMART

    var
      FailSafe, GemDTM, CutGemDTM : Integer;


    //Player setup is here
    const
      BankColor1 = 5599869;    //Use the color picker to pick the bank color
      BankColor2 = 6979715;    //Use the color picker to pick the bank color
      BankColor3 = 9281714;    //Use the color picker to pick the bank color
      UseReflection = 1;  //True = 1, False = 0

    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 2;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := '';//Username
      Players[0].Pass := '';//Password
      Players[0].Pin  := '';//Bank Pin (if none,leave blank)
      Players[0].Member := True;//Keep true
      Players[0].WorldInfo  := []; //Enter a desired world or leave blank for random
      Players[0].Active := True;//Keep true
      Players[0].Nick := '';//Short chunk of IGN
      Players[0].LampSkill := SKILL_FARMING;
      CurrentPlayer := 1;
      Players[1].Name := '';//Username
      Players[1].Pass := '';//Password
      Players[1].Pin  := '';//Bank Pin (if none,leave blank)
      Players[1].Member := True;//Keep true
      Players[1].WorldInfo  := []; //Enter a desired world or leave blank for random
      Players[1].Active := True;//Keep true
      Players[1].Nick := '';//Short chunk of IGN
      Players[1].LampSkill := SKILL_FARMING;
    end;

    procedure MyLogIn;
    begin
      if not LoggedIn then
      begin
        DeclarePlayers;
        LogInPlayer;
        Wait(RandomRange(2000, 3500));
      end else;
    end;

    procedure AntiBan;
    begin
      Case Random(300) of
       //1..20: RandomAngle(0);
       21..35: HoverMovingObject;
       36..50: BoredHuman;
       51..60: RandomMovement;
       61..70: CompassMovement(Random(360), Random(360), False);
       71..80: HoverOnlineFriend;
       81..85: RandomTab(true);
       86..100: Al_HoverSkill(Skill_Crafting, False);
       101..175: MMouseOffClient('Random');
       176..250: sleepandmovemouse(900 + random(450));
      end;
    end;

    procedure babyWaitTime;
    begin
      case random(100) of
        1..25: Wait(RandomRange(100, 200));
        26..50: Wait(RandomRange(200, 300));
        51..75: Wait(RandomRange(400, 500));
        76..100:  Wait(RandomRange(600, 700));
        end;
    end;

    procedure AfkWaitTime;
    begin
      case random(250) of
        1..100: Wait(RandomRange(123+ random(500), 500+ random(590)));
        101..175: Wait(RandomRange(750, 4000));
        176..225: Wait(RandomRange(1250, 5000+ Random(2750)));
        226..250: Wait(Random(7500));
      end;
    end;

    procedure RandomWaitTime;
    begin
      case random(1000) of
        1..700:    Wait(RandomRange(300, 1000));
        701..900:  Wait(RandomRange(400, 1500));
        901..1000: Wait(RandomRange(500, 3000));
      end;
    end;

    //globally decalre the DTMs for the procedures and such
    Procedure LoadGlobalDTMs;
    begin
      GemDTM := DTMFromString('m5wEAAHictc7dCoJAEIbhiT31uFWUolD8uR1voxszEqNQFPPa6l22g2XBw/3gGZhhGEaLyEWJxEhxUrbPUaJCjcZhZgWuOCNDAo2j5839znP/6/EUuzNhwQebw/QrZox4YcADbXSjHoL4SriE+djayQ8p9RVB');
      CutGemDTM := DTMFromString('mqAEAAHicrc5LCoNADIDhiNsuvZOIBUUsqBfouYsPlNaKirrUfzALFy4n8A1JJoR4IhK7IileyFSOQnPTTxDhiQD+halD/TMzPTs/qFCjxRd/jJixYMOq+YQBP3RoUKro8eZ1rNnFbti77HQXBzB/GvE=');
    end;

    //Frees the above DTMs at the end of the main loop
    Procedure FreeGlobalDTMs;
    Begin
      FreeDTM(GemDTM);
      FreeDTM(CutGemDTM);
    end;

    function FindObjTPAMultiCustom( X, Y: Integer; Colour: TIntegerArray; Tol, CTS, ObjWidth, ObjHeight, minCount: Integer; UpText: TStringArray): Boolean;
    var
      i, tCTS: Integer;
      myPoint: TPoint;
      aPoints: T2DPointArray;
      ATPA: T2DPointArray;
      TPA: TPointArray;
    begin
      Result := False;
      if not LoggedIn then exit;
      tCTS := GetColorToleranceSpeed;
      CTS := Integer(CTS * 9 mod 3 <> 0);
      ColorToleranceSpeed(CTS);
      SetLength(ATPA, Length(Colour));
      for i := 0 to High(Colour) do
      begin
        FindColorsSpiralTolerance(x, y, ATPA[i], Colour[i], MSX1, MSY1, MSX2, MSY2, Tol);
      end;
      TPA := MergeATPA(ATPA);
      if Length(TPA) = 0 then
      begin
        ColorToleranceSpeed(tCTS);
        Exit;
      end;
      ColorToleranceSpeed(1);
      aPoints := TPAtoATPAEx(TPA, ObjWidth, ObjHeight);
      for I := 0 to High(aPoints) do
      begin
        if Length(aPoints[i]) < minCount then
          Continue;
        myPoint := MiddleTPA(aPoints[i]);
        MMouse(myPoint.x, myPoint.y, 0, 0);
        if WaitUpTextMulti(UpText, 300) then
        begin
          GetMousePos(X, Y);
          Result := True;
          ColorToleranceSpeed(tCTS);
          Exit;
        end;
      end;

      ColorToleranceSpeed(tCTS);
    end;

    Procedure OpenBankBooth;
    //var x, y : integer;
    begin
      if (BankScreen = False) then repeat
          writeln('Attempting to open bank booth...');
          BabyWaitTime;
          if FindObjTPAMultiCustom(250, 165, [bankcolor1, bankcolor2, bankcolor3], 2, 1, 7, 7, 50, ['Bank', 'ank']) then
            begin
              babyWaitTime;
              ClickMouse2(mouse_left);
              case random(1000) of
                1..700:    Wait(RandomRange(300, 1000));
                701..900:  Wait(RandomRange(400, 1500));
                901..1000: Wait(RandomRange(500, 3000));
              end;
            end;
            RandomWaitTime;
          until (BankScreen);
          babyWaitTime;
          if InvCount > 0 then
          Deposit(2, 28, True);
      writeln('Attempt was successful!');
    end;


    //Leftclicks the tile specified with correct uptext
    function R_ChooseTileThing(Option: String; Tile: TPoint): Boolean;
    var
      a, i, Tilex, Tiley: Integer;
      Tile2: TPoint;
    begin
      Result:= false;
      Tile2:= R_TileToMs(Tile);
      if (Tile2.x = 0) then
        Exit;
      Tilex:= Tile2.x;
      Tiley:= Tile2.y;
      for i:=1 to 45 do
      begin
        a:= i + 5;
        MouseBox(Tilex-a, Tiley-i, Tilex+a, Tiley+i, mouse_move);
        wait(103 + random(88));
        if R_IsUpAction then
         begin
         Result := True
         ClickMouse2(True)
            i:= 45;
          end;
        end;
        wait(100 + random(50));
    end;

    //This was changed from R_BankItem - Uses the above ChooseTileThing and doesn't walk to booth tile
    procedure R_Bank(BoothTile: TPoint);
    var
      u,x,y: Integer;
    begin
      If BankScreen then
      begin
      WriteLn('Bank is already open, continuing on');
      end else
      for u:= 0 to 100 do
      begin
        R_ChooseTileThing('Bank B', BoothTile);
        sleepandmovemouse(1000 + random(1500));
        if BankScreen then u:= 100;
      end;
      if not BankScreen then
      begin
        writeln('[R_BankIt] Didn''t find BankScreen, logging out & terminating.');
        if LoggedIn then LogOut;
        TerminateScript;
      end;
      if InvCount > 0 then
      begin
        for u:= 0 to 100 do
        begin
          wait(70 + random(50));
          Deposit(2, 28, True);
          sleepandmovemouse(900 + random(450));
          if FindColorTolerance(x,y,3818059,704,443,706,445,0) then u:= 100;
        end;
      end;
    end;

    Procedure WithdrawBankItems;
    Var x2, y2 : Integer;
    begin
      If FindDTM(GemDTM, x2, y2, MBX1 - 10, MBY1, MBX2 + 10, MBY2) then
        begin
          AL_HumanMMouse(Point(x2, y2), 10, 10);
          AL_FastClick(Mouse_Right);
          BabyWaitTime;
          Al_ChooseOption('All');
          BabyWaitTime;
          wait(100+random(99));
          CloseBank;
          Exit;
        end else;
      Writeln('Cant find any uncut gems, so, we are going to close this puppy down!');
      TerminateScript;
    end;

    Procedure Bank;
    Var x, y : Integer;
    begin
      If GetCurrentTab <> 24 then
        begin
          Ftab(24);
        end else;
      if FindDTM(GemDTM, x, y, MIx1, MIy1, MIx2, MIy2) then
        begin
          babyWaitTime;
          Exit;
        end else;
      If UseReflection = 1 then
      begin
        R_Bank(Point(2668, 2652));
        WithdrawBankItems;
      end else;
      If UseReflection = 0 then
      begin
        OpenBankBooth;
        WithdrawBankItems;
      end else;
    end;

    Procedure CutGems;
    Var x2, y2 : Integer;
    begin
      InvMouse(1, 1);
      babyWaitTime;
      FindDTM(GemDTM, x2, y2, MIx1, MIy1, MIx2, MIy2);
      Al_HumanMMouse(Point(x2, y2), Random(10), Random(10));
      Al_FastClick(Mouse_Left);
      babyWaitTime;
    end;

    //Checks if the player has received a level
    Function LevelCheck: Boolean;
    begin
      if LevelUp then
        begin
          //Level := Level + 1;
          Result := True;
        end else;
      BabyWaitTime;
      Result := False;
    end;

    Procedure CutGemMenu;
    var x, y: Integer;
        IB : Tbox;
    begin
      IB := IntToBox(MIx1, MIy1, MIx2, MIy2);
      If (Not FindDTM(GemDTM, x, y, MIx1, MIy1, MIx2, MIy2)) then
      exit;
      MouseBox(188, 401, 329, 444, Mouse_move);
      MarkTime(FailSafe);
        Repeat
          Wait(random(100));
        If TimeFromMark(FailSafe) > 5000 then
          begin
            CutGems;
            CutGemMenu;
            Exit;
          end else;
        until IsUpText('Make');
      wait(199+random(99));
      ClickMouse2(Mouse_right);
      AL_ChooseOption('All');
      Wait(876 + Random(123));
      If PixelShift(IB, 2000) > 100 then
        begin
        WriteLn('Pixel shifts found dude!');
          repeat
          If PixelShift(IB, 2500) < 100 then
            Break;
            wait(random(1000+random(999)));
            case Random(32) Of
            1..8: AntiBan;
            end;
          If LevelCheck then
            Break;
            BabyWaitTime;
          until (not FindDTM(GemDTM, x, y, MIx1, MIy1, MIx2, MIy2));
        end else
        CutGemMenu;
    end;

    procedure SetupLoop;
    begin
      DeclarePlayers;
      SetupSRL();
      SetupReflection;
      ActivateClient;
      Smart_DrawTextMulti(True, True,['Brought to you', 'by SRL Jr-Member', '  PakYakkistan'],Point(275, 0), 'BigChars', ClAqua);
      Wait(2000+random(1500));
      MyLogIn;
      MakeCompass('S');
      SetAngle(0);
    end;

    Procedure MainLoop;
    begin
      Bank;
      CutGems;
      CutGemMenu;
      Case Random(200) of
        1..5: AfkWaitTime;
        6..15: RandomWaitTime;
        16..55: BabyWaitTime;
      end;
    end;

    begin
      SetupLoop;
      LoadGlobalDTMs;
      AddOnTerminate('FreeGlobalDTMs');
      repeat
        AdjustMouseSpeed(Random(4), 12, 22);
        MainLoop;
        ClearDebug;
      Until(False);
      FreeGlobalDTMs;
    end.
    Attached Files Attached Files
    Last edited by Pakyakkistan; 03-20-2014 at 11:44 PM. Reason: Updated pretty much everything; Runs like a boss now

  2. #2
    Join Date
    Feb 2012
    Location
    UK
    Posts
    909
    Mentioned
    10 Post(s)
    Quoted
    191 Post(s)

    Default

    Nice release, congrats once again.
    Must be nice to be able to afford 10k gems, but I imagine it was a pain to buy them all.
    Solar from RiD.

  3. #3
    Join Date
    Aug 2012
    Location
    The Dark Tower
    Posts
    154
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by Solar View Post
    Nice release, congrats once again.
    Must be nice to be able to afford 10k gems, but I imagine it was a pain to buy them all.
    Thanks Solar! I have been farming gem rocks for a week or so on my main, so no cost xp :P Most of it was in Opals and Jades; that is why the wait function calls to look for NO uncut gem, in the case that you're cutting these types of gems, if the crushed gem is in the last inventory slot it will still bank

  4. #4
    Join Date
    Aug 2012
    Location
    The Dark Tower
    Posts
    154
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Well, I said I wouldn't update unless it didn't finish all my gems. Found a few problems and fixed them, should run until your gems are cut. Also added the script download in-case you're too lazy to copy and paste.

    Edit: Added some more functions and failsafes. Declared my DTMs globally and freed them globally. Added some more complexity and such. Check it out!
    Last edited by Pakyakkistan; 03-20-2014 at 11:44 PM. Reason: Update stoof

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
  •