Gametab Backpack

The Backpack file holds functions and procedures that are used in the runescape backpack gametab.

Consts, Types, Vars

The following constants, types and variables are used throughout the collectBox methods.

const Drop Patterns

Constants that represent different drop patterns:

  • DROP_PATTERN_REGULAR
  • DROP_PATTERN_BACKWARDS
  • DROP_PATTERN_SNAKE
  • DROP_PATTERN_UP_DOWN

const Quick Inventory

Constants that represent the two quick inventory slots:

  • QUICK_INVENTORY_A (red)
  • QUICK_INVENTORY_B (blue)

type TRSTabBackpack

type
  TRSTabBackpack = type TRSInterface;

A type that stores the backpack gametab interface properties.

var tabBackpack

var
  tabBackpack: TRSTabBackpack;

A variable through which scripters can access the TRSTabBackpack type methods.

TRSTabBackpack methods

The following methods should be called through the tabBackpack variable.

Example:

if tabBackpack.isOpen() then
  writeln('Backpack is open!');

isOpen

function TRSTabBackpack.open(): boolean;

Returns true if the backPack tab is the currently open tab.

Note

  • by Olly
  • Last Updated: 19 August 2013 by Olly

Example:

if tabBackpack.isOpen() then
  writeln('The Backpack tab is open');

open

function TRSTabBackpack.open(): boolean;

Returns true if it successfully opens the backpack tab (or it’s already open).

Note

  • by Olly
  • Last Updated: 11 March 2013 by Olly

Example:

if tabBackpack.open() then
  writeln('We opened the Backpack tab');

getSlotBoxes

function TRSTabBackpack.getSlotBoxes(): TBoxArray;

Returns a TBoxArray of all 28 backpack slots

Note

  • by Olly
  • Last Updated: 29 October 2013 by Olly

Example:

var
  b: TBoxArray;
begin
  b := tabBackpack.getSlotBoxes();

getSlotBox

function TRSTabBackpack.getSlotBox(slot: integer): tbox;

Returns the TBox of the desired backpack slot.

Note

  • by Olly
  • Last Updated: 29 October 2013 by Olly

Example:

var
  b: TBox;
begin
  b := tabBackpack.getSlotBox(1);

isItemInSlot

function TRSTabBackpack.isItemInSlot(slot: integer; waitTime: integer = 0): boolean;

Returns true if an item is in the backpack slot slot . The optional waitTime parameter (default = 0) can be adjusted to extend the search time.

Note

  • by Olly
  • Last Updated: 9 August 2015 by Thomas

Example:

if tabBackpack.isItemInSlot(1) then
  writeln('We have an item in slot number 1');

pointToSlot

function TRSTabBackpack.pointToSlot(pnt: TPoint): integer;

Returns the backpack slot number the point pnt falls within. If it doesn’t fall within any slot, it returns -1.

Note

  • by Olly
  • Last Updated: 18 August 2013 by Olly

Example:

var
  x, y, myDTM: Integer;
begin
  myDTM := DTMFromString('heapsofstuff');

  if findDTM(myDTM, x, y, tabBackpack.getBounds()) then
    writeLn(Found DTM in slot ' + toStr(tabBackpack.pointToSlot([x, y]));
end;

count

function TRSTabBackpack.count(): integer;

Returns the number of items in the backpack.

Note

  • by Olly
  • Last Updated: 18 August 2013 by Olly

Example:

writeln(tabBackpack.count());

waitCount

function TRSTabBackpack.waitCount(count: integer; waitTime: integer): boolean;

Returns true if the backpack count becomes count within waitTime

Note

  • by Olly
  • Last Updated: 29 July 2013 by Olly

Example:

if tabBackpack.waitCount(28, 1000 + random(500)) then
  writeln('Backpack count is now 28!');

isFull

function TRSTabBackpack.isFull: boolean;

Returns true if the backpack is full.

Note

  • by Olly
  • Last Updated: 15 November 2014 by Ashaman88

Example:

if tabBackpack.isFull() then
  writeln('The backpack is full!');

isEmpty

function TRSTabBackpack.isEmpty: boolean;

Returns true if the backpack is empty.

Note

  • by Olly
  • Last Updated: 29 July 2013 by Olly

Example:

if tabBackpack.isEmpty() then
  writeln('The backpack is empty!');

waitForShift

function TRSTabBackPack.waitForShift(waitTime: integer): boolean;

Returns true if the backpack count changes within waitTime

Note

  • by Olly
  • Last Updated: 29 July 2013 by Olly

Example:

if tabBackpack.waitForShift(5000) then
  writeln('Backpack count has changed!');

waitSlotPixelChange

function TRSTabBackPack.waitSlotPixelChange(slot, waitTime: integer): boolean;

Returns true if the pixels change in backpack slot within waitTime . For example, a raw fish changing to a cooked fish, or an item being consumed.

Note

  • by Olly & Ashaman88
  • Last Updated: 03 January 2013 by Ashaman88 & Olly

Example:

if tabBackpack.waitSlotPixelChange(28, 5000) then
  writeln('Last backpack slot has changed, we''re done!');

mouseSlot

function TRSTabBackpack.mouseSlot(slot, mouseAction: integer = MOUSE_MOVE): boolean;

Returns true if it performs the desired mouseAction at the desired backpack slot

Note

  • by Olly
  • Last Updated: 11 March 2013 by Olly

Example:

if tabBackpack.mouseSlot(1, MOUSE_MOVE) then
  writeln('We moved the mouse to Backpack slot 1');

isSlotActivated

function TRSTabBackpack.isSlotActivated(slot: integer): boolean;

Returns true if the backpack slot slot is activated.

Note

  • by Olly
  • Last Updated: 15 November 2014 by Ashaman88

Example:

if tabBackpack.isSlotActivated(28) then
  writeln('Slot 28 is activated.');

getActivatedSlot

function TRSTabBackpack.getActivatedSlot(): integer;

Returns what slot is activated. If none are it will return -1.

Note

  • by Olly
  • Last Updated: 12 March 2013 by Olly

Example:

var
  i: integer;
begin
  i := getActivatedSlot;

dropItems

procedure TRSTabBackpack.dropItems(slots: TIntegerArray = [1..28]);

Drops items in the TIntegerArray slots (default = [1..28] i.e. all slots) It can also be used with drop pattern constants located at the top of this page.

Note

  • by Olly
  • Last Updated: 29 July 2013 by Olly

Example:

// Drop all slots
tabBackpack.dropItems();

// Drop slots 1, 2, 25, 6
tabBackpack.dropItems([1, 2, 25, 6]);

// Drop all using the snake pattern
tabBackpack.dropItems(DROP_PATTERN_SNAKE);

dropItemsExcept

procedure tabBackpack.dropItemsExcept(ignoreSlots: TIntegerArray; dropPattern: TIntegerArray = DROP_PATTERN_REGULAR);

Drops all items apart from the slots in ignoreSlots . The parameter dropPattern is optional *(default = DROP_PATTERN_REGULAR).

Note

  • by Olly
  • Last Updated: 13 September 2013 by Olly

Example:

const
  AXE_SLOT = 1; // Slot your axe is in

begin
  tabBackpack.dropItemsExcept([AXE_SLOT]);

end;

countDTM

function TRSTabBackpack.countDTM(dtm: integer): integer;

Return the number of backpack slots that contain the DTM dtm

Note

  • by Olly
  • Last Updated: 29 July 2013 by Olly

Example:

var
  dtm: integer;
  i: integer;
begin
  dtm := dtmFromString('lotsofstuffhere');
  i := tabBackpack.countDTM(dtm);
  writeln('We counted ' + intToStr(i) + ' items in our Backpack.');
end;

countBitmap

function TRSTabBackpack.countBitmap(bmp, tolerance: integer): integer;

Return the number of backpack slots that contain the bitmap bmp . It will search with the tolerance tolerance .

Note

  • by Olly
  • Last Updated: 19 August 2013 by Olly

Example:

var
  bmp: integer;
  i: integer;
begin
  bmp := bitmapFromString('lotsofstuffhere');
  i := tabBackpack.countBitmap(bmp);
  writeln('We counted ' + intToStr(i) + ' items in our Backpack.');
end;

clickDTM

function TRSTabBackpack.clickDTM(dtm: integer; clickType: integer; option: string = ''; waitFor: integer = 300; clickAll: boolean = true): integer;

Returns true if it finds and interacts with the DTM DTM

  • dtm : The DTM you want to find
  • clicktype : MOUSE_MOVE, MOUSE_LEFT, MOUSE_RIGHT
  • option : What option to choose. If not using MOUSE_RIGHT this can be left blank. (default = ‘’)
  • waitFor : How long we will wait after interacting with the item (default = 300ms)
  • clickAll : Click all instances of the DTMs found? Otherwise will only click one (default = true)

Note

  • by Olly
  • Last Updated: 26 November 2013 by Coh3n

Example:

// Find and left click an item
tabBackpack.clickDTM(dtm, MOUSE_LEFT);

// Right click DTM, select 'bury' option, wait 1000ms before moving on to the next one
tabBackpack.clickDTM(dtm, MOUSE_RIGHT, 'bury', 1000, true);

dragSlot

function TRSTabBackpack.dragSlot(fromSlot, toSlot: integer): boolean;

Returns true if it drags an item from slot fromSlot to slot toSlot

Note

  • by Olly
  • Last Updated: 25 April 2013 by Olly

Example:

tabBackpack.dragSlot(1, 28);

getMoneyPouchAmount

function TRSTabBackpack.getMoneyPouchAmount(): integer;

Returns how much money is visible in the pouch.

Note

  • by Olly
  • Last Updated: 18 October 2014 by Ashaman88

Example:

writeLn('I have ', toStr(tabBackpack.getMoneyPouchAmount()), ' in my pouch');

getQuickInventorySlot

function TRSTabBackpack.getQuickInventorySlot(quickInvConst: integer): integer;

Returns the backpack slot that is a ‘quick inventory’ slot. The quickInvConst is one of the two constants located at the top of this page

Note

  • by Olly
  • Last Updated: 19 August 2013 by Olly

Example:

tabBackpack.getQuickInventorySlot(QUICK_INVENTORY_A);
tabBackpack.getQuickInventorySlot(QUICK_INVENTORY_B);

setQuickInventorySlot

function TRSTabBackpack.setQuickInventorySlot(slot, quickInvConst: integer): boolean;

Returns true if it siccessfully sets slot as the quick inventory slot based on quickInvConst . The two constants are located at the top of this page.

Note

  • by Olly
  • Last Updated: 19 August 2013 by Olly

Example:

if tabBackpack.setQuickInventorySlot(1, QUICK_INVENTORY_A) then
  writeln('slot 1 is now binded to quick inventory a');

isLocked

function TRSTabBackpack.isLocked(): boolean;

Returns true if the backpack is locked (i.e. directly after closing the bank)

Note

  • by Olly
  • Last Updated: 4th February 2015 by The Mayor

Example:

if tabBackpack.isLocked() then
  writeLn('It''s locked');

waitWhileLocked

function TRSTabBackpack.waitWhileLocked(maxWait: integer = 10000): boolean;

Returns true if the backpack is no longer locked within maxWait

Note

  • by Olly
  • Last Updated: 4th February 2015 by The Mayor

Example:

if bankScreen.clickButton(BANK_BUTTON_PRESET_1) then
  if tabBackpack.waitWhileLocked(5000) then
  begin
    // fletching stuff

  end;