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.








Reply With Quote








