Results 1 to 7 of 7

Thread: [Antiban]CheckMovingObjs

  1. #1
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default [Antiban]CheckMovingObjs

    Y'ello,

    I just whipped this up as an add-on to my anti-ban in one of my scripts and thought maybe someone else would like to use it.

    -How it works [Simple]-
    The procedure finds areas of the MS with high movement and moves the mouse to one of these areas. It's optional to have it right-click and examine the options of the menu. The more right-click options there are, the longer it will wait. After waiting the mouse will move up until the menu is closed out. Again, this is only if you have the parameter 'RClick' set to True.

    -How it works [Explained]-
    It's actually pretty smart how it works. First off the MS is split into an array of 35x35 boxes (roughly the size of a single RS tile), credits to Home for this. Next, each box is measured for the pixelshift within it, if the 'shift count' is above 100, it's considered a high-movement box, and the middle of this box is stored as a point in a TPA. Later on the procedure will pick a random box for this array (containing high movement) and move the mouse to it. Should the RClick option be set to true it'll right-click at that coordinate. Then the total number of right-click options are counted then this number is randomly multiplied to be used as the wait. So the more options there are in the menu, the longer it will wait, just like the longer it would take a human to read them all.

    The first function is one Home built, you'll need it for this anti-ban to work:
    Simba Code:
    //by Home
      function AreaToBoxArray(const AreaX1, AreaY1, AreaX2, AreaY2, Width, Height: Integer): TBoxArray;
      var
        AreaW, AreaH: Integer;
        BoxX, BoxY: Integer;
        x, y, i: Integer;
      begin
        // Calculate the area dimensions
        AreaW := AreaX2 - AreaX1 + 1;
        AreaH := AreaY2 - AreaY1 + 1;

        // Calculate the number of boxes in each dimension
        BoxX := AreaW div Width;
        if AreaW mod Width <> 0 then Inc(BoxX);
        BoxY := AreaH div Height;
        if AreaH mod Height <> 0 then Inc(BoxY);

        // Set the number of boxes
        SetLength(Result, BoxX * BoxY);

        // Calculate the boxes
        i := 0;
        for y := 0 to BoxY - 1 do
          for x := 0 to BoxX - 1 do
          begin
            Result[i] := IntToBox(AreaX1 + x * Width,
              AreaY1 + y * Height,
              Min(AreaX2, AreaX1 + (x + 1) * Width - 1),
              Min(AreaY2, AreaY1 + (y + 1) * Height - 1));
            Inc(i);
          end;
      end;

    Simba Code:
    Procedure CheckMovingObjs(RClick: Boolean);
      var
        TBA: TBoxArray;
        MidBox: TPoint;
        TIA: TIntegerArray;
        H,I,J,X,Y,T: Integer;
        TPA,PBox: TPointArray;
        RCOpts: Array of TOptions;
      begin
        if not LoggedIn then Exit;

        ColorToleranceSpeed(1);
        SetColorSpeed2Modifiers(0.2, 0.2);

        PBox := TPAFromBox(IntToBox(240, 130, 275, 185));
        TBA := AreaToBoxArray(MSX1, MSY1, MSX2, MSY2, 35, 35);
        TIA := PixelShiftMulti(TBA, 300);

        for H := 0 to High(TBA) do
        begin
          if (TIA[H] > 100) then
          begin
            MidBox := MiddleBox(TBA[H]);
            SetArrayLength(TPA, Length(TPA)+1);
            TPA[High(TPA)] := MidBox;
          end;
        end;

        ClearTPAFromTPAWrap(TPA, PBox, TPA);
        if (Length(TPA) < 1) then Exit;

        I := Random(Length(TPA));
        MissMouse2(TPA[I].X, TPA[I].Y, 5, 5);
        if RClick then
        begin
          FastClick(Mouse_Right);
          RCOpts := GetChooseOptions('All');
          J := Length(RCOpts);
          Wait(RandomRange(J*75, J*120));

          MarkTime(T);
          repeat
            GetMousePos(X, Y);
            BrakeMMouse(X-10,Y-10,15,5);
            if (TimeFromMark(T) > 5000) then
              break;
          until(not FindTextEx(X,Y,['Choose','Option'],['UpCharsEx'],MSX1,MSY1,MSX2,MSY2))

          if FindTextEx(X,Y,['Choose','Option'],['UpCharsEx'],MSX1,MSY1,MSX2,MSY2) then
            MMouse(RandomRange(MIX1,MIX2),RandomRange(MIY1,MIY2),0,0);
        end;

      end;

    Edit:
    I had a problem with it right-clicking on massive player/item spawns to where the menu Y spanned the length of the MS therefore unable to close out of the menu. I fixed this by throwing in a loop to keep moving the mouse up & left until the menu was closed out. If it's still not closed out after 5 seconds the mouse is moved randomly to the inventory. Can't go wrong.


    Let me know how it works for you guys.
    Last edited by Flight; 08-10-2012 at 06:51 AM.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  2. #2
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Great job!
    But I do see a problem when you're doing something and it chooses to click under you by accident.

  3. #3
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    Do you mean > 300 or > 100? In the function it's 100.

    @shay
    I just did a test and the Box that your player is in while North+Highest angle is box 67 so a user could do this to get rid of that box if that is causing issues.

    Simba Code:
    if (h = 67) then
      continue;

    Edit: Actually I just looked at it some more and the players box is already removed so yeah.

    Edit2: But wait, If it clears the player from the TPA, how did it detect my player doing an emote?

    Edit3: looking into this further

    Edit4: Oh it just doesn't right click. Nevermind lol.
    Last edited by Nebula; 08-10-2012 at 04:59 AM.

  4. #4
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Shay View Post
    Great job!
    But I do see a problem when you're doing something and it chooses to click under you by accident.
    I'm not sure what you mean by 'under you'. If you mean clicking where your player stands then that area surrounding your player should be ignored overall.

    Quote Originally Posted by Nebula View Post
    Do you mean > 300 or > 100? In the function it's 100.

    @shay
    I just did a test and the Box that your player is in while North+Highest angle is box 67 so a user could do this to get rid of that box if that is causing issues.

    Simba Code:
    if (h = 67) then
      continue;

    Edit: Actually I just looked at it some more and the players box is already removed so yeah.

    Edit2:But wait, If it clears the player from the TPA, how did it detect my player doing an emote?

    Edit3:looking into this further
    Yeah, I got the shiftcount mixed up with analyzing time. :S I'll correct that in the OP. Also, unless 'ClearTPAFromTPAWrap' is flawed it should not pick an area in the player's box (Box(240, 130, 275, 185)).

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  5. #5
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    MissMouse2(TPA[I].X, TPA[I].Y, 5, 5); Is that a custom function you use? I guess il just change it to missmouse.

    Edit: Also FastClick

  6. #6
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    Quote Originally Posted by Ollybest View Post
    MissMouse2(TPA[I].X, TPA[I].Y, 5, 5); Is that a custom function you use? I guess il just change it to missmouse.

    Edit: Also FastClick
    Those are functions in the MouseHandler include. C:\Simba\Includes\SRL\srl\misc\MouseHandler. Yeah, they're custom mouse functions- most if not all of the functions are made by flight.

    E: Actually MouseHandler is not part of the include, you have to manually download it.

    Here I'll attach it to this post. This is version 1.01 I'm not sure if he's created a newer version or not though.
    Last edited by Nebula; 08-12-2012 at 06:30 PM.

  7. #7
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    Those are functions in the MouseHandler include. C:\Simba\Includes\SRL\srl\misc\MouseHandler. Yeah, they're custom mouse functions- most if not all of the functions are made by flight.

    E: Actually MouseHandler is not part of the include, you have to manually download it.

    Here I'll attach it to this post. This is version 1.01 I'm not sure if he's created a newer version or not though.
    Thank you very much Nebula.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


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
  •