SRL Archive - Research & Development Lounge

A_MouseAntiBan; // Mouse Antiban! :)


Aaronator

2009-10-09 19:32:46

I made a function that will could be used in scripts to move the mouse randomly, just like a human would :).

C+P it into scar, and press run a few times.


program New;
{.include srl/srl.scar}

function A_MouseAntiBan: boolean;
var
x,y,i,t, n ,b,xx,yy,normalspeed: integer;
f1,f2,f3,f4:boolean;
begin
f1 := false;
f2 := false;
f3 := false;
f4 := false;
normalspeed := mousespeed;
for b := 0 to randomrange(1,3) do
begin
mousespeed := normalspeed + randomrange(5,20);
mmouse(mscx,mscy,380,380);
GetMousePos(x,y);
case random(4) of
0: f1 := true;
1: f2 := true;
2: f3 := true;
3: f4 := true;
end;
if f1 then
begin
for i := 0 to 10 do
begin
MMouse(x - randomrange(4,20), y - randomrange(4,10), 0, 0);
GetMousePos(x,y);
wait(randomrange(10,25));
end;
end;
if f2 then
begin
for i := 0 to 10 do
begin
MMouse(x + randomrange(4,20), y + randomrange(4,20), 0, 0);
GetMousePos(x,y);
wait(randomrange(10,25));
end;
end;
if f3 then
begin
for i := 0 to 10 do
begin
MMouse(x + randomrange(4,20), y - randomrange(4,20), 0, 0);
GetMousePos(x,y);
wait(randomrange(10,25));
end;
end;
if f4 then
begin
for i := 0 to 10 do
begin
MMouse(x - randomrange(4,20), y + randomrange(4,20), randomrange(0,1), randomrange(0,1));
GetMousePos(x,y);
wait(randomrange(10,25));
end;
end;
end;
MouseSpeed := NormalSpeed;
result := true;
end;

begin
setupsrl;
if A_MouseAntiBan then
writeln('Inc(MouseAntibans);');
end.

I would appreciate ALL Comments good and bad on how i can improve.;)

Awkwardsaw

2009-10-09 20:00:46

wow, i thought you took one of my mouse procedures from my includes for a second XD

procedure A_MMVector(vector : tpointarray; rx, ry: integer);
var v, x, y: integer;
begin
for v:= 0 to high(vector) do
begin
getmousepos(x, y);
mmouse(x + vector[v].x, y + vector[v].y, rx, ry);
end;
end;

procedure A_ClickMistake(x, y, rx, ry: integer; left: boolean);
var
b, c: Integer;
begin
MMouse(x, y, rx, ry);
Wait(60 + Random(30));
GetMousePos(b, c);
if left then
begin
mouse(b, c, 0, 0, false)
repeat
Wait(20 + Random(30));
c := c + 1;
until (c > 4);
mmouse(b, c, (25 + random(5)), (25 + random(5)));
mouse(b, c, 0, 0, left);
end else
begin
mouse(b, c, 0, 0, true);
wait(10 + random(50));
mouse(b, c, 0, 0, left);
end;
end;

ontopic: it actually looks pretty good, but not that very useful tbh :o. there are some stuff that can be fix'd, but unfortunately i'm to lazy to explain on what it is :( but its all really just technique that you get from scripting for a while, so it will come :)

Aaronator

2009-10-09 20:03:27

From: Awkwardsaw
wow, i thought you took one of my mouse procedures from my includes for a second XD

procedure A_MMVector(vector : tpointarray; rx, ry: integer);
var v, x, y: integer;
begin
for v:= 0 to high(vector) do
begin
getmousepos(x, y);
mmouse(x + vector[v].x, y + vector[v].y, rx, ry);
end;
end;

procedure A_ClickMistake(x, y, rx, ry: integer; left: boolean);
var
b, c: Integer;
begin
MMouse(x, y, rx, ry);
Wait(60 + Random(30));
GetMousePos(b, c);
if left then
begin
mouse(b, c, 0, 0, false)
repeat
Wait(20 + Random(30));
c := c + 1;
until (c > 4);
mmouse(b, c, (25 + random(5)), (25 + random(5)));
mouse(b, c, 0, 0, left);
end else
begin
mouse(b, c, 0, 0, true);
wait(10 + random(50));
mouse(b, c, 0, 0, left);
end;
end;

ontopic: it actually looks pretty good, but not that very useful tbh :o. there are some stuff that can be fix'd, but unfortunately i'm to lazy to explain on what it is :( but its all really just technique that you get from scripting for a while, so it will come :)


Do you mind explaining what you mean?

Awkwardsaw

2009-10-09 20:09:18

as in, nit-picking some random stuff that no one really cares about, if its right or wrong :)

function A_MouseAntiBan: boolean;
var
x, y, i : integer; //got rid of unneeded variables
f1, f2, f3, f4 : boolean;
begin
//you dont need to set all the booleans to false, its false by default
for b := 0 to randomrange(1, 3) do
begin
mousespeed := randomrange(5, 20);//mousespeed is usually always 7-8, and 1 by default. no real need for
//normalspeed
mmouse(mscx, mscy, 380, 380);
GetMousePos(x, y);
case random(4) of
0: f1 := true;
1: f2 := true;
2: f3 := true;
3: f4 := true;
end;
if f1 then
begin
for i := 0 to 10 do
begin
MMouse(x - randomrange(4, 20), y - randomrange(4, 10), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
end;
end;
if f2 then
begin
for i := 0 to 10 do
begin
MMouse(x + randomrange(4, 20), y + randomrange(4, 20), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
end;
end;
if f3 then
begin
for i := 0 to 10 do
begin
MMouse(x + randomrange(4, 20), y - randomrange(4, 20), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
end;
end;
if f4 then
begin
for i := 0 to 10 do
begin
MMouse(x - randomrange(4, 20), y + randomrange(4, 20), randomrange(0, 1), randomrange(0, 1));
GetMousePos(x, y);
wait(randomrange(10, 25));
end;
end;
end;
MouseSpeed := NormalSpeed;
result := true;
end;

also fixed some standards, nothing big, just habit :p

also also, sorry if i'm a bit harsh, i really try not to be

Aaronator

2009-10-09 20:15:07

From: Awkwardsaw
as in, nit-picking some random stuff that no one really cares about, if its right or wrong :)

function A_MouseAntiBan: boolean;
var
x, y, i : integer; //got rid of unneeded variables
f1, f2, f3, f4 : boolean;
begin
//you dont need to set all the booleans to false, its false by default
for b := 0 to randomrange(1, 3) do
begin
mousespeed := randomrange(5, 20);//mousespeed is usually always 7-8, and 1 by default. no real need for
//normalspeed
mmouse(mscx, mscy, 380, 380);
GetMousePos(x, y);
case random(4) of
0: f1 := true;
1: f2 := true;
2: f3 := true;
3: f4 := true;
end;
if f1 then
begin
for i := 0 to 10 do
begin
MMouse(x - randomrange(4, 20), y - randomrange(4, 10), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
end;
end;
if f2 then
begin
for i := 0 to 10 do
begin
MMouse(x + randomrange(4, 20), y + randomrange(4, 20), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
end;
end;
if f3 then
begin
for i := 0 to 10 do
begin
MMouse(x + randomrange(4, 20), y - randomrange(4, 20), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
end;
end;
if f4 then
begin
for i := 0 to 10 do
begin
MMouse(x - randomrange(4, 20), y + randomrange(4, 20), randomrange(0, 1), randomrange(0, 1));
GetMousePos(x, y);
wait(randomrange(10, 25));
end;
end;
end;
MouseSpeed := NormalSpeed;
result := true;
end;

also fixed some standards, nothing big, just habit :p


As far as i know, that would not compile(cause on the third to last line, there is NO normalline anymore in your version). Normal speed was used to set the mouse speed back to the way it was. I thought it was better that way.

Now i know that the booleans are false by default. Thanks.

Was my standards that i used "acceptable" ?

BobboHobbo

2009-10-09 20:56:44

Yeah, there acceptable, like yours you can read some people do like 6 spaces after the begins, looks bad.

Overall not bad func xD.

Aaronator

2009-10-09 21:01:52

From: BobboHobbo
Yeah, there acceptable, like yours you can read some people do like 6 spaces after the begins, looks bad.

Overall not bad func xD.


Thanks for the comment ;)

Any ideas of what i should make next?

rogeruk

2009-10-09 21:07:27

Dont think there was anything to do with the standards. But since we are on the topic of standard… Rahh!

Program New;
{.include srl/srl.scar}

Function A_MouseAntiBan: Boolean;
Var
x, y, i, t, n, b, xx, yy, normalspeed: Integer;
f1, f2, f3, f4: Boolean;
Begin
f1 := False;
f2 := False;
f3 := False;
f4 := False;
normalspeed := mousespeed;
For b := 0 To randomrange(1, 3) Do
Begin
mousespeed := normalspeed + randomrange(5, 20);
mmouse(mscx, mscy, 380, 380);
GetMousePos(x, y);
Case Random(4) Of
0: f1 := True;
1: f2 := True;
2: f3 := True;
3: f4 := True;
End;
If f1 Then
Begin
For i := 0 To 10 Do
Begin
MMouse(x - randomrange(4, 20), y - randomrange(4, 10), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
End;
End;
If f2 Then
Begin
For i := 0 To 10 Do
Begin
MMouse(x + randomrange(4, 20), y + randomrange(4, 20), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
End;
End;
If f3 Then
Begin
For i := 0 To 10 Do
Begin
MMouse(x + randomrange(4, 20), y - randomrange(4, 20), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
End;
End;
If f4 Then
Begin
For i := 0 To 10 Do
Begin
MMouse(x - randomrange(4, 20), y + randomrange(4, 20),
randomrange(0, 1), randomrange(0, 1));
GetMousePos(x, y);
wait(randomrange(10, 25));
End;
End;
End;
MouseSpeed := NormalSpeed;
Result := True;
End;

Begin
setupsrl;
If A_MouseAntiBan Then Writeln('Inc(MouseAntibans);');
End.

Aaronator

2009-10-09 21:08:53

From: rogeruk
Dont think there was anything to do with the standards. But since we are on the topic of standard… Rahh!

Program New;
{.include srl/srl.scar}

Function A_MouseAntiBan: Boolean;
Var
x, y, i, t, n, b, xx, yy, normalspeed: Integer;
f1, f2, f3, f4: Boolean;
Begin
f1 := False;
f2 := False;
f3 := False;
f4 := False;
normalspeed := mousespeed;
For b := 0 To randomrange(1, 3) Do
Begin
mousespeed := normalspeed + randomrange(5, 20);
mmouse(mscx, mscy, 380, 380);
GetMousePos(x, y);
Case Random(4) Of
0: f1 := True;
1: f2 := True;
2: f3 := True;
3: f4 := True;
End;
If f1 Then
Begin
For i := 0 To 10 Do
Begin
MMouse(x - randomrange(4, 20), y - randomrange(4, 10), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
End;
End;
If f2 Then
Begin
For i := 0 To 10 Do
Begin
MMouse(x + randomrange(4, 20), y + randomrange(4, 20), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
End;
End;
If f3 Then
Begin
For i := 0 To 10 Do
Begin
MMouse(x + randomrange(4, 20), y - randomrange(4, 20), 0, 0);
GetMousePos(x, y);
wait(randomrange(10, 25));
End;
End;
If f4 Then
Begin
For i := 0 To 10 Do
Begin
MMouse(x - randomrange(4, 20), y + randomrange(4, 20),
randomrange(0, 1), randomrange(0, 1));
GetMousePos(x, y);
wait(randomrange(10, 25));
End;
End;
End;
MouseSpeed := NormalSpeed;
Result := True;
End;

Begin
setupsrl;
If A_MouseAntiBan Then Writeln('Inc(MouseAntibans);');
End.


Some one once told me not to capitilize bold words? Is this true?

rogeruk

2009-10-09 21:10:44

Some people do, some people dont. I think its better standards.

Correct spacings and neatness thats all you need really. Eg, False instead of false. x, y, a instead of x,y, a

Aaronator

2009-10-09 21:12:38

From: rogeruk
Some people do, some people dont. I think its better standards.

Correct spacings and neatness thats all you need really. Eg, False instead of false. x, y, a instead of x,y, a


Ahh, thank you for clarifying. Do you have any ideas of what i should make next?

BobboHobbo

2009-10-09 21:58:45

Make some sort of script which includes banking and apply for members :).

Aaronator

2009-10-09 22:11:12

From: BobboHobbo
Make some sort of script which includes banking and apply for members :).


Willow Cutter? Or is that made too often?

Rick

2009-10-09 23:42:37

It doesn't matter if it's made to often, if you fancy making a Willow Cutter then go for it ! :)
Nice job on the function, and please do not capitalize bold words :p

Official Scripting Standards, However, it is up to you on what you feel looks better.

rogeruk

2009-10-10 08:02:30

From: r!ch!e
It doesn't matter if it's made to often, if you fancy making a Willow Cutter then go for it ! :)
Nice job on the function, and please do not capitalize bold words :p

Official Scripting Standards, However, it is up to you on what you feel looks better.


Official SCAR Scripting Standards not SRL Standards :)

Tniffoc

2009-10-10 19:25:46

Some people capitalize bold words. I, however, am not a fan of it.