Results 1 to 6 of 6

Thread: chatboxScroll

  1. #1
    Join Date
    Apr 2015
    Location
    FireFox
    Posts
    528
    Mentioned
    10 Post(s)
    Quoted
    227 Post(s)

    Default chatboxScroll

    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
    Simba Code:
    (*
    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);
    *)
    Simba Code:
    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;
    Last edited by srlMW; 08-10-2015 at 06:43 AM. Reason: Updated code
    Scripting with ogLib

  2. #2
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    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
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  3. #3
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Nice idea. If it were added to srl, it would be better as a procedure in chatbox.simba

    Simba Code:
    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 to create the SRL documentation

  4. #4
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    Nice idea. If it were added to srl, it would be better as a procedure in chatbox.simba

    Simba Code:
    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 to create the SRL documentation
    Could even go with something like
    Simba Code:
    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.

  5. #5
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by Turpinator View Post
    Could even go with something like
    Simba Code:
    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

  6. #6
    Join Date
    Apr 2015
    Location
    FireFox
    Posts
    528
    Mentioned
    10 Post(s)
    Quoted
    227 Post(s)

    Default

    Improved version
    Quote Originally Posted by srlMW View Post
    Simba Code:
    (*
    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);
    *)
    Simba Code:
    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;
    Scripting with ogLib

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •