SRL Archive - Reflection Help

R_DepositAllEx


smurg

2011-02-16 16:38:59

It deposits all my items, even the one not supposed to.

It would be nice to test these before breaking scripts, but I'm looking into if R_ItemExists is returning a wrong array or if its in the function itself.

Train

2011-02-16 16:45:46

Fixed.

{*******************************************************************************
procedure R_DepositAllButEx(TheVarArr: TVariantArray);
By: mormonman
Description: Deposits all items but the items with one of the specified IDs or
Names to the bank.
*******************************************************************************}
procedure R_DepositAllButEx(TheVarArr: TVariantArray);
var
I, h, HiItems : Integer;
Item : TInvItem;
Items: TInvItemArray;
B: Boolean;
begin
if not R_BankScreen then
Exit;
if not R_ItemExistsEx(TheVarArr, Items) then R_DepositAll(True);
HiItems := High(Items);
for I := 1 to 28 do
begin
if(not R_ItemSlotExists(I)) then Continue;
Item := GetInvItemAt(I);
R_Debug('Item: ' + ToStr(Item), 'R_DepositAllButEx');
B := False;
for h := 0 to HiItems do
B := B or (Item.ID = Items[h].ID);
if B then Continue;
R_DepositSlot(I);
end;
end;

EDIT: Will do a Pull Request.

smurg

2011-02-16 16:49:01

From: Train
Fixed.

SCAR Code:
[LEFT]{*******************************************************************************
procedure R_DepositAllButEx(TheVarArr: TVariantArray);
By: mormonman
Description: Deposits all items but the items with one of the specified IDs or
Names to the bank.
*******************************************************************************}

procedure R_DepositAllButEx(TheVarArr: TVariantArray);
var
I, h, HiItems : Integer;
Item : TInvItem;
Items: TInvItemArray;
B: Boolean;
begin
if not R_BankScreen then
Exit;
if not R_ItemExistsEx(TheVarArr, Items) then R_DepositAll(True);
HiItems := High(Items);
for I := 1 to 28 do
begin
if(not R_ItemSlotExists(I)) then Continue;
Item := GetInvItemAt(I);
R_Debug('Item: ' + ToStr(Item), 'R_DepositAllButEx');
B := False;
for h := 0 to HiItems do
B := B or (Item.ID = Items[h].ID);
if B then Continue;
R_DepositSlot(I);
end;
end;
[/LEFT]



Edit: Guess it was fixed recently. Just got the update.

Train

2011-02-16 16:56:42

Orly? I feel silly then for posting a Pull Request.
-discard.

smurg

2011-02-16 17:23:33

From: Train
Orly? I feel silly then for posting a Pull Request.
-discard.


Sorry about that. I had Simba running for a while before I even checked, I thought it would've checked sometime automatically.

Ya: It was comparing whole TInvItem's to each other instead of their ID's, and the slot fields in each TInvItem would be different.