SRL Archive - RS has been updated.

tabBackpack.isOpen


Bazcrown

2014-03-17 08:26:44

After this morning's update, my scripts for rs3 are having difficulties with the gametabs library I believe

Olly

2014-03-17 10:02:57

Fixed

Bazcrown

2014-03-17 10:21:41

thanks for the reply

Nufineek

2014-03-17 11:20:19

From: Olly
Fixed

I'm not sure why but that doesn't seem that it fixes the problem for me. It opens skills tab for me when I call tabBackpack.Open

Rlp

2014-03-17 11:24:20

From: Nufineek
I'm not sure why but that doesn't seem that it fixes the problem for me


It also doesn't fix it for me either although I have only tested one script.

Ashaman88

2014-03-17 11:37:40

You guys need to wait for the srl update to go through - or manually update it from the github… srl >update

Bazcrown

2014-03-17 11:45:17

I manually downloaded srl-6 via github and overrode the update(seperate tries) and the gametab tab areas being returned are off

Rlp

2014-03-17 11:59:12

I also manually updated it by srl>update.

Although I backed up gametab.simba and backpack.simba and copy and pasted the code from
github and it now seems to be working :D

Thanks Olly and Ashaman88

Olly

2014-03-17 11:59:21

I just tested again and it's working fine for me. :s

{$DEFINE SMART}
{$i srl-6/srl.simba}

begin
smartEnableDrawing := true;
setupSRL();

smartImage.drawBoxes(gameTabs.getTabAreas(), false, clLime);
tabBackpack.open();
end;

-- TRSGameTabs.openTab(2)
---- Tab is already visible, bringing to front
-- TRSGameTabs.openTab(2): = True

Bazcrown

2014-03-17 12:24:22

okay thank you Olly and I apologize, rather than gameTabs.getTabAreas I'm having trouble with tabBackpack.getSlotBoxes

{$DEFINE SMART}
{$i srl-6/srl.simba}
begin
smartEnableDrawing := true;
setupSRL();
smartImage.drawBoxes(tabBackpack.getSlotBoxes(), false, clLime);
end;

Brotein

2014-03-17 12:54:24

Still having issues after updating SRL.
For some reason the tabs are being closed. It will read that the tab isn't open when it is, and when it tries to start either hoverSkill() or randomRClick() it will close that appropriate tab. I can't find anywhere in the debug where such an action occurs. Once it closes this is what happens when ever my antiban procedure tries to do anything with either the skill or backpack tab.

Skill:
[00:04:14]: —- antiBan: Starting…
[00:04:14]: —— WARNING: TRSGametabs.getActiveTab(): There isn't an active tab currently
[00:04:14]: —— TRSGameTabs.openTab(1)
[00:04:14]: ——– Tab is already visible, bringing to front
[00:04:15]: —— TRSGameTabs.openTab(1): = True
[00:04:17]: —— ERROR: TRSGameTabs.openTab(-1): The tab isnt vaild!, result = False
[00:04:17]: ——– Performed hoverSkill() AntiBan
[00:04:17]: —- antiBan: Finished!


Backpack:
[00:03:00]: —- antiBan: Starting…
[00:03:00]: —— WARNING: TRSGametabs.getActiveTab(): There isn't an active tab currently
[00:03:00]: —— TRSGameTabs.openTab(2)
[00:03:00]: ——– Opening tab via gametab navigation bar
[00:03:06]: —— TRSGameTabs.openTab(2): result = False
[00:03:06]: —— TRSGameTabs.openTab(2)
[00:03:06]: ——– Opening tab via gametab navigation bar
[00:03:12]: —— TRSGameTabs.openTab(2): result = False
[00:03:12]: —— ERROR: TRSGameTabs.openTab(-1): The tab isnt vaild!, result = False
[00:03:12]: ——– Performed randomRClickItem() AntiBan
[00:03:12]: —- antiBan: Finished!


On another note, the production screen hovers over the exit button everytime for a good second or 2 before clicking start on productionScreen.clickStart()

Olly

2014-03-17 12:58:40

Think i know the problem, give me a few.

edit: Try now, you will have download srl-6 off github though (or wait an hour for the updater to update).

Brotein

2014-03-17 13:29:31

For however relevant it is, using the following returns the values for mining instead of smithing,
tabStats.getSkillLevel(5);
tabStats.getSkillInfo(5, INFO_REMAINDER);

Olly

2014-03-17 13:54:18

From: Brotein
For however relevant it is, using the following returns the values for mining instead of smithing,
tabStats.getSkillLevel(5);
tabStats.getSkillInfo(5, INFO_REMAINDER);


Update brah!

Bazcrown

2014-03-17 13:56:54

Olly, you're a stud

Gunner

2014-03-17 15:29:28

From: Olly
Update brah!


I'm having a problem with Ashaman's herb script clicking the incorrect inv slot. It seems to be clicking one row above where it's supposed to be. I have changed the script to click inv slot 28 every time, and it is actually clicking 23. No matter what value I change it to, it clicks the inv slot -5, one row above. See the pic below. I have re-downloaded, pasted the github file, updated Simba, SRL and SPS. I don't think this is a script issue because changing values effects the bot, but it's always off by -5 slots.

[ATTACH=CONFIG]23095[/ATTACH]

Olly

2014-03-17 16:00:20

From: Gunner
I'm having a problem with Ashaman's herb script clicking the incorrect inv slot. It seems to be clicking one row above where it's supposed to be. I have changed the script to click inv slot 28 every time, and it is actually clicking 23. No matter what value I change it to, it clicks the inv slot -5, one row above. See the pic below. I have re-downloaded, pasted the github file, updated Simba, SRL and SPS. I don't think this is a script issue because changing values effects the bot, but it's always off by -5 slots.

[ATTACH=CONFIG]23095[/ATTACH]


Im lost, i fixed this error earlier… What does writeln(gameTabs.areMultiOpen()); return?

Gunner

2014-03-17 16:32:13

From: Olly
Im lost, i fixed this error earlier… What does writeln(gameTabs.areMultiOpen()); return?


I'll let you know if you tell me how to find that. Ashaman's script doesn't do debug unless it fails, so I don't know how to get that info for you. I'll be TV-ing my comp from my phone, cuz my daughter has gymnastics now, so if I get it from my phone I'll send it to you, otherwise it'll be a couple hours. Thanks.

Olly

2014-03-17 16:37:06

From: Gunner
I'll let you know if you tell me how to find that. Ashaman's script doesn't do debug unless it fails, so I don't know how to get that info for you. I'll be TV-ing my comp from my phone, cuz my daughter has gymnastics now, so if I get it from my phone I'll send it to you, otherwise it'll be a couple hours. Thanks.



Run this when you can;

{$DEFINE SMART}
{$i srl-6/srl.simba}

begin
setupSRL();
clearDebug();

if (not isLoggedIn()) then
writeln('Run me logged in!');

writeln(gameTabs.areMultiOpen());
end.

And tell me what it says in the debug box :)

Gunner

2014-03-17 17:42:16

This is all im getting when i run that. Sorry no code tags, its pretty tough from my phone lol.

False
– Succesfully freed SMART[4672]
Successfully executed.

Olly

2014-03-17 18:25:42

go to simba/includes/srl-6/lib/interfaces/gametabs and open up gametab.simba, what does line 365 say?

Gunner

2014-03-17 18:30:57

From: Olly
go to simba/includes/srl-6/lib/interfaces/gametabs and open up gametab.simba, what does line 365 say?


Nothing.


360 - begin
result := tpa.getBounds();
incEx(result.y2, 20);
end;
end;
365 -
(*
TRSGameTabs.getTabAreas
~~~~~~~~~~~~~~~~~~~~~~~

370 - .. code-block:: pascal

Ashaman88

2014-03-17 19:27:49

The pot making portion of the herby script is working just fine with the latest commit @Olly;

Olly

2014-03-17 20:55:45

I'm sure people aren't updating their srl's right… It should be in the updater by now.. force a update via that.

Gunner

2014-03-17 21:42:26

From: Olly
I'm sure people aren't updating their srl's right… It should be in the updater by now.. force a update via that.


OK I'll give that a shot again. What was line 365 supposed to say? I just copied and pasted from github after I updated everything.

My last attempt at updating was a clean install, then force a simba update, then update srl and sps. Pasted github, saved, closed and reopened simba. Am I doing something incorrect?

Thanks for the help so far.

Olly

2014-03-17 21:54:32

From: Gunner
OK I'll give that a shot again. What was line 365 supposed to say? I just copied and pasted from github after I updated everything.

My last attempt at updating was a clean install, then force a simba update, then update srl and sps. Pasted github, saved, closed and reopened simba. Am I doing something incorrect?

Thanks for the help so far.


can you like, pastebin me your gametabs.simba file?

Gunner

2014-03-17 23:26:07

From: Olly
can you like, pastebin me your gametabs.simba file?


It looks like gametabs.simba was updated twice today if I'm reading the thread correctly? My gametabs file was 721 lines, and the gametabs file currently on github is 724 lines. I think what may have happened is I downloaded the previous fix from github, perhaps right before you updated it again? IDK for sure but the times listed on github and the times of my original posts on the script thread are right on top of each other. Regardless, I for sure now have the newest gametabs.simba file, the bot is clicking the correct inv slots now, but it's a little fast and sometimes clicks before the bank window closes, but I think that is a script issue, not a bot issue. So here is my current code for my gametabs.simba file.



(*
Gametab
=======

The gametab file holds any global gametab data.

The source for this file can be found `here <https://github.com/SRL/SRL-6/blob/master/lib/interfaces/gametabs/gametab.simba>`_.

*)

{$include_once ../interfaces.simba}
{$include_once ../../core/text.simba}

{$f-}


const
NAV_BUTTON_HERO = 0;
NAV_BUTTON_GEAR = 1;
NAV_BUTTON_POWERS = 2;
NAV_BUTTON_SOCIAL = 3;
NAV_BUTTON_OTHER = 4;

(*
Constant: Tabs
~~~~~~~~~~~~~~

Integer constants that represent each gametab. DO NOT change values unless you
know exactly what you're doing. Each value represents a box in a grid. The
grid starts at the top left at 0, and counts across the rows and ends in the
bottom right of the grid.

Example:

.. code-block:: pascal

gameTabs.openTab(TAB_FRIENDS);
*)
const
TAB_TASK = 0;
TAB_STATS = 1;

TAB_BACKPACK = 2;
TAB_EQUIPMENT = 3;

TAB_PRAYER = 4;
TAB_MAGIC = 5;
TAB_MELEE = 6;
TAB_RANGED = 7;
TAB_DEFENSIVE = 8;

TAB_FRIENDS = 9;
TAB_FRIENDS_CHAT = 10;
TAB_CLAN_CHAT = 11;

TAB_NOTES = 12;
TAB_MUSIC = 13;

{*
type TRSGameTab
~~~~~~~~~~~~~~~

Represents an individual gametab.
*}
type
_TRSGameTab = record
_bmp: integer; // bitmap of the tab (used for switching between tabs)
_navBarID: integer; // the constant representing the nav bar
_navBarBoxIndex: integer; // the index of the box of the nav bar (when it's moused over)
end;

(*
type TRSGameTabs
~~~~~~~~~~~~~~~~

A single type for manipulating the entire gametab system.
*)
type
TRSGameTabs = record(TRSInterface)
tabs: array of _TRSGameTab;
isSetup: boolean;
tabArea: TBox;
__tabSelectionArea: TBox;
navButtons: array [0..7] of TBoxArray;
end;

(*
var gameTabs
~~~~~~~~~~~~

An SRL global variable used to manipulate the gametabs in very general ways.

Example:

.. code-block:: pascal

if (not gameTabs.isTabActive(TAB_BACKPACK)) then
gameTabs.openTab(TAB_BACKPACK);
*)
var
gameTabs: TRSGameTabs;

{$IFNDEF CODEINSIGHT}
procedure TRSGameTabs.__init();
begin
with self do
begin
name := 'RS GameTabs (Navigation)';
ID := ID_INTERFACE_GAMETABS;
parentID := -1;
static := false;
tabArea := [576, 292, 799, 599];
__tabSelectionArea := [581, 296, 796, 319];
isSetup := false;

// TBox[0] is the actual button, the the next are the tab buttons when it's mouse-over'd
self.navButtons[NAV_BUTTON_HERO] := grid(1, 3, 27, 27, 50, 36, point(612, 220));
self.navButtons[NAV_BUTTON_GEAR] := grid(1, 3, 27, 27, 50, 36, point(662, 220));
self.navButtons[NAV_BUTTON_POWERS] := grid(1, 6, 27, 27, 50, 36, point(762, 220));
self.navButtons[NAV_BUTTON_SOCIAL] := grid(1, 4, 27, 27, 50, 36, point(612, 258));
self.navButtons[NAV_BUTTON_OTHER] := grid(1, 3, 27, 27, 50, 36, point(762, 258));
end;
end;
{$ENDIF}

{*
TRSGameTabs.__initTabs
~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

procedure TRSGameTabs.__initTabs();

Inits the gametabs, loads the bitmap, nav button ID and finally the nav box index.

.. note::

- by Coh3n
- Last Updated: 26 July 2013 by Coh3n

Example:

.. code-block:: pascal

addOnTerminate('__freeGameTabs');
*}
{$IFNDEF CODEINSIGHT}
procedure TRSGameTabs.__initTabs();
var
i: integer;
begin
setLength(self.tabs, 14);

with self.tabs[TAB_TASK] do
begin
_bmp := bitmapFromString(10, 4, 'meJyz+vje6uN7hdhGNWU5RwtNIHKx1bczVQciNzsDK7Cs9dmPfOFJUlKSElZO4kEREoEROhYOJnoqQHGIAr51d1jtgmWqJsNFZLx9gYJwLs/EnUAFIJGVJ8X8Q7W15QE4lDKB');
_navBarId := NAV_BUTTON_HERO;
_navBarBoxIndex := 2;
end;

with self.tabs[TAB_STATS] do
begin
_bmp := bitmapFromString(6, 7, 'meJyzsXgszPtBXVU9fg1nwjoQsrF4zMU5V91UBMIFIqACfqF003QOZBE+Ad2sZEG4CDvnCVUToYS1UG5OqgAvT72KMUKBSTaboJi/STo7XETFRBAAw3ol8A==');
_navBarId := NAV_BUTTON_HERO;
_navBarBoxIndex := 1;
end;

with self.tabs[TAB_BACKPACK] do
begin
_bmp := bitmapFromString(3, 8, 'meJxTss0x7d3Co2xpndScv+dpUudq/drpSrY5FrnrgSL8YkHCMrlABlANUAoo7lo5JWHDYaA4J58akARqBCIgAwC+OReT');
_navBarId := NAV_BUTTON_GEAR;
_navBarBoxIndex := 1;
end;

with self.tabs[TAB_EQUIPMENT] do
begin
_bmp := bitmapFromString(3, 12, 'meJzrbKrpbKpJTEnuhDG6+ycvXjIbIrJoYmdRRTWQDWQABYFsIMNSVw8oAmQrKagBGRA2BEG4QI1wE4CM+EhvIANoLADLWjI8');
_navBarId := NAV_BUTTON_GEAR;
_navBarBoxIndex := 2;
end;

with self.tabs[TAB_PRAYER] do
begin
_bmp := bitmapFromString(6, 6, 'meJx7dWHxqwuLP15d8fHayudnF947Ovv52UVfPr6EoM8fXjw+NR8oC+L++QtEQBGgyg+oIu+vLAcq+/T+OZAN0fjszIJbB6c/Ojnv47UVH64uf3p6ARABALyyXGE=');
_navBarId := NAV_BUTTON_POWERS;
_navBarBoxIndex := 1;
end;

with self.tabs[TAB_MAGIC] do
begin
_bmp := bitmapFromString(4, 10, 'meJxb6CS4EIxqbXmvpIsCyYVIIsgkEDlqcEHYsSY8QNI6qVlTnAvITnHVM+3dIiyTa2A/OalztWxCJ79YEJCdkXdFziqIj4tfXtXCUlcPYghQPRABAE1GIYc=');
_navBarId := NAV_BUTTON_POWERS;
_navBarBoxIndex := 2;
end;

with self.tabs[TAB_MELEE] do
begin
_bmp := bitmapFromString(4, 4, 'meJwTF+ScPnnKlz9/Fzz/PmfdFiBjz4mbSanJSbfeZfz4BWS42RtbrzzFNXW3S1SqmCAnANE4Gm4=');
_navBarId := NAV_BUTTON_POWERS;
_navBarBoxIndex := 3;
end;

with self.tabs[TAB_RANGED] do
begin
_bmp := bitmapFromString(2, 8, 'meJyzyFmrpaEpm9CpbBrEbZfNY+HGLxYkoGgAZCuaugFJUUlXYZlcISEDJdscfn4+ABAACfE=');
_navBarId := NAV_BUTTON_POWERS;
_navBarBoxIndex := 4;
end;

with self.tabs[TAB_DEFENSIVE] do
begin
_bmp := bitmapFromString(9, 4, 'meJxLTEkuqqh2dbBkZc2zsXg8YeKtXafufv75G0gmpiR3908GSvGLBRnYT87IuwKXBUotXjIbSAKlgBqBskmdq+umrQYqAApCEEQKiIRlcoEKgIYDAA/lL/8=');
_navBarId := NAV_BUTTON_POWERS;
_navBarBoxIndex := 5;
end;

with self.tabs[TAB_FRIENDS] do
begin
_bmp := bitmapFromString(8, 8, 'meJyrm7a6btrqaftuAVF5x0QLjzTWthimrfVwwajKydUrjwK58lZWQCkgA8KFKJi69wazJCd7tHVS52oIgsg6ufiyeOqwFToC2UATQKi4Rs4qCGI4UNy1cgpEPVwQSALFtcIzlGxzrJOageJALlAQgoB2zVm7FaieR9kSaB1EMRABAFrsUf8=');
_navBarId := NAV_BUTTON_SOCIAL;
_navBarBoxIndex := 1;
end;

with self.tabs[TAB_FRIENDS_CHAT] do
begin
_bmp := bitmapFromString(6, 8, 'meJwzmnLCaMqJ1Pf/THu3sEiKsbbFWH18b7n5qfXZj/xiQYwMDOzR1tan3gJF9GunM5ubsBU6AtUAZWWqJnNEZQDZTFvrgYJABXAukAQioIhsQidQO4QL0rXyFI+yJUQEqAWIgGYCrQAaCxSEIADzcDIO');
_navBarId := NAV_BUTTON_SOCIAL;
_navBarBoxIndex := 2;
end;

with self.tabs[TAB_CLAN_CHAT] do
begin
_bmp := bitmapFromString(7, 9, 'meJyzPvtRv3a6bEIn+9WvQMQzcSdz9STrladS3/+zTmrmiMrgW3cHKMJubmy5+SlQnJGdj9UuGCgCRKzmxkARoBogG6IMJJjWLFM1GcgFmgYXBCKgFUAuBEFsASKgSiAJ5MJFQCbAzIeYBkRAKyD2AhnICADvyUfz');
_navBarId := NAV_BUTTON_SOCIAL;
_navBarBoxIndex := 3;
end;

with self.tabs[TAB_NOTES] do
begin
_bmp := bitmapFromString(8, 6, 'meJxziUr9/PM3BD25cwNI7nv9rXrlUUYGBicXXyAbIgJBQHZ5x0SglLyV1a5Td4Ei818gpOqmrYbomrbvFlwLRAHQQCXbnNRpp5DFIQioOGHDYbg5AP/SZ+c=');
_navBarId := NAV_BUTTON_OTHER;
_navBarBoxIndex := 1;
end;

with self.tabs[TAB_MUSIC] do
begin
_bmp := bitmapFromString(6, 8, 'meJyb/+Jb3bTVTi6+LlGpUZWTkzpXT9t3C8gWExOSV7UAknxc/NUrjwJFgCRQCiILVAkk57/4tu81CEUV1wBVAgWBIkAFQAOBsvJWVkA2UJeSghojAwNQDcQEiAhQPZABQfl7nkIYQO0ANDdHLQ==');
_navBarId := NAV_BUTTON_OTHER;
_navBarBoxIndex := 2;
end;

self.isSetup := true;
addOnTerminate('__freeGameTabs');

for i := 0 to high(self.tabs) do
setBitmapName(self.tabs[i]._bmp, 'Gametab Bitmap['+toStr(i)+']');

print('TRSGameTab.__initTabs(): Setup gametab properties', TDebug.SUB);
end;
{$ENDIF}

{*
__freeGameTabs
~~~~~~~~~~~~~~

.. code-block:: pascal

procedure __freeGameTabs();

Frees all the gametab's bitmaps. Called on script termination.

.. note::

- by Coh3n
- Last Updated: 26 July 2013 by Coh3n

Example:

.. code-block:: pascal

addOnTerminate('__freeGameTabs');
*}
{$IFNDEF CODEINSIGHT}
procedure __freeGameTabs();
var
i: integer;
begin
print('Freeing gametabs bitmaps...');

for i := 0 to high(gameTabs.tabs) do
freeBitmap(gameTabs.tabs[i]._bmp);
end;
{$ENDIF}

(*
TRSGameTabs.getActiveTabArea
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function TRSGameTabs.getActiveTabArea(): TBox;

Returns the TBox of the active tab, will return a nil box if no tabs are active.

.. note::

- by Coh3n
- Last Updated: 26 July 2013 by Coh3n

Example:

.. code-block:: pascal

if (gameTabs.areMultiOpen()) then
writeln('Multiple tabs are open');
*)
function TRSGameTabs.getActiveTabArea(): TBox;
const
COLOR_ACTIVE_TAB = 7037013;
var
b: TBox;
tpa: TPointArray;
begin
if (not self.isSetup) then
self.__initTabs();

b := [gameTabs.__tabSelectionArea.x1, gameTabs.__tabSelectionArea.y1, // top of each gametab area
gameTabs.__tabSelectionArea.x2, gameTabs.__tabSelectionArea.y1 + 5];

result := [-1, -1, -1, -1];

if (findColors(tpa, COLOR_ACTIVE_TAB, b)) then
begin
result := tpa.getBounds();
incEx(result.y2, 20);
end;
end;

(*
TRSGameTabs.areMultiOpen
~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function TRSGameTabs.areMultiOpen(): boolean;

Returns true if more than one tab is open.

.. note::

- by Coh3n
- Last Updated: 26 July 2013 by Coh3n

Example:

.. code-block:: pascal

if (gameTabs.areMultiOpen()) then
writeln('Multiple tabs are open');
*)
function TRSGameTabs.areMultiOpen(): boolean;
var
b: TBox;
begin
b := self.getActiveTabArea();
result := (b.x1 > -1) and (b.y1 > -1) and (b.x2 > -1) and (b.y2 > -1);
end;

(*
TRSGameTabs.getTabAreas
~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function TRSGameTabs.getTabAreas(): TBoxArray;

Returns a TBoxArray of all the gametab tab boxes.

.. note::

- by Coh3n
- Last Updated: 26 July 2013 by Coh3n

Example:

.. code-block:: pascal

if (gameTabs.areMultiOpen()) then
writeln('Multiple tabs are open');
*)
function TRSGameTabs.getTabAreas(): TBoxArray;
const
COLOR_NON_ACTIVE_TAB = 5458491;
var
i: integer;
b, bounds: TBox;
atpa: T2DPointArray;
tpa: TPointArray;
begin
b := [gameTabs.__tabSelectionArea.x1, gameTabs.__tabSelectionArea.y1, // top of each gametab area
gameTabs.__tabSelectionArea.x2, gameTabs.__tabSelectionArea.y1 + 5];

if (findColors(tpa, COLOR_NON_ACTIVE_TAB, b)) then
begin
atpa := clusterTPAEx(tpa, 3, 1);
filterTPAsBetween(atpa, 0, 5);

if (length(atpa) > 0) then
for i := 0 to high(atpa) do
begin
bounds := atpa[i].getBounds();
incEx(bounds.y2, 20);

insert(bounds, result);
end;
end;

b := self.getActiveTabArea();

if (b.x1 <> -1) then
insert(b, result);
end;

(*
TRSGameTabs._findTab
~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function TRSGameTabs._findTab(var p: TPoint; tab: integer; searchBox: TBox): boolean;

Returns true if the gametab 'tab' is found in the 'searchBox'. Sets it's coordinates
to 'p'.

.. note::

- by Coh3n
- Last Updated: 26 July 2013 by Coh3n

Example:

.. code-block:: pascal

if (gameTabs._findTab(p, TAB_BACKPACK, b)) then
begin
writeln('Opening the backpack tab');
mouse(p.rand(5), MOUSE_LEFT);
end;
*)
function TRSGameTabs._findTab(var p: TPoint; tab: integer; searchBox: TBox): boolean;
begin
if (not self.isSetup) then
self.__initTabs();

result := findBitmapToleranceIn(self.tabs[tab]._bmp, p.x, p.y, searchBox, 50);
end;

(*
TRSGameTabs.isTabVisible
~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function TRSGameTabs.isTabVisible(tab: integer; out tabBounds: TBox): boolean;

Searches for the gametab 'tab' to see if it's visible, if found will output the bounds
in 'tabBounds'

.. note::

- by Olly
- Last Updated: 21 November 2013 by Olly

Example:

.. code-block:: pascal

writeln(gameTabs.isTabVisable(TAB_BACKPACK, b));
*)
function TRSGameTabs.isTabVisible(tab: integer; out tabBounds: TBox): boolean;
var
b: TBoxArray;
p: TPoint;
l, i: integer;
begin
b := self.getTabAreas();
l := length(b);

if (length(b) > 0) then
for i := 0 to (l -1) do
if (self._findTab(p, tab, b[i])) then
begin
tabBounds := b[i];
exit(true);
end;
end;

(*
TRSGameTabs.isTabActive
~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function TRSGameTabs.isTabActive(tab: integer): boolean;

Returns true if the gametab 'tab' is active

.. note::

- by Olly
- Last Updated: 21 November 2013 by Olly

Example:

.. code-block:: pascal

writeln(gameTabs.isActiveTab(TAB_BACKPACK));
*)
function TRSGameTabs.isTabActive(tab: integer): boolean;
var
b: TBox;
p: TPoint;
begin
b := self.getActiveTabArea();

if (b.x1 = -1) then
exit(false);

result := self._findTab(p, tab, b);
end;

(*
TRSGameTabs.waitTabActive
~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function TRSGameTabs.waitTabActive(tab: integer; timeOut: integer): boolean;

Waits up to 'timeOut' waiting for the gametab 'tab' to be the active tab

.. note::

- by Olly
- Last Updated: 21 November 2013 by Olly

Example:

.. code-block:: pascal

writeln(gameTabs.waitTabActive(TAB_BACKPACK, 1000));
*)
function TRSGameTabs.waitTabActive(tab: integer; timeOut: integer): boolean;
var
t: integer;
begin
result := false;
t := (getSystemTime() + timeOut);

while (t > getSystemTime()) do
begin
if (self.isTabActive(tab)) then
exit(true);

wait(20 + random(20));
end;
end;

{*
TRSGameTabs.__openViaNavBar
~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function TRSGameTabs.__openViaNavBar(tab: integer): boolean;

Helper function for TRSGametabs.openTab(), Opens the tab via the navigation bar
and moves the mouse to close the mouse-over menu.

.. note::

- by Olly
- Last Updated: 21 November 2013 by Olly

Example:

.. code-block:: pascal

gameTabs.__openViaNavbar(TAB_BACKPACK);
*}
{$IFNDEF CODEINSIGHT}
function TRSGameTabs.__openViaNavBar(tab: integer): boolean;
var
p: TPoint;
b: TBox;
begin
mouseBox(self.navButtons[self.tabs[tab]._navBarID][0], MOUSE_MOVE); // hover over the nav button
wait(250 + random(250));
mouseBox(self.navButtons[self.tabs[tab]._navBarID][self.tabs[tab]._navBarBoxIndex], MOUSE_LEFT, MOUSE_ACCURATE);
wait(20 + random(200));

b := self.navButtons[self.tabs[tab]._navBarID][0];

if (random(2) = 1) then // move the mouse to the side so the menu closes
p := point(b.x1 - 8 - random(5), b.y1 + randomRange(-10, 50))
else
p := point(b.x2 + 8 + random(5), b.y1 + randomRange(-10, 50));

mouse(p);
end;
{$ENDIF}

(*
TRSGameTabs.openTab
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function TRSGameTabs.openTab(tab: integer): boolean;

Will attempt to open the gametab 'tab'.

.. note::

- by Coh3n
- Last Updated: 26 July 2013 by Coh3n

Example:

.. code-block:: pascal

if (gameTabs._findTab(p, TAB_BACKPACK, b)) then
begin
writeln('Opening the backpack tab');
mouse(p.rand(5), MOUSE_LEFT);
end;
*)
function TRSGameTabs.openTab(tab: integer): boolean;
var
b: TBox;
begin
if (not inRange(tab, TAB_TASK, TAB_MUSIC)) then // check tab is vaild
begin
print('TRSGameTabs.openTab('+toStr(tab)+'): The tab isnt vaild!, result = '+toStr(result), TDebug.ERROR);
exit(false);
end;

print('TRSGameTabs.openTab('+toStr(tab)+')', TDebug.HEADER);

if (self.isTabActive(tab)) then
begin
print('Tab is already open, exiting');
result := true;
print('TRSGameTabs.openTab('+toStr(tab)+'): = '+toStr(result), TDebug.FOOTER);
exit;
end;

if (self.areMultiOpen) then
if (self.isTabVisible(tab, b)) then
begin
print('Tab is already visible, bringing to front');
mouseBox(b, MOUSE_LEFT);

wait(50 + random(100));
result := true;
print('TRSGameTabs.openTab('+toStr(tab)+'): = '+toStr(result), TDebug.FOOTER);
exit;
end;

print('Opening tab via gametab navigation bar');
self.__openViaNavBar(tab);

result := self.waitTabActive(tab, 4000 + random(1000));

print('TRSGameTabs.openTab('+toStr(tab)+'): result = '+toStr(result), TDebug.FOOTER);
end;

(*
TRSGameTabs.getActiveTab
~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function TRSGameTabs.getActiveTab(): integer;

Returns the active tab, returns the id of the constant

.. note::

- by Coh3n
- Last Updated: 26 July 2013 by Coh3n

Example:

.. code-block:: pascal

if (gameTabs.getActiveTab() = TAB_BACKPACK) then
writeln('Backpack is open');
*)
function TRSGameTabs.getActiveTab(): integer;
var
b: TBox;
i: integer;
p: TPoint;
begin
result := -1;
b := self.getActiveTabArea();

if (b.x1 = -1) then
begin
print('TRSGametabs.getActiveTab(): There isn''t an active tab currently', TDebug.WARNING);
exit;
end;

for i := 0 to high(self.tabs) do
if (self._findTab(p, i, b)) then
exit(i);

print('TRSGametabs.getActiveTab(): Didn''t find any bitmap matches', TDebug.WARNING);
end;

begin
gameTabs.__init();
end;


I really appreciate you taking the time all day to help me out, even though it looks like it was pretty much all on my end. I'll hit up Ashaman about the quick clicks and go from there. However if you do find something out of line in the code above let me know. Thanks again Olly.

Hadley

2014-03-17 23:36:16

From: Gunner
It looks like gametabs.simba was updated twice today if I'm reading the thread correctly? My gametabs file was 721 lines, and the gametabs file currently on github is 724 lines. I think what may have happened is I downloaded the previous fix from github, perhaps right before you updated it again? IDK for sure but the times listed on github and the times of my original posts on the script thread are right on top of each other. Regardless, I for sure now have the newest gametabs.simba file, the bot is clicking the correct inv slots now, but it's a little fast and sometimes clicks before the bank window closes, but I think that is a script issue, not a bot issue. So here is my current code for my gametabs.simba file.

I really appreciate you taking the time all day to help me out, even though it looks like it was pretty much all on my end. I'll hit up Ashaman about the quick clicks and go from there. However if you do find something out of line in the code above let me know. Thanks again Olly.

I just copied and saved over the gamestab with this code (724 lines version) and now mine is working properly again too. I had just got home about 45 mins ago and tried manually updating SRL but had no luck, but now everything works fine.

Gunner

2014-03-17 23:43:39

From: Hadley
I just copied and saved over the gamestab with this code (724 lines version) and now mine is working properly again too. I had just got home about 45 mins ago and tried manually updating SRL but had no luck, but now everything works fine.


Glad it's working for you. I'm still struggling with the script clicking too quickly while the inventory is still locked, but that should be easy enough to fix. At least now it's clicking the correct slots.

Hadley

2014-03-17 23:56:05

From: Gunner
Glad it's working for you. I'm still struggling with the script clicking too quickly while the inventory is still locked, but that should be easy enough to fix. At least now it's clicking the correct slots.


Locked as in your interface is locked or something else?

Gunner

2014-03-18 00:09:51

From: Hadley
Locked as in your interface is locked or something else?


No, the lock that is over the inventory when the bank window is open. It hangs around for a couple milliseconds after the bank window closes, and the script is sometimes clicking on the inventory while it is still locked. So nothing actually happens until it re-opens the bank and tries again. About 50% of the time the lock gets out of the way before the script clicks.