Results 1 to 3 of 3

Thread: More efficient way to gameTabs.openTab(TAB_BACKPACK)

  1. #1
    Join Date
    May 2012
    Location
    Texas sounds cool.
    Posts
    53
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default More efficient way to gameTabs.openTab(TAB_BACKPACK)

    I seem to be having issues with
    Code:
     gameTabs.openTab(TAB_BACKPACK);
    I'm trying to come up with a new method to replace the include with that will have fewer misclicks. Any ideas?
    ~Always remember that you are absolutely unique.
    Just like everyone else.

  2. #2
    Join Date
    May 2008
    Location
    ;)
    Posts
    576
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I'm assuming you mean SRL-6. The function itself seems like a reasonable place to start:
    Simba Code:
    1. {*
    2. __openViaNavBar
    3. ---------------
    4.  
    5. .. code-block:: pascal
    6.  
    7.     function TRSGameTabs.__openViaNavBar(tab: integer): boolean;
    8.  
    9. Helper function for TRSGametabs.openTab(). Opens the gametab **tab** via the
    10. navigation bar and moves the mouse to close.
    11.  
    12. .. note::
    13.  
    14.     - by Olly
    15.     - Last Updated: 21 November 2013 by Olly
    16.  
    17. Example:
    18.  
    19. .. code-block:: pascal
    20.  
    21.     gameTabs.__openViaNavbar(TAB_BACKPACK);
    22. *}
    23. {$IFNDEF CODEINSIGHT}
    24. function TRSGameTabs.__openViaNavBar(tab: integer): boolean;
    25. var
    26.   p: TPoint;
    27.   b: TBox;
    28. begin
    29.   mouseBox(self.navButtons[self.tabs[tab]._navBarID][0], MOUSE_MOVE); // hover over the nav button
    30.   wait(250 + random(250));
    31.   mouseBox(self.navButtons[self.tabs[tab]._navBarID][self.tabs[tab]._navBarBoxIndex], MOUSE_LEFT, MOUSE_ACCURATE);
    32.   wait(20 + random(200));
    33.  
    34.   b := self.navButtons[self.tabs[tab]._navBarID][0];
    35.  
    36.   if (random(2) = 1) then // move the mouse to the side so the menu closes
    37.     p := point(b.x1 - 8 - random(5), b.y1 + randomRange(-10, 50))
    38.   else
    39.     p := point(b.x2 + 8 + random(5), b.y1 + randomRange(-10, 50));
    40.  
    41.   mouse(p);
    42. end;
    43. {$ENDIF}
    44.  
    45. (*
    46. openTab
    47. -------
    48.  
    49. .. code-block:: pascal
    50.  
    51.     function TRSGameTabs.openTab(tab: integer): boolean;
    52.  
    53. Returns true if it successfully open the gametab **tab**
    54.  
    55. .. note::
    56.  
    57.     - by Coh3n
    58.     - Last Updated: 26 July 2013 by Coh3n
    59.  
    60. Example:
    61.  
    62. .. code-block:: pascal
    63.  
    64.     if gameTabs.openTab(TAB_EQUIPMENT) then
    65.       writeLn('The equipment is open!);
    66. *)
    67. function TRSGameTabs.openTab(tab: integer): boolean;
    68. var
    69.   b: TBox;
    70. begin
    71.   if (not inRange(tab, TAB_TASK, TAB_MUSIC)) then // check tab is vaild
    72.   begin
    73.     print('TRSGameTabs.openTab('+toStr(tab)+'): The tab isnt vaild!, result = ' + toStr(result), TDebug.ERROR);
    74.     exit(false);
    75.   end;
    76.  
    77.   print('TRSGameTabs.openTab('+toStr(tab)+')', TDebug.HEADER);
    78.  
    79.   if (self.isTabActive(tab)) then
    80.   begin
    81.     print('Tab is already open, exiting');
    82.     print('TRSGameTabs.openTab('+toStr(tab)+'): = '+toStr(result), TDebug.FOOTER);
    83.     exit(true);
    84.   end;
    85.  
    86.   if (self.areMultiOpen) then
    87.     if (self.isTabVisible(tab, b)) then
    88.     begin
    89.       print('Tab is already visible, bringing to front');
    90.       mouseBox(b, MOUSE_LEFT);
    91.  
    92.       wait(50 + random(100));
    93.       print('TRSGameTabs.openTab('+toStr(tab)+'): = '+toStr(result), TDebug.FOOTER);
    94.       exit(true);
    95.     end;
    96.  
    97.   print('Opening tab via gametab navigation bar');
    98.   self.__openViaNavBar(tab);
    99.  
    100.   result := self.waitTabActive(tab, 4000 + random(1000));
    101.  
    102.   print('TRSGameTabs.openTab('+toStr(tab)+'): result = '+toStr(result), TDebug.FOOTER);
    103. end;

    Note that I've included two functions. The one you call (openTab) is the lower of the two. That function is almost entirely failsafes. The top function is the one which actually opens the tab.

    I'm not terribly familiar with the RS3 interface anymore, but I would say that brushing up on DTM or bitmap searching would likely be a top notch way to find some arbitrary tab and open it.

    Alternatively, you could try to figure out /why/ these functions are failing. Depending on your use case, this may actually be easier. You can freely modify the SRL include/the gametab.simba file to help with debugging, but remember that any change will affect ALL SRL-6 scripts you run. So make a backup. If you do find the issue, you can contact one of the SRL developers with your suggestion (or ideally, implemented and thoroughly tested fix), and possibly improve SRL for all it's users.

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

    Default

    Simba Code:
    tabBackpack.open();

    That's the simplest way to do it.
    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

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
  •