PDA

View Full Version : chatboxScroll



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;

KeepBotting
08-04-2015, 12:10 PM
A 'block' is a section of code that is grouped together, usually distinguished by whitespace. No matter if you're using Lape or PascalScript, you're still using a Pascal-like language, so .. code-block:: pascal is appropriate.

Basically it just says "hey, look at me, I'm some Pascal code!"

I suppose you could do .. code-block:: c++ or .. code-block:: java or .. code-block:: bash etc

The naming scheme might have something to do with Code::Blocks (http://www.codeblocks.org/)

The Mayor
08-04-2015, 03:35 PM
Nice idea. If it were added to srl, it would be better as a procedure in chatbox.simba

TRSChatBox.scroll(down: boolean; scrolls: Integer);

and then a separate procedure in antiban.simba which uses the above. The code-block pascal is used by sphinx (http://sphinx-doc.org/) to create the SRL documentation (http://docs.villavu.com/srl-6/chatbox.html)

Turpinator
08-04-2015, 05:47 PM
Nice idea. If it were added to srl, it would be better as a procedure in chatbox.simba

TRSChatBox.scroll(down: boolean; scrolls: Integer);

and then a separate procedure in antiban.simba which uses the above. The code-block pascal is used by sphinx (http://sphinx-doc.org/) to create the SRL documentation (http://docs.villavu.com/srl-6/chatbox.html)

Could even go with something like procedure TRSChatBox.scroll(direction: Integer = CB_SCROLL_RANDOM, scrolls: Integer = -1);
And then random chance of up/down, then also if scrolls =-1, then random scrolls (within reason).
or something.

The Mayor
08-05-2015, 02:57 PM
Could even go with something like procedure TRSChatBox.scroll(direction: Integer = CB_SCROLL_RANDOM, scrolls: Integer = -1);
And then random chance of up/down, then also if scrolls =-1, then random scrolls (within reason).
or something.

I can see that working ;)

srlMW
08-10-2015, 06:45 AM
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;