Results 1 to 10 of 10

Thread: hoverXPPopup(); and browseSkillMenu();

  1. #1
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default hoverXPPopup(); and browseSkillMenu();

    Two new functions for antiban, to add a bit of human variety to scripts!

    If your script allows usage of XP Popups without disrupting any mainscreen color searches, then you can call this occasionally to have the player check his or her progress.



    hoverXPPopup(moveAway: boolean = true): boolean;

    Simba Code:
    (*
    hoverXPPopup
    ~~~~~~~~~~~~

    .. code-block:: pascal

        function hoverXPPopup(moveAway: boolean = true);

    If the circular XP tracker is present, this procedure will hover over to check
    your player's skill progress.

    .. note::

        - by Clarity
        - Last Updated: 7th November 2014 by Clarity

    Example:

    .. code-block:: pascal

        hoverXPPopup();
    *)

    function hoverXPPopup(moveAway: boolean = true): boolean;
    var
      popupDTM, x, y: integer;
      finalBox: TBox;
    begin
      print('hoverXPPopup()', TDebug.HEADER);
      result := false;
      popupDTM := DTMFromString('mWAAAAHicY2FgYJgHxAuBeDaUHcHIwBDJCKGjgTjDESjIwMiQEcHAcGg+AwMXAypmRMMgAACX2Qbc');

      if findDTM(popupDTM, x, y, mainscreen.getBounds()) then
      begin
        mouseCircle(x, y - 20, 15, MOUSE_MOVE);

        wait(150 + random(4500));

        if moveAway then
        begin
          finalBox := IntToBox(mainscreen.x1 + 20, mainscreen.y1 + 80, mainscreen.x2 - 20, mainscreen.y2 + 20);
          mouseBox(finalBox, MOUSE_MOVE, MOUSE_HUMAN);
          wait(50 + random(500));
        end;

        result := true;
      end else
        print('hoverXPPopup(): XP Popup was not found.', TDebug.SUB);

      freeDTM(popupDTM);
      print('hoverXPPopup(): result = ' + toStr(result), TDebug.FOOTER);
    end;

    Sometimes players like to look at their new skill unlocks after leveling up, or just in general. Call this function to browse a skill menu of your choice.



    browseSkillmenu(skill: integer; maxScrollAmount: integer = 10): boolean;

    Simba Code:
    (*
    browseSkillMenu
    ~~~~~~~~~~~~~~~

    .. code-block:: pascal

        function browseSkillMenu(skill: integer; maxScrollAmount: integer = 10);

    Clicks on the skill 'skill' and scrolls through its skill information menu.
    Specify the maximum scroll amount via maxScrollAmount.

    .. note::

        - by Clarity
        - Last Updated: 7th November 2014 by Clarity

    Example:

    .. code-block:: pascal

        browseSkillMenu(SKILL_ATTACK, 5);
    *)

    function browseSkillMenu(skill: integer; maxScrollAmount: integer = 10): boolean;
    var
      t, x, y, w, h, k, menuBMP: integer;
    begin
      print('browseSkillMenu()', TDebug.HEADER);
      result := false;
      t := gameTabs.getActiveTab();
      menuBMP := BitmapFromString(53, 4, 'meJyrqaosLC6Fo9SkhOysnKjo2Oy' +
            'YQPngem4fEOJMny9ZuVR/4h69+q1AttGkC9XH761aPn/NunWnls/s' +
            'WrGff8ppoCxQjXr2Al6ffBFNJzFxW3EpBwlpZwXlECCSlvVBRnJKX' +
            'nA2UA0aA1lZDarzgG6DuBDoPKAjWYInwp0HdBuQBCKg8xI3PIc4D+' +
            'JCoALump1At/FnT5D1SBaWsxYRMwM6D9M9QDegOUNM0hpZCq4SwkB' +
            'zGxyBHBkTCAk9oKUQh0EQMKyAzgMG2oxpU4EI6DxgOAPFgY4EMtiM' +
            'wvkE1EXEzJGdB7Ea03ZcshAF8NADugfNeZAAtPeLAAYg0HnILgQGF' +
            'NB5kcuvQQIQSAIVA+MUFHQW8cLaDqLi5lKyDuJSjhDrIPbCbUeLTW' +
            'DUw6XgzoOkByAXACKyxKI=');
      getClientDimensions(w, h);

      if (t <> TAB_STATS) then
        gameTabs.openTab(TAB_STATS);

      mouseBox(tabStats.getSkillBox(skill), MOUSE_LEFT, MOUSE_HUMAN);

      k := (getSystemTime() + 10000);

      repeat
        wait(random(100, 300));
      until findBitmapIn(menuBMP, x, y, 1, 1, w-1, h-1) or (getSystemTime() > k);

      if not findBitmapIn(menuBMP, x, y, 1, 1, w-1, h-1) then
      begin
        print('browseSkillMenu(): Skill menu never opened.', TDebug.SUB);
      end else
      begin
        wait(150 + random(500));
        mouseScroll(point(492 + random(-90, 90), 364 + random(-90, 90)), random(0, maxScrollAmount));
        wait(150 + random(3500));
        repeat
          typeByte(VK_ESCAPE);
          wait(500 + random(500));
        until (not findBitmapIn(menuBMP, x, y, mainscreen.getBounds()));
        result := true;
      end;

      if (t <> TAB_STATS) then
        gameTabs.openTab(t);

      freeBitmap(menuBMP);
      print('browseSkillMenu(): result = ' + toStr(result), TDebug.FOOTER);
    end;

    Hope these are helpful!
    Last edited by Clarity; 11-07-2014 at 06:00 PM.

  2. #2
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    nice! i like specially the skill menu procedure! i haad thought of making something similar but with the Vote screen

  3. #3
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by undorak7 View Post
    nice! i like specially the skill menu procedure! i haad thought of making something similar but with the Vote screen
    If you aren't going to, I'd be happy to make something that votes for a random choice

    Also, regarding hoverXPPopup(); I have discovered that the colors for the DTM change a lot after levelling up, causing it to fail until you get some experience back in the next level. I can't get a good image of this happening so if someone could post a picture for me to recreate the DTM that would be great! (picture of an XP Popup just after levelling)

  4. #4
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    Quote Originally Posted by Clarity View Post
    If you aren't going to, I'd be happy to make something that votes for a random choice
    Go ahead !

  5. #5
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    Nice work Clarity, I'd like to see a failsafe here:

    Simba Code:
    repeat
          typeByte(VK_ESCAPE);
          wait(500 + random(500));
        until (not findBitmapIn(menuBMP, x, y, mainscreen.getBounds()));

    As in the past, I've seen the VK_ESCAPE key fail

    Forum account issues? Please send me a PM

  6. #6
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by Justin View Post
    Nice work Clarity, I'd like to see a failsafe here:

    Simba Code:
    repeat
          typeByte(VK_ESCAPE);
          wait(500 + random(500));
        until (not findBitmapIn(menuBMP, x, y, mainscreen.getBounds()));

    As in the past, I've seen the VK_ESCAPE key fail
    Ah really? Fail as in repeating the command multiple times would do nothing?

  7. #7
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    Quote Originally Posted by Clarity View Post
    Ah really? Fail as in repeating the command multiple times would do nothing?
    Correct, I've seen 'players[currentPlayer].logout();' fail several times, IIRC the logout function will push the ESC key 5 times before returning false

    Forum account issues? Please send me a PM

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

    Default

    Very nice, 10/10 will use.
    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

  9. #9
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    Very nice, 10/10 will use.
    My pleasure

    Quote Originally Posted by Justin View Post
    Correct, I've seen 'players[currentPlayer].logout();' fail several times, IIRC the logout function will push the ESC key 5 times before returning false
    Didn't know that, I'll add a manual mouse click on the X then.
    Also will edit the DTM.

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

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
  •