Results 1 to 5 of 5

Thread: [FIRST SCRIPT?] Seers Village Flax Picker

  1. #1
    Join Date
    Aug 2008
    Location
    Oklahoma, USA
    Posts
    173
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default [FIRST SCRIPT?] Seers Village Flax Picker

    Not sure if this is actually my first script, but if it isnt then it is the first in a long time.

    This script picks and banks flax.

    Things to do
    - Add antiban
    - Add Spin flax
    - Clean up
    - Make better

    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL-6/SRL.Simba}
    {$I SPS/lib/SPS-RS3.Simba}

    // This is a DirectX script, be sure to have the plugin
    //  from: https://villavu.com/forum/showthread.php?t=107256

    const
     {-- Player Options --}

      USE_RAFIKI = True;               // Set false if NOT using Rafiki
      RAFIKI_NICKNAME = 'Adem';             // Set Rafiki nickname
      RAFIKI_PLAYER_FILE = 'Temp';          // Set Rafiki Player File name

      {-- IF NOT USING RAFIKI --}
      LOGIN_NAME = '';                  // Set Login if NOT using Rafiki
      PASSWORD = '';                    // Set Password
      //BANK_PIN = ;                    // Remove '//' and insert Bankpin
      {-------------------------}

      USE_WORLD = 74;

    var
      flaxPicked: integer;

    procedure declarePlayers();
    begin
      if USE_RAFIKI then
        begin
          // Rafiki Setup \\
          Players.Setup([RAFIKI_NICKNAME], RAFIKI_PLAYER_FILE);
          SetLength(Players,1);
        end else
        begin
          // Non-Rafiki Setup \\
          SetLength(Players,1);
          With players[0] Do
            begin
              loginName := LOGIN_NAME;
              password := PASSWORD;
              IsActive := true;
              World := USE_WORLD;
            //BankPin :=;
            end;
        end;
      CurrentPlayer := 0;
    end;

    procedure progressReport();
    begin
      clearDebug();
      writeLn('/////////////////////////////////////////////////////////');
      writeLn('//             Seers Village Flax Picker               //');
      writeLn('//                     BY: sf411                       //');
      writeLn('/////////////////////////////////////////////////////////');
      writeLn('                  Time Run: ' + TimeRunning);
      writeLn('                  Flax Picked/Farm XP: ' + intToStr(flaxPicked));
      writeLn('                  Loads Completed: ' + intToStr(round(flaxPicked / 28)));
      writeLn('/////////////////////////////////////////////////////////');
    end;

    procedure antiban();
    begin
      case Random(100) of
        10: RandomRClickItem();
        20: MouseOffClient(Random(5));
        30: RandomCompass(0, 180, false);
        40: PickUpMouse;
        50: hoverSkill(SKILL_FARMING);
        60: MouseMovingObject();
        70: SleepAndMoveMouse(200 + Random(50));
        90: PickUpMouse();
        100: randomGameTab(true);
      end;
    end;

    procedure teleToSeers();
    var
      pathToBank: TPointArray;
      p: TPoint;
    begin
      if not isLoggedIn() then
        exit;
      repeat
        lodestoneScreen.teleportTo(LOCATION_SEERS_VILLAGE);
        wait(randomRange(16000, 20000));
      until (not isLoggedIn()) or (minimap.findSymbol(p, MM_SYMBOL_LODESTONE, minimap.getBounds()));
    end;

    procedure toField();
    var
      pathToField: TPointArray;
      p: TPoint;
    begin
      if not isLoggedIn() then
        exit;

      smartImage.clear();
      pathToField := [Point(92, 270), Point(111, 271), Point(138, 265), Point(171, 260), Point(191, 260), Point(216, 263), Point(232, 268), Point(242, 287), Point(255, 309), Point(259, 323), Point(262, 343), Point(261, 360), Point(270, 380), Point(279, 407), Point(283, 427), Point(291, 444), Point(315, 447)];

      if SPS.walkPath(pathToField) then
        minimap.waitPlayerMoving()
      else
        writeLn('Failed Field Path');
    end;

    procedure fieldToBank();
    var
      pathFtB: TPointArray;
      p: TPoint;
    begin
      if not isLoggedIn() then
        exit;

      smartImage.clear();
      pathFtB := [Point(332, 451), Point(307, 448), Point(287, 443), Point(279, 427), Point(262, 400), Point(253, 379), Point(253, 358), Point(251, 332), Point(252, 315), Point(251, 288), Point(248, 261), Point(244, 234)];

      if SPS.walkPath(pathFtB) then
        minimap.waitPlayerMoving()
      else
        writeLn('Failed Field to Bank Path');
    end;

    procedure bankToField();
    var
      pathBtF: TPointArray;
      p: TPoint;
    begin
      if not isLoggedIn() then
        exit;

      smartImage.clear();
      pathBtF := [Point(244, 234), Point(248, 261), Point(251, 288), Point(252, 315), Point(251, 332), Point(253, 358), Point(253, 379), Point(262, 400), Point(279, 427), Point(287, 443), Point(307, 448), Point(332, 451)];

      if SPS.walkPath(pathBtF) then
        minimap.waitPlayerMoving()
      else
        writeLn('Failed Bank to Field Path');
    end;

    procedure lodeToBank();
    var
      pathLtB: TPointArray;
      p: TPoint;
    begin
      if not isLoggedIn() then
        exit;

      smartImage.clear();
      pathLtB := [Point(93, 268), Point(114, 266), Point(136, 266), Point(154, 266), Point(183, 264), Point(205, 265), Point(220, 264), Point(236, 264), Point(248, 261), Point(244, 234)];

      if SPS.walkPath(pathLtB) then
        minimap.waitPlayerMoving()
      else
        writeLn('Failed Lode to Bank Path');
    end;

    procedure findFlax();
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      if not isLoggedIn() or tabBackpack.isFull() then
        exit;

      repeat
        progressReport();
        findColorsSpiralTolerance(x, y, TPA, 2002177, mainScreen.getBounds(), 6, colorSetting(2, 0.23, 0.24));

        if (Length(TPA) < 1) then
          exit;

        ATPA := TPA.toATPA(15, 15);
        ATPA.filterBetween(0, 11);
        ATPA.sortFromMidPoint(mainscreen.playerPoint);
        smartImage.debugATPA(ATPA);

        for i := 0 to high(ATPA) do
        begin
          mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
          if isMouseOverText(['ick', 'Flax'], 500) then
          begin
            fastClick(MOUSE_LEFT);
            smartImage.clear;
            tabBackpack.waitForShift(5000);
            inc(flaxPicked);
            antiban();
            wait(1350 + random(200));
            break;
          end else
            begin
              writeln('Did Not Find Flax');
              exit;
            end;
        end;
      until tabBackpack.isFull();
    end;

    procedure setupScript();
    begin
      clearDebug();
      smartPlugins := ['d3d9.dll'];
      smartEnableDrawing := true;
      DisableSRLDebug := true;
      setupSRL();
      declarePlayers();
      SPS.setup('Seer_Flax', RUNESCAPE_OTHER);
      clearDebug();
      writeln('Intial setup starting...');
      if not isLoggedIn() then
      begin
        players[currentPlayer].login();
        exitTreasure();
      end;
      if not minimap.isRunenabled() then
        minimap.toggleRun(true);
     // minimap.clickCompass();
      mainScreen.setAngle(MS_ANGLE_HIGH);
      progressReport();
    end;

    procedure findBank();
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      if not isLoggedIn() then
        exit;
      findColorsSpiralTolerance(x, y, TPA, 8088157, mainScreen.getBounds(), 10, colorSetting(2, 0.33, 0.62));
      if (Length(TPA) < 1) then
        exit;
      ATPA := TPA.toATPA(30, 30);
      ATPA.sortFromMidPoint(mainscreen.playerPoint);
      smartImage.debugATPA(ATPA);
      for i := 0 to high(ATPA) do
      begin
        mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
        if isMouseOverText(['anker'], 500) then
        begin
          fastClick(MOUSE_LEFT);
          smartImage.clear;
          break;
        end;
      end;
    end;

    procedure depositBank();
    var
      bankTimer: TTimeMarker;
    begin
      if not isLoggedIn() then
        exit;
      if bankscreen.isOpen(1500) then
      begin
        bankTimer.start();
        repeat
          if (bankscreen.getPackCount() > 0) then
            bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);

        until (bankscreen.isPackEmpty()) or (not isLoggedIn()) or (bankTimer.getTime() > 10000);
        progressReport();
        bankTimer.reset();
        bankscreen.close();
      end;

    end;

    begin
      setupScript();
      teleToSeers();

      if tabBackpack.count() > 0 then
      begin
        lodeToBank();
        findBank();
        depositBank();
        bankToField();
      end
      else begin
        toField();
      end;

      repeat
        while not tabBackpack.isFull() do
          findFlax;

        fieldToBank();
        findBank();
        depositBank();
        bankToField();
        progressReport();
      until false;
    end.
    Last edited by sf411; 09-13-2014 at 11:07 PM.

  2. #2
    Join Date
    Jul 2014
    Location
    Europe
    Posts
    182
    Mentioned
    7 Post(s)
    Quoted
    103 Post(s)

  3. #3
    Join Date
    Aug 2008
    Location
    Oklahoma, USA
    Posts
    173
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    For some reason the fieldToBank() path has started failing every time. It brings up 3 (30,30) ATPA boxes and just mouses over them.

  4. #4
    Join Date
    Sep 2014
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Good job man!

  5. #5
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by sf411 View Post
    For some reason the fieldToBank() path has started failing every time. It brings up 3 (30,30) ATPA boxes and just mouses over them.
    Because it fails and just starts looking for the bankers. Maybe you should add in a "isInBank()" function and use it as a failsafe.

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
  •