SwagDaddy
2012-12-31 15:47:42
How do you count stack-able items in your inventory? Like for me I want to count water runes in inventory.
2012-12-31 15:47:42
2012-12-31 15:54:00
(*
ItemAmount
~~~~~~~~~~
.. code-block:: pascal
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::
Author: masquerader
Last Modified: Unknown by ZephyrsFury
Example:
.. code-block:: pascal
var
itemsFound: integer;
begin
itemsFound := ItemAmount('inv', 'dtm', dtm_Ore, []);
writeln('Ore found: '+toStr(itemsFound));
end;
*)
function ItemAmount(area, ItemType: string; Item: Integer; Tol: TIntegerArray): Integer;
var
startX, startY, rowSize, colSize, colNumber, rowNumber: integer;
Coords: TPointArray;
i, h: Integer;
begin
Result := 0;
AreaInfo(area, startX, startY, rowSize, colSize, colNumber, rowNumber);
Coords := ItemCoordinates(Area, ItemType, Item, Tol);
h := High(Coords);
for i := 0 to h do
Result := Result + GetAmountBox(IntToBox(Coords[i].x - floor(rowSize / 2),
Coords[i].y - floor(colSize / 2),
Coords[i].x + floor(rowSize / 2),
Coords[i].y + floor(colSize / 4)));
end;
2012-12-31 15:55:44
2012-12-31 15:56:44
{$i srl/srl.simba}
var
amount : Integer;
b: TBox;
begin
SetupSRL;
b := InvBox(1); // creates a box from the first inventory slot.
amount := GetAmountBox(b); // counts the text in that first slot ^
writeln(amount);
end.
2012-12-31 16:02:29
2012-12-31 16:04:53
From: BMWxi
What about items in the bank?
procedure CountItemCheck;
var
count: Integer;
b: TBox;
begin
if (bankscreen) then
begin
b := BankIndexToMSBox(BankPointToBankIndex(Point(9, 0)));
count := GetAmountBox(b);
Writeln('Items Remaining = ' + IntToStr(count) + '.');
if (count < 100) then
begin
Writeln('Almost out of supplies! -> CIAO / TERMINATING SCRIPT');
TerminateScript;
end;
end;
end;
2012-12-31 16:06:14
2012-12-31 17:51:15
From: BMWxi
What about items in the bank?
GetBankItemAmount(((TP.x - 38) div 44), ((TP.y - 90) div 45)) < 50)