When I run the following block of code it loops through even when my inventory is empty.
SCAR Code:
procedure DepositItems;
begin
while not(InvEmpty) do
begin
Writeln(booltostr(InvEmpty));
Writeln('Depositing items..');
OpenBankFast('vwb');
if (not(BankScreen)) then
begin
Writeln('Bank is not open.');
end;
DepositAll;
CloseBank;
end;
{**}if (InvEmpty) then DebugMsg('Items deposited into bank.');
end;
I looked at the function for InvEmpty and it checks weather the inventory is empty in a completely different way from how InvFull is calculated so I modified the InvFull function to check if the Inv is empty and ended up with this code:
SCAR Code:
Function InvEmpty2: Boolean;
Begin
GameTab(4);
Result := InvCount = 0;
End;
procedure DepositItems;
begin
while not(InvEmpty2) do
begin
Writeln(booltostr(InvEmpty2));
Writeln('Depositing items..');
OpenBankFast('vwb');
if (not(BankScreen)) then
begin
Writeln('Bank is not open.');
end;
DepositAll;
CloseBank;
end;
{**}if (InvEmpty2) then DebugMsg('Items deposited into bank.');
end;
Using my function (InvEmpty2) the script runs fine. Why does it not work if I use the standard (InvEmpty) function and also why is InvEmpty calculated in a different way from InvFull?
To save you checking the InvFull and InvEmpty functions:
From Includes/SRL/SRL/Core/Inventory.scar
SCAR Code:
{*******************************************************************************
function InvEmpty: Boolean;
By: WT-Fakawi
Description: Returns True if inventory is empty
*******************************************************************************}
function InvEmpty: Boolean;
Var
x, y: integer;
begin
GameTab(4);
Result := not FindColor(x, y, 65536, MIX1, MIY1, MIX2, MIY2);
end;
{*******************************************************************************
function InvFull: Boolean;
By: n3ss3s
Description: Returns True if inventory is full
*******************************************************************************}
Function InvFull: Boolean;
Begin
GameTab(4);
Result := InvCount = 28;
End;