Results 1 to 3 of 3

Thread: Simplistic Cow Killer

  1. #1
    Join Date
    Jan 2012
    Posts
    915
    Mentioned
    13 Post(s)
    Quoted
    87 Post(s)

    Default Simplistic Cow Killer

    Simplistic Cow Killer

    What's up guys. It's been.. almost a decade. Randomly got the itch to hop back in and play around and saw that the community is pretty sparse. Here's my contribution.

    Wrote a simple cow killer, currently it ONLY kills cows & prints the time ran until you are logged out.

    update 7/7/2022
    Tightened things up. Read up on the documentation, getting more familiar with the new SRL. Cleaned up the attack procedure, blocked out the grabhides, walking, and banking features at the moment. Figured it would be better to get the combat down pat before i move on.

    I like the wrappers. scripting is much, much more intuitive now. github implementation is also incredible, love the simplicity.

    Anyway, hopefully someone sees this. Say hi if you do. Have a good day!

    Setup
    -full brightness, fixed windowed mode.
    -have your player set up for single-click combat. (works with ranged & melee, but doesn't detect when out of arrows yet.)
    -go to some cows
    -click run.
    -BABYSIT! THERE IS NO ANTIBAN! (yet)


    ***Contributions welcome! Help me make this script better!***
    Plans for the script:
    1. antiban -not started
    2. cowhide looting/banking -in progress
    3. randoms detection -not started
    4. figure out RSWalker -done
    5. detailed progress reports -not started
    6. painting to the RS Client with RemoteInput -still don't understand
    7. detect when out of arrows


    Simba Code:
    program vinylcowkiller;
    {$DEFINE SRL_USE_REMOTEINPUT}
    {$i srl/osr.simba}

    {add settings for ranged attacking (arrow count, switching when out of arrows, etc)}
    {add failsafe, if we are gaining exp then we're okay, if exp has not been gained recently then log out}

    var
      wrld: TIntegerArray;
      timer: TStopwatch;
      RSW: TRSWalker;
      userr, passs, pinn: string;

    procedure declareplayer;
    begin
      userr:= '';     //username
      Passs:= '';     //password
      Pinn:=  '';     //bank pin
      //wrld:=  [-1];     //worlds you want. put commas between them. (-1 is random)
      login.AddPlayer(userr, passs, pinn);
    end;

    procedure setup;
    begin
      if not rsclient.IsLoggedIn then
        exit;

      declareplayer;
      begin
        rsw.Setup('world');
        options.SetZoomLevel(30);
        minimap.SetCompassAngle(270);
      end;
    end;

    procedure dobank;
    var
      x, y: integer;
    begin
      if not inventory.isfull then
      begin
        writeln('still have room in inventory');
        exit;
      end;

      begin
        writeln('walking to al kharid gate');
        rsw.WalkPath([[4834, 3343], [4827, 3381], [4811, 3418], [4825, 3452], [4847, 3497], [4875, 3538]]);
        if findcolor(x, y, 5997527, mainscreen.Bounds) then
        //need to only select guards on the same side of the gate as you
        begin
          mouse.move(x, y);
          wait(100);
          if mainscreen.IsUpText('Talk-to Border Guard', 100) then
          begin
            mouse.click(mouse_right);
            wait(50);
            if chooseoption.IsOpen then
            begin
              chooseoption.Select('Talk-to Border Guard', mouse_left, false, true);
              //need to do case..of and randomly choose between clicking gate and clickng guard
            end;
          end;
        end;
      end;
    end;

    procedure grabhides;
    var
      hide, TPA: TPointArray;
      ATPA: T2DPointArray;

    begin
      if inventory.IsFull then
      begin
        Writeln('inventory is full, banking');
        dobank;
      end;

      if srl.findcolors(TPA, CTS2(12303300, 4, 0.31, 0.15), mainscreen.bounds) then
      begin
        writeln('looking for hides...');
        ATPA := TPA.Cluster(2);
        writeln('clustering TPAs into ATPA');
        ATPA.FilterSize(25, 300);
        writeln('filtering ATPAs');
        ATPA.SortByIndex(Mainscreen.Center);
        writeln('finding matching TPAs');

        for hide in ATPA do
        begin
          writeln('hides detected');
          mouse.move(hide[random(length(hide))]);
          if mainscreen.IsUpText('Take', 50) then
          begin
            mouse.click(mouse_left);
            writeln('grabbing cowhide');
            repeat
              writeln('still grabbing');
              wait(randomrange(100, 176));
            until(not(srl.IsAnimating(box(248, 151, 266, 182), 125, 1000, 3)));
            exit;
          end;
        end;
      end;
    end;

    procedure timerun;
    begin
      writeln(srl.MsToTime(gettimerunning, time_short));
    end;

    procedure antibanstuff;
    begin
    end;

    procedure Getskillups;
    begin
    end;

    function iscowfought(boxxy: TBox): boolean;
    begin
      result:= true;
    end;

    function unreachable: boolean;
    begin
      if chat.GetMessage(1) = 'I can''t reach that!' then
        Result:= true;
    end;

    procedure attackcow;
    var
      x, y: integer;
      cow, TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      {if inventory.IsFull then
      begin
        writeln('inventory is full');
        //dobank;
      end;  }


      writeln('looking for cows..');
      if srl.findcolors(TPA, CTS2(5201264, 19, 0.08, 0.33), mainscreen.bounds) then
      begin
        ATPA := TPA.Cluster(2);
        writeln('clustering TPAs into ATPA');
        ATPA.FilterSize(100, 500);
        writeln('filtering ATPAs');
        ATPA.SortByIndex(Mainscreen.Center);
        writeln('finding matching TPAs');
        timer.Start;
        for cow in ATPA do
        begin
          if timer.ElapsedTime > 2500 then
          begin
            minimap.SetCompassAngle(randomrange(0, 359), 10);
          end;

          writeln('potential cow!');
          writeln(timer.elapsedtime);
          mouse.move(cow[random(length(cow))]);
          if mainscreen.IsUpText('Attack Cow', 50) then
          begin
            mouse.click(mouse_left);
            if mainscreen.DidRedClick then
            begin
              wait(randomrange(600, 1500));
              if Chat.FindMessage('I can''t reach that!', [CHAT_COLOR_BLACK]) then
              begin
                writeln('Unreachable cow, adjusting angle and looking again');
                Minimap.SetCompassAngle(Randomrange(1, 358), 10);
              end else
              begin
                writeln('attacking');
                repeat
                  writeln('still attacking');
                  wait(randomrange(100, 176));
                until(not(srl.IsAnimating(box(248, 151, 266, 182), 150, 1000, 3)));
                timer.Reset;
                Exit;
                {begin
                  writeln('cow is dead, grabbing hide');
                  wait(randomrange(1000, 2000));
                  grabhides;
                end;}

              end;
            end;
            timerun;
          end;
        end else
        begin
          minimap.SetCompassAngle(randomrange(0, 359), 10);
        end;
      end;
    end;

    begin
      cleardebug;
      setup;
      repeat
        {if not rsclient.IsLoggedIn then
        begin
          declareplayer;
          writeln('logging in...');
          login.LoginPlayer;
          Writeln('You aren''t logged in');
          exit;
        end else }

        begin
          repeat
            writeln(srl.MsToTime(gettimerunning, time_short));
            attackcow;
          until(not(rsclient.IsLoggedIn));
        end;
      until((gettimerunning >= 14400000) and (rsclient.IsLoggedIn = false));
    end.

  2. #2
    Join Date
    Jan 2012
    Posts
    915
    Mentioned
    13 Post(s)
    Quoted
    87 Post(s)

  3. #3
    Join Date
    Aug 2012
    Location
    uk
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    nice 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
  •