SRL Archive - SRL Bugs

WaitInvCount to support open bank screen


TomTuff

2011-03-18 02:44:22

At the start of WaitInvCount is a check to exit if it fails to go to the inventory tab. Well, if the bank screen is open, it can't go to the inventory tab, therefore it exits before counting items.

Patch:
{*******************************************************************************
function WaitInvCount(Count, MaxTime: Integer; CountType: (MaxCT, MinCT, ExactCT)): boolean;
By: Rasta Magician
Description: Waits for a maximum inv count. Returns true if InvCount <= Count
*******************************************************************************}
function WaitInvCount(Count, MaxTime: Integer; CountType: (MaxCT, MinCT, ExactCT)): boolean;
var
T: integer;
begin
if not(BankScreen) then
if not GameTab(tab_Inv) then exit;

Result := false;
T := GetSystemTime + MaxTime;

while GetSystemTime < T do
begin
wait(10);
case CountType of
MaxCT : if InvCount <= Count then Result := true;
MinCT : if InvCount >= Count then Result := true;
ExactCT : if InvCount = Count then Result := true;
end;

if Result then break;

end;
end;

It's 1 Line to SRL that would save me 30 lines in my own :p

Coh3n

2011-03-18 02:47:11

Why does the bank have to be open in the first place? Last time I checked you could count items when the bank wasn't open..

TomTuff

2011-03-18 03:07:42

From: Coh3n
Why does the bank have to be open in the first place? Last time I checked you could count items when the bank wasn't open..


This would be for counting inventory items while bank screen is open.

Coh3n

2011-03-18 03:15:09

From: TomTuff
This would be for counting inventory items while bank screen is open.

Sorry, I didn't realize you added the if not(BankScreen) then. With what you changed, it would only work when the bank is open. Why not just count the items before opening the bank?

TomTuff

2011-03-18 03:21:56

From: Coh3n
Sorry, I didn't realize you added the if not(BankScreen) then. With what you changed, it would only work when the bank is open. Why not just count the items before opening the bank?


No, it would work both ways. If the bank screen isn't open, then it will call GameTab(tab_Inv). If the bank screen is open, it will never call GameTab(tab_Inv).

Doing that would just be a lot of work for something that is so simple to change. Besides, i'm using it to check if withdrawing succeeded - so how would I check if something i withdrawed existed before I ever even opened the bank?

Coh3n

2011-03-18 03:26:43

From: TomTuff
No, it would work both ways. If the bank screen isn't open, then it will call GameTab(tab_Inv). If the bank screen is open, it will never call GameTab(tab_Inv).

Doing that would just be a lot of work for something that is so simple to change. Besides, i'm using it to check if withdrawing succeeded - so how would I check if something i withdrawed existed before I ever even opened the bank?

Haha yes, you're right. :p 2 points for out-smarting me.

I don't see why this shouldn't be committed. If no one else comments, I'll do it in the morning. :)

rogeruk

2011-03-18 07:43:03

Yeap def :thumbsup:

BKNYKavkaz

2011-03-18 13:53:01

Even though i never needed to count something in my inventory if im in a bank, i can see this being a nice failsafe for fletching, herblore, etc ;)

Floor66

2011-03-18 13:57:10

Support.

Coh3n

2011-03-18 15:04:22

Committed.