Results 1 to 3 of 3

Thread: Combat

  1. #1
    Join Date
    Feb 2018
    Posts
    23
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default Combat

    Is there a better way to make combat to make it more reliable and faster?

    Code:
    program testCombat;
    {$i srl-6/srl.simba}
    {$i SPS/lib/sps-rs3.simba} 
    var
      x, y, i: Integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    
    procedure declarePlayers();
    begin
      setLength(players, 1);
        with players[0] do
          begin
            loginName := '****';    //UserName
            password  := '****';    //Password
            isActive  := True;  //Leave true
            isMember  := True; //Is user a Member?
          end;
      currentPlayer := 0;
    end; 
    
    procedure loginProcedure();
    begin
      If Not isLoggedIn Then
      begin
        players[currentPlayer].login();
        exitTreasure();
        minimap.clickCompass();
        mainScreen.setAngle(MS_ANGLE_HIGH);
        resetBreakTimer();
      end;
    end;  
    
    procedure setupShit();
    begin
      setupSRL();
      disableSRLLog := True;
      disableSRLDebug := True;
      declarePlayers();
      play_Time  := 60;
      break_Time := 10;
      SPS.setup('Capture1', RUNESCAPE_SURFACE, 8);
      spsAnyAngle := True;
      resetBreakTimer();
      clearDebug();
    end;  
    
    procedure randomMouse();
    begin
      mouseSpeed := gaussRangeInt(30, 50);
      case random(3) of
        0: mouse(ATPA[i].getBounds().getGaussPoint(), MOUSE_MOVE, MOUSE_HUMAN);
        1: mouse(ATPA[i].getBounds().getGaussPoint(), MOUSE_MOVE, MOUSE_ACCURATE);
        2: mouse(ATPA[i].getBounds().getGaussPoint(), MOUSE_MOVE, MOUSE_BREAK);
      end;
    end;  
    
    procedure handleClick();
    begin
      case random(9) of
        0..7: fastClick(mouse_left);
        8..9:
          begin
            fastClick(mouse_right);
            chooseOption.select(['ttack'], 500);
          end;
      end;
    end; 
    
    procedure findNPC();
    var
      path1, path2: TPointArray;
      firstArea, secondArea: TBox;
    begin
      path1 := [[403, 208]];
      path2 := [[415, 263]];
      firstArea  := intToBox(365, 176, 445, 248);
      secondArea := intToBox(371, 248, 449, 300);
      if not findColorsSpiralTolerance(x, y, TPA, 10457167, mainScreen.getBounds(), 8, colorSetting(2, 0.44, 0.85)) then
      begin
        if SPS.isInBox(firstArea) then
          SPS.walkPath(path2);
        if not findColorsSpiralTolerance(x, y, TPA, 10457167, mainScreen.getBounds(), 8, colorSetting(2, 0.44, 0.85)) then
          if SPS.isInBox(secondArea) then
            SPS.walkPath(path1);
      end;
      if findColorsSpiralTolerance(x, y, TPA, 10457167, mainScreen.getBounds(), 8, colorSetting(2, 0.44, 0.85)) then
      begin
        ATPA := TPA.cluster(30);
        ATPA.sortFromMidPoint(mainScreen.playerPoint);
    
        for i := 0 to 0 do
        begin
          randomMouse();
          if not isMouseOverText(['Attack', 'ttack'], 500) then
            findNPC();
    
          if isMouseOverText(['Attack', 'ttack'], 500) then
          begin
            clearDebug;
            writeLn('Status: Found NPC, Clicking.');
            handleClick();
            wait(gaussRangeInt(500, 750));
            break;
          end;
        end;
        if not targetInfo.hasTarget(1500) then
          findNPC();
    
        repeat
          clearDebug;
          writeLn('Status: In combat.');
          wait(gaussRangeInt(250, 750));
        until(not inCombat());
      end;
    end; 
    
    begin
      setupShit();
    
      repeat
        findNPC();
        wait(gaussRangeInt(2000, 3000));
      until(false);
    end.
    Last edited by 6b49WR7VbUjs9Hqeq5Etr; 05-22-2018 at 08:08 PM.

  2. #2
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    For starters, you don’t ever tell the mouse to move to the results of the color search (ATPA), and instead have the mouse move randomly and then check for over text which doesn’t really make any sense? In this state the script will only click if the mouse happens to randomly move over an attackable NPC merely by chance.

    You need to add code like this when the for loop is going through atpa results.

    Simba Code:
    mouse(atpa[i].getMiddle(), MOUSE_MOVE, MOUSE_HUMAN);

    Then check if the overtext is correct, then click.

  3. #3
    Join Date
    Feb 2018
    Posts
    23
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Sorry, i forgot to include the randomMouse function

    Code:
    procedure randomMouse();
    begin
      mouseSpeed := gaussRangeInt(30, 50);
      case random(3) of
        0: mouse(ATPA[i].getBounds().getGaussPoint(), MOUSE_MOVE, MOUSE_HUMAN);
        1: mouse(ATPA[i].getBounds().getGaussPoint(), MOUSE_MOVE, MOUSE_ACCURATE);
        2: mouse(ATPA[i].getBounds().getGaussPoint(), MOUSE_MOVE, MOUSE_BREAK);
      end;
    end;
    Any other suggestions or ways to improve it?

    Also by improve i mean to make it "find"? NPC's faster or basically help with missclicking due to them moving.
    Last edited by 6b49WR7VbUjs9Hqeq5Etr; 05-22-2018 at 07:33 PM.

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
  •