PDA

View Full Version : New Antiban Procedure



putonajonny
02-26-2012, 11:30 AM
Should I send a pull request?

It chooses a random game tab that isn't the one that you have open, then goes to it, if explore = true then it will interact, with it before going back to the original tab.

Procedure RandomTab(Explore : Boolean);
Var
NewTab, CTab, Skill, Level, Time, i, x, y, DTM : integer;
Coords : TPoint;
Box : TBox;
Points : TPointArray;
begin
MouseSpeed := 9;
CTab := GetCurrentTab;
if(CTab = -1) then
CTab := tab_Inv;
Repeat
NewTab := tab_Combat + Random(tab_LogOut - tab_Combat + 1)
Until((NewTab <> CTab) or (NewTab = tab_Inv));

GameTab(NewTab);

if(not Explore)then
begin
Wait(2000+Random(6000));
GameTab(CTab);
MouseSpeed := 15;
exit;
end;

Wait(500+Random(2500))

Case NewTab of
tab_Combat : begin
Case Random(4) of
0 : MouseBox(569, 253, 634, 293, mouse_move);
1 : MouseBox(654, 253, 717, 293, mouse_move);
2 : MouseBox(571, 306, 634, 345, mouse_move);
3 : MouseBox(570, 359, 714, 399, mouse_move);
end;
Case Random(2) of
0 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(500));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
1 : Wait(200+Random(1800))
end;
end;
tab_Task : begin
if((GetColor(702, 214) = 6533359) and (GetColor(725, 216) = 6533359))then
Mouse(706, 215, 8, 4, mouse_Left);
Wait(1000+Random(1400));
Case Random(6) of
0 : MouseBox(564, 258, 631, 310, mouse_move);
1 : MouseBox(655, 258, 721, 310, mouse_move);
2 : MouseBox(564, 323, 631, 374, mouse_move);
3 : MouseBox(655, 323, 721, 374, mouse_move);
4 : MouseBox(564, 385, 631, 435, mouse_move);
5 : MouseBox(655, 385, 721, 435, mouse_move);
end;
Case Random(2) of
0 : begin
ClickMouse2(Mouse_Left);
Wait(2200+Random(2500));
MouseBox(682, 208, 735, 222, Mouse_Left);
end;
1 : Wait(200+Random(1800))
end;
end;
tab_Stats : begin
Repeat
Skill := Random(SKILL_DUNGEONEERING + 1);
Level := GetSkillLevel(Skill);
inc(i);
if(i > 20) then
begin
GameTab(CTab);
MouseSpeed := 15;
exit;
end;
Until(Level <> 1);
WriteLn(Skill);
WriteLn(Level);
Coords := SkillToCoords(Skill);
WriteLn(Coords);
MMouse(Coords.x, Coords.y, 25, 10);
Case Random(4) of
0 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(500));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
1 : begin
ClickMouse2(mouse_Right);
if(Level = 99) then
begin
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
GameTab(CTab);
MouseSpeed := 15;
exit;
end;
Level := ((Level / 10) + 1) * 10;
if(Level > 99) then
Level := 99;
WaitOption('evel', 500+Random(500));
Wait(1000+Random(2000));
TypeSendEx(IntToStr(Level), True);
Wait(1000+Random(1000));
MMouse(Coords.x, Coords.y, 25, 10);
Wait(200+Random(2800));
end;
2 : begin
ClickMouse2(mouse_Left);
Wait(1000+Random(2000));
MMouse(747, 454, 2, 2);
GetMousePos(x, y);
HoldMouse(x, y, mouse_Left);
Wait(Random(1000));
ReleaseMouse(x, y, mouse_Left);
Wait(200+Random(3000));
CloseWindow;
end;
3 : Wait(2000+Random(3000));
end;
end;
tab_Quest : begin
if(not FindColors(Points, 255, 551, 289, 725, 453))then
begin
MMouse(729, 439, 2, 2);
GetMousePos(x, y);
HoldMouse(x, y, mouse_Left);
MarkTime(Time);
Repeat
if(FindColors(Points, 255, 551, 289, 725, 453))then
break;
if(TimeFromMark(Time) > 1500) then
begin
Wait(200+Random(300));
break;
end;
Wait(200+Random(200));
Until(false);
ReleaseMouse(x, y, mouse_Left);
if(not FindColors(Points, 255, 551, 289, 725, 453)) then
begin
GameTab(CTab);
MouseSpeed := 15;
exit;
end;
i := Random(GetArrayLength(Points));
MMouse(Points[i].x, Points[i].y, 0, 0);
Case Random(2) of
0 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(500));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
1 : begin
ClickMouse2(mouse_Left);
Wait(3000+Random(5000));
CloseWindow;
end;
end;
end;
end;
tab_Inv : begin
if(InvEmpty)then
begin
MouseBox(556, 215, 729, 458, mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
GameTab(CTab);
MouseSpeed := 15;
exit;
end;
Repeat
x := 1 + Random(28);
Until(ExistsItem(x))
MouseItem(x, mouse_Right);
Case Random(2) of
0 : MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
1 : WaitOption('amine', 500+Random(500));
end;
end;
tab_Equip : begin
Box := GetEquippedItemBounds(1 + Random(11));
MouseBox(Box.x1, Box.y1, Box.x2, Box.y2, mouse_Right);
Case Random(2) of
0 : MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
1 : WaitOption('amine', 500+Random(500));
end;
end;
tab_Prayer : begin
x := Random(5);
y := Random(6);
Box.x1 := 565 + (x * 37);
Box.x2 := Box.x1 + 14;
Box.y1 := 222 + (y * 37);
Box.y2 := Box.y1 + 10;
Case Random(5) of
0 : begin
MouseBox(Box.x1, Box.y1, Box.x2, Box.y2, mouse_Right);
Wait(200+Random(200));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
1..4 : begin
MouseBox(Box.x1, Box.y1, Box.x2, Box.y2, mouse_move);
Wait(1000+Random(2000));
end;
end;
end;
tab_Magic : begin
i := 1 + Random(3);
Repeat
x := Random(6);
y := Random(9);
x := 574 + 24 * x;
y := 229 + 24 * y;
MMouse(x, y, 8, 8);
Case Random(2) of
0 : Wait(500+Random(2500));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(1800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
end;
dec(i);
Until(i <= 0);
end;
tab_Objectives : begin
Wait(200+Random(1800)); //what is tab_objectives?
end;
tab_Friends : begin
if(not FindColors(Points, 8231332, 547, 247, 719, 435))then
begin
GameTab(CTab);
MouseSpeed := 15;
exit;
end;
i := Random(GetArrayLength(Points));
MMouse(Points[i].x, Points[i].y, 0, 0);
Wait(200+Random(200));
Case Random(2) of
0 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(1000));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
1 : begin
Wait(200+Random(1000));
i := Random(GetArrayLength(Points));
MMouse(Points[i].x, Points[i].y, 0, 0);
end;
end;
end;
tab_Ignore : begin
//due to an update this is now the same tab as Tab_Friends
end;
tab_FriendChat : begin
Case Random(2) of
0 : begin
Mouse(559, 450, 3, 3, mouse_Right);
Wait(200+Random(200));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
1 : begin
MMouse(575, 450, 3, 3);
Case Random(2) of
0 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(200));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
1 : begin
ClickMouse2(mouse_Left);
Wait(200+Random(800));
MouseBox(335, 100, 471, 300, mouse_move);
Case Random(2) of
0 : MouseBox(335, 100, 471, 300, mouse_move);
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(200));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
end;
CloseWindow;
DTM := DTMFromString('mwQAAAHic42RgYJBkYWAQA2IZKAaxRVkg4j JQugaorhKK66EYJlYD5f/ZoIOB7aWkGUKVlBicuLkZnHh4GIgBjERgOAAAlCAQag==');
if(FindDTM(DTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
Mouse(x, y, 3, 3, mouse_Left);
FreeDTM(DTM);
end;
end;
end;
end;
end;
tab_Clan : begin
MouseBox(549, 441, 636, 458, mouse_move);
Case Random(2) of
0 : Wait(200+Random(2800));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
end;
end;
tab_Options : begin
Case Random(9) of
0 : begin
MMouse(585, 265, 5, 5);
Case Random(3) of
0 : Wait(200+Random(2800));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
2 : begin
ClickMouse2(mouse_Left);
Wait(200+Random(400));
MouseBox(68, 159, 443, 183, mouse_move);
Case Random(2) of
0 : ClickMouse2(mouse_Right);
end;
CloseWindow;
Wait(200+Random(400));
CloseWindow;
end;
end;
end;
1 : begin
MMouse(643, 265, 5, 5);
Case Random(3) of
0 : Wait(200+Random(2800));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
2 : begin
ClickMouse2(mouse_Left);
Wait(200+Random(400));
MouseBox(172, 45, 337, 281, mouse_move);
Case Random(2) of
0 : ClickMouse2(mouse_Right);
end;
Wait(200+Random(400));
CloseWindow;
end;
end;
end;
2 : begin
MMouse(698, 265, 5, 5);
Case Random(2) of
0 : Wait(200+Random(2800));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
end;
end;
3 : begin
MMouse(586, 348, 5, 5);
Case Random(3) of
0 : Wait(200+Random(2800));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
2 : begin
ClickMouse2(mouse_Left);
Wait(500+Random(800));
ClickMouse2(mouse_Left);
end;
end;
end;
4 : begin
MMouse(641, 348, 5, 5);
Case Random(3) of
0 : Wait(200+Random(2800));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
2 : begin
ClickMouse2(mouse_Left);
Wait(500+Random(800));
ClickMouse2(mouse_Left);
end;
end;
end;
5 : begin
MMouse(698, 346, 5, 5);
Case Random(3) of
0 : Wait(200+Random(2800));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
2 : begin
ClickMouse2(mouse_Left);
Wait(200+Random(400));
MouseBox(550, 237, 736, 254, mouse_Left);
Wait(200+Random(1500));
Mouse(724, 220, 3, 3, mouse_Left);
end;
end;
end;
6 : begin
MMouse(586, 388, 5, 5);
Case Random(3) of
0 : Wait(200+Random(2800));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
2 : begin
ClickMouse2(mouse_Left);
Wait(500+Random(800));
ClickMouse2(mouse_Left);
end;
end;
end;
7 : begin
MMouse(643, 400, 5, 5);
Case Random(3) of
0 : Wait(200+Random(2800));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
2 : begin
ClickMouse2(mouse_Left);
Wait(200+Random(400));
Mouse(723, 220, 3, 3, mouse_Left);
end;
end;
end;
8 : begin
MMouse(699, 400, 5, 5);
Case Random(3) of
0 : Wait(200+Random(2800));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
2 : begin
ClickMouse2(mouse_Left);
Wait(1200+Random(1800));
CloseWindow;
end;
end;
end;
end;
end;
tab_Emotes : begin
MouseBox(556, 215, 712, 436, mouse_move);
Case Random(2) of
0 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(1800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
1 : Wait(500+Random(2500));
end;
end;
tab_Music : begin
if(not FindColors(Points, 65280, 551, 289, 725, 453))then
begin
MMouse(729, 446, 2, 2);
GetMousePos(x, y);
HoldMouse(x, y, mouse_Left);
MarkTime(Time);
Repeat
if(FindColors(Points, 255, 551, 289, 725, 453))then
break;
if(TimeFromMark(Time) > 3000) then
begin
Wait(200+Random(300));
break;
end;
Wait(200+Random(200));
Until(false);
ReleaseMouse(x, y, mouse_Left);
if(not FindColors(Points, 65280, 551, 289, 725, 453)) then
begin
GameTab(CTab);
MouseSpeed := 15;
exit;
end;
end;
i := Random(GetArrayLength(Points));
MMouse(Points[i].x, Points[i].y, 0, 0);
Case Random(2) of
0 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(500));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
1 : begin
ClickMouse2(mouse_Left);
Wait(200+Random(1800));
end;
end;
end;
tab_Notes : begin
MMouse(565, 217, 3, 3);
Case Random(2) of
0 : Wait(200+Random(800));
1 : begin
ClickMouse2(mouse_Right);
Wait(200+Random(800));
MouseBox(MSCX, MSCY, MSX2, MSY2, mouse_move);
end;
end;
end;
tab_LogOut : Wait(200+Random(1800));
end;

Wait(200+Random(1800));
GameTab(CTab);
MouseSpeed := 15;

end;

(*

RandomTab
~~~~~~~~~~~~~

.. code-block:: pascal

function Procedure RandomTab(Explore : Boolean);

It chooses a random tab that isn't the one that you have open, then goes
to it, if explore = true then it will interact, with it before going back
to the original tab.

.. note::

by putonajonny

Example:

procedure Antiban;
begin
Case Random(100) of
0 : RandomTab(True);
1 : RandomTab(False);
2 : RandomRClick;
3 : PickUpMouse;
4 : BoredHuman;
end;
end;

.. code-block:: pascal

*)

Caotom
02-26-2012, 11:35 AM
Looks good, will definitely test this out soon.
Thanks for putting in the time to make it, much appreciated :)

~Caotom

masterBB
02-26-2012, 11:35 AM
Good job. That is a big as anti ban function. It does contain endless loops though:

Repeat
if(FindColors(Points, 255, 551, 289, 725, 453))then
break;
if(TimeFromMark(Time) > 3000) then
begin
Wait(200+Random(300));
end;
Wait(200+Random(200));
Until(false);

putonajonny
02-26-2012, 11:45 AM
Good job. That is a big as anti ban function. It does contain endless loops though:

Repeat
if(FindColors(Points, 255, 551, 289, 725, 453))then
break;
if(TimeFromMark(Time) > 3000) then
begin
Wait(200+Random(300));
exit; //forgot about this line :(
end;
Wait(200+Random(200));
Until(false);

Added the line I forgot

Zyt3x
02-26-2012, 12:02 PM
turn that "exit; //forgot about this line :(" into "break;" ;)

Also, you might want to edit the mousespeed at the start of the procedure.. I often set mousespeed to something as low as 9 or 10, just to make it look more human-like and here that would look very non-humanlike

Shatterhand
02-26-2012, 12:06 PM
Nice. What do you mean interact? Does it click on anything randomly? Or just hover mouse on something?

putonajonny
02-26-2012, 12:10 PM
turn that "exit; //forgot about this line :(" into "break;" ;)

Also, you might want to edit the mousespeed at the start of the procedure.. I often set mousespeed to something as low as 9 or 10, just to make it look more human-like and here that would look very non-humanlike

Sorry yeah, don't know what I was thinking, added that in as well :)



Nice. What do you mean interact? Does it click on anything randomly? Or just hover mouse on something?

It uses a lot of "Case Random(x) of" functions to do different things, so it might hover over things, right click but not select anything, open up menus have a scroll around and then close them, it even finds a music track you have unlocked and then plays it

Shatterhand
02-26-2012, 04:06 PM
It wont close Friends Chat Setup. Tested this for some minutes, with False it works well.
In Magic tab it keeps moving mouse to center, then right click on a spell.

putonajonny
02-26-2012, 10:55 PM
It wont close Friends Chat Setup. Tested this for some minutes, with False it works well.
In Magic tab it keeps moving mouse to center, then right click on a spell.

I made a slight error with the code on the magic one, had it reducing the value of i each time then ending when i <= 0, but I had written "Until(x <= 0)" not "Until(i <= 0)"

I use the General "CloseWindow" function for the friends chat setup, it must not recognise it

Yago
02-26-2012, 11:31 PM
I'm surprised this wasn't suggested before

Shatterhand
02-27-2012, 05:19 AM
I use the General "CloseWindow" function for the friends chat setup, it must not recognise it
That window is a bit different I think. The X is on different point. Like 20 pixels away.

putonajonny
02-27-2012, 04:04 PM
I'm surprised this wasn't suggested before

Yeah me too, if anybody has any more ideas of antiban I'd be happy to make them


That window is a bit different I think. The X is on different point. Like 20 pixels away.

I have added a DTM for clicking that X, but it would be good if CloseWindow; was updated

Yago
02-27-2012, 08:29 PM
Yeah me too, if anybody has any more ideas of antiban I'd be happy to make them



I have added a DTM for clicking that X, but it would be good if CloseWindow; was updated

There was an MSI thread some time ago in which people suggested many kinds of antiban...

Hero
02-27-2012, 08:45 PM
(*
CloseWindow
~~~~~~~~~~~

.. code-block:: pascal

function CloseWindow: Boolean;

Closes any open windows. (In RS not your pc roflmaololz, j/k)

.. note::

by NaumanAkhlaQ, Narcle, and Nava2
Updated: 12 December 2011 by Coh3n

Example:

.. code-block:: pascal

if (BankScreen) then
CloseWindow();
*)
function CloseWindow: Boolean;
var
Col: TIntegerArray;
b: array[0..1] of TPointArray;
a: T2DPointArray;
Pa: TBox;
i, ii, l, x, y: Integer;
begin
if (CloseBank) then
begin
Result := true;
exit;
end;

// handles the advanced skill guide window
if (findColorTolerance(x, y, 2994428, 728, 8, 753, 30, 20)) then
begin
mouse(x, y, 3, 3, mouse_Left);
result := true;
exit;
end;

Col := [1118997, 1449250, {Main typ 1}
3912691, 1973857, {Quest}
4282212, 2503226, {Main typ 2}
39423, 13567, {Red X}
1514271, 1580837, {Deposit Box}
1383457, 2107437, {Friends Chat Setup}
2928892, 2663150];

for i := 0 to 5 do
begin
FindColorsTolerance(b[0], Col[i * 2], MSCX, MSY1, MSX2, MSCY, 5);
FindColorsTolerance(b[1], Col[i * 2 + 1], MSCX, MSY1, MSX2, MSCY, 5);
l := (High(b[0]) + High(b[1]));

if InRange(l, 6, 53) or InRange(l, 94, 250) then
begin
a := SplitTPA(CombineTPA(b[0], b[1]), 5);
SortATPAFromFirstPoint(a, Point(507, 14));

if (length(a) < 1) then
Continue;

for ii := 0 to high(a) do
begin
Pa := GetTPABounds(a[ii]);
if ((Pa.x2 - Pa.x1) > 50) or ((Pa.y2 - Pa.y1) > 50) then
Continue;

MouseBox(Pa.x1, Pa.y1, Pa.x2, Pa.y2, mouse_move);
if (WaitUptextMulti(['lose', 'ack', 'Cl', 'se'], 300)) then
begin
GetMousePos(Pa.x1, Pa.y1);
Mouse(Pa.x1, Pa.y1, 0, 0, mouse_left);
Result := True;
Exit;
end;
end;
end;
end;
end;


Added the Friends Chat Setup X colors to it so it closes it. Tested it about five times. :P

Shatterhand
02-27-2012, 09:09 PM
Yeah me too, if anybody has any more ideas of antiban I'd be happy to make them
A friend list checker would be pretty good. Scrolling down the list, etc. Im not sure if u already made this. :)

Yago
02-27-2012, 10:19 PM
There was an MSI thread some time ago in which people suggested many kinds of antiban...

After much searching, here is said thread... The main post only has a few ideas, but there are more withing the body of the thread.

Coh3n
03-07-2012, 01:01 AM
Moved to SRL Snippets.

putonajonny
03-07-2012, 04:52 PM
Moved to SRL Snippets.

Do you think this is of a high enough standard to get into the SRL include?

Coh3n
03-07-2012, 07:57 PM
Do you think this is of a high enough standard to get into the SRL include?I think it's nice function, but not really an "include" function. Kind of like the Break Handler stickied in this forum. The include is supposed to aid the scripter, not do everything for them (with the exception of antirandoms). This function is a great antiban function, and people are free to use it, but it's not really fitting for SRL. I hope you understand. :)

BraK
03-07-2012, 08:18 PM
I don't think anti-bans have been apart of SRL ever really. It's always been up to the scripter to include them. Hince why it's something looked for inside member apps.

putonajonny
03-08-2012, 01:08 AM
Ok fair enough, I just hope it gets seen here, the reason I made it is because most scripters seem to just add something like:


procedure Antiban;
begin
Case Random(100) of
0 : BoredHuman;
1 : PickupMouse;
2 : RandomRClick;
//maybe 3-5 more
end;
end;

and seem to think that will be enough to stop them getting banned, I thought that some more antiban could be made to encourage users to use more in their scripts.

I see what you are saying though :)

Coh3n
03-08-2012, 02:42 AM
I'm going to sticky this as people do seem to like it a lot. :)

halgboy_tbc
04-23-2012, 01:36 PM
Thanks for your work on this, it works great.