srlMW
08-04-2015, 08:21 AM
Whipped up this code for a small antiban feature, although it can be used for other purposes. There isn't really need to go into detail as it's pretty self explanatory below. I'm not sure if I've used the correct format but here it is! :)
PS. What does it mean when it says "code-block:: Pascal", because I wasn't sure if I was meant to change it to Lape or not.
Improved version
(*
chatboxScroll
~~~~~~~~~~~~~~~~
.. code-block:: pascal
procedure chatboxScroll(maxScroll: integer; multiples: boolean);
Hovers over the chatbox, scrolls up between 0 and maxScroll then waits random, then scrolls
back down with small extra for human likeness. If true will have the chance of scrolling up
multiple times.
.. note::
- by srlMW
- Last Updated: 5 August 2015 by srlMW
Example:
.. code-block:: pascal
chatboxScroll(10, true);
*)procedure chatboxScroll(maxScroll: integer; multiples: boolean);
var
chatboxx: TBox;
chatboxxPoint: TPoint;
scrollUp, scrollDown, i, minTime, maxTime, minScroll: integer;
q: boolean;
begin
minTime := 0;
maxTime := 5000;
minScroll := 0;
chatBox.__setup();
chatboxx := chatBox.getChatArea();
chatboxxPoint := chatboxx.getRandomPoint();
scrollUp := randomRange(minScroll, maxScroll);
scrollDown := (scrollUp + random(1, 2));
i := 0;
case random(50) of
0..40: mouse(chatboxxPoint, MOUSE_MOVE, MOUSE_HUMAN);
41..50:
begin
missMouse(chatboxxPoint);
wait(randomRange(0, 50));
mouse(chatboxxPoint, MOUSE_MOVE, MOUSE_HUMAN);
end;
end;
mouseScroll(chatboxxPoint, scrollUp, false);
wait(randomRange(minTime, maxTime));
if (multiples = true) then
case random(10) of
0..10:
begin
(q := true);
repeat
mouseScroll(chatboxxPoint, scrollUp, false);
wait(randomRange(minTime, maxTime));
inc(i);
case random(100) of
0..30:(q := false);
end;
until (q = false);
mouseScroll(chatboxxPoint, (scrollDown * (i + 1)), true);
wait(randomRange(0, 50));
print('Completed chatboxScroll()', TDebug.SUB);
exit;
end;
end;
mouseScroll(chatboxxPoint, scrollDown, true);
wait(randomRange(0, 50));
print('Completed chatboxScroll()', TDebug.SUB);
end;
PS. What does it mean when it says "code-block:: Pascal", because I wasn't sure if I was meant to change it to Lape or not.
Improved version
(*
chatboxScroll
~~~~~~~~~~~~~~~~
.. code-block:: pascal
procedure chatboxScroll(maxScroll: integer; multiples: boolean);
Hovers over the chatbox, scrolls up between 0 and maxScroll then waits random, then scrolls
back down with small extra for human likeness. If true will have the chance of scrolling up
multiple times.
.. note::
- by srlMW
- Last Updated: 5 August 2015 by srlMW
Example:
.. code-block:: pascal
chatboxScroll(10, true);
*)procedure chatboxScroll(maxScroll: integer; multiples: boolean);
var
chatboxx: TBox;
chatboxxPoint: TPoint;
scrollUp, scrollDown, i, minTime, maxTime, minScroll: integer;
q: boolean;
begin
minTime := 0;
maxTime := 5000;
minScroll := 0;
chatBox.__setup();
chatboxx := chatBox.getChatArea();
chatboxxPoint := chatboxx.getRandomPoint();
scrollUp := randomRange(minScroll, maxScroll);
scrollDown := (scrollUp + random(1, 2));
i := 0;
case random(50) of
0..40: mouse(chatboxxPoint, MOUSE_MOVE, MOUSE_HUMAN);
41..50:
begin
missMouse(chatboxxPoint);
wait(randomRange(0, 50));
mouse(chatboxxPoint, MOUSE_MOVE, MOUSE_HUMAN);
end;
end;
mouseScroll(chatboxxPoint, scrollUp, false);
wait(randomRange(minTime, maxTime));
if (multiples = true) then
case random(10) of
0..10:
begin
(q := true);
repeat
mouseScroll(chatboxxPoint, scrollUp, false);
wait(randomRange(minTime, maxTime));
inc(i);
case random(100) of
0..30:(q := false);
end;
until (q = false);
mouseScroll(chatboxxPoint, (scrollDown * (i + 1)), true);
wait(randomRange(0, 50));
print('Completed chatboxScroll()', TDebug.SUB);
exit;
end;
end;
mouseScroll(chatboxxPoint, scrollDown, true);
wait(randomRange(0, 50));
print('Completed chatboxScroll()', TDebug.SUB);
end;