# Amount¶

The Amount include contains all kinds of functions to get the amount of items. Items can be in your bank or in your inventory.

```function TradeScreen: Integer;
```

Returns 1 if the first trade screen is open, 2 if the second, and 0 if neither is open.

Note

Example:

```if (TradeScreen > 0) then
```

## ShopScreen¶

```Function ShopScreen : Boolean;
```

Returns true if the shop screen is open.

Note

Example:

```if (ShopScreen) then
writeln('Shop screen is open!');
```

## FindItemEx¶

```function FindItemEx(var x, y: Integer; IdentType: string; Ident: Integer; Area: TBox; Tol: TIntegerArray): Boolean;
```

Finds an item in a specified box (Area). Returns its coordinates (x, y). Valid IdentTypes are:

The Tol variable is:

Tol[0] : Color Tolerance; Tol[1] : Contour Tolerance or minimum Colors to Find to be True.

Note

Example:

```var
x, y: Integer;
b: TBox;
begin
b:= IntToBox(MIX1, MIY1, MIX2, MIY2);
if (FindItemEx(x,y, 'bmp, the_bmp, b, [4])) then
Mouse(x, y, 5, 5, true);
end;
```

## FindItem¶

```function FindItem(var x, y: Integer; IdentType: string; Ident: Integer; x1, y1, x2, y2: Integer; Tol: TIntegerArray): Boolean;
```

This function is exactly the same as FindItemEx except it takes integer coordinates (x1, y1, x2, y2) rather than an TBox.

Note

Example:

```var
x, y: Integer;
begin
if (FindItem(x,y, 'bmp, the_bmp, MIX1, MIY1, MIX2, MIY2, [4])) then
Mouse(x, y, 5, 5, true);
end;
```

## GetAmountBox¶

```function GetAmountBox(box: TBox): integer;
```

Returns the amount of an item at in the box ‘box’. Returns approximate values for ‘K’ and ‘M’.

Note

Example:

```var
i: Integer;
begin
i := GetAmountBox(InvBox(1)); // Gets the amount in inventory slot 1
Writeln('Amount = '+toStr(i));
end;
```

## GetAmount¶

```function GetAmount(x, y: integer): integer;
```

Returns the amount of an item at inventory coordinates (x, y).

Note

Author: Coh3n

Example:

```var
amount, x, y: integer;

begin
if (findDTM(x, y, dtm_Hatchet, MIX1, MIY1, MIX2, MIY2)) then
begin
amount := GetAmount(x, y);
writeln('amount: '+toStr(amount));
end;
end;
```

## AreaInfo¶

```procedure AreaInfo(area: String; var startx, starty, rowsize, colsize, colnumber, rownumber: Integer);
```

Returns information on certain interfaces. Valid interfaces (area):

• ‘inv’
• ‘inventory’
• ‘bank’
• ‘shop’
• ‘deposit box’

Note

Example:

```var
info: array[0..5] of integer;
begin
AreaInfo('inv', info[0], info[1], info[2], info[3], info[4], info[5]);
end;
```

## CheckArea¶

```function CheckArea(area: String): Boolean;
```

Checks if the given area is opened.

Note

Example:

```if (CheckArea('shop')) then
WriteLn('Shop is open!');
```

## ItemCoordinates¶

```function ItemCoordinates(Area, ItemType: string; Item, Tol: TIntegerArray): TPointArray;
```

Returns a TPA with the positions of all occurances of the item. Parameters:

Tol:
‘dtm’ - [] (dtm’s can’t have tolerance). ‘bmp’ - [BMPTol]. ‘color’ - [COLOUR Tol, Minimum Colour Count]. ‘bmpmask’ - [BMPTol, ContourTol].

Note

Example:

```if (Length(ItemCoordinates('inv', 'dtm', dtm_Hatchet, []) > 0) then
Writeln('Hatchet found!');
```

## CountItemsIn¶

```function CountItemsIn(Area, ItemType: string; Item: Integer; Tol: TIntegerArray): Integer;
```

Counts the number of items found within the Area (does not count stacks). Parameters are exactly the same as ItemCoordinates.

Note

Example:

```var
itemsFound: integer;
begin
itemsFound := CountItemsIn('inv', 'dtm', dtm_Ore, []);
writeln('Ore found: ' + toStr(itemsFound));
end;
```

## CountItemsArea¶

```function CountItemsArea(area: string): Integer;
```

Counts the number of items (no matter which item) found in the given area. Looks for the black outline color.

Note

Example:

```var
itemsFound: integer;
begin
itemsFound := CountItemsArea('inv');
writeln('Items found: '+toStr(itemsFound));
end;
```

## ItemAmount¶

```function ItemAmount(area, ItemType: string; Item: Integer; Tol: TIntegerArray): Integer;
```

Counts the number of items found within the Area (counts stacks). Parameters are exactly the same as ItemCoordinates.

Note

Example:

```var
itemsFound: integer;
begin
itemsFound := ItemAmount('inv', 'dtm', dtm_Ore, []);
writeln('Ore found: '+toStr(itemsFound));
end;
```

## FindCoins¶

```function FindCoins(var X, Y: Integer; Area: string): Boolean;
```

Returns true if coins are found in the given area (Area). If found, stores their coordinates in X, Y.

Note

Example:

```var
x, y: integer;
begin
if (FindCoins(x, y, 'inv')) then
WriteLn('Coins found: '+toStr(GetAmount(x, y)));
end;
```

## CoinAmount¶

```function CoinAmount(Area: string): Integer;
```

Returns the amount of coins found in the given area.

Note

Example:

```WriteLn('Coins found: '+toStr(CoinAmount('inv')));
```

## RuneAmount¶

```function RuneAmount(area, runetype: String): Integer;
```

Returns the amount of a certain rune in the specified area.

Note

Example:

```WriteLn('Air runes found: '+toStr(RuneAmount('inv', 'air')));
```

## ShopSwitchTab¶

```procedure ShopSwitchTab(Name: string);
```

Switches the shop tab to the one you want, only moves mouse if neccessary. Valid arguments are:

• ShopSwitchTab(‘main’)
• ShopSwitchTab(‘player’)

Note

```ShopSwitchTab('main');