SRL Archive - Reflection Development

R_Withdraw (More Bank functions to come!)


Infantry001

2009-07-05 22:36:34

Not complete!
This does not take Bank Tabs into account, sorry!


Well, it withdraws the item using a Name or an ID.
Credits go to the original SRL Withdraw function for the handling of Amount.
Enjoy =)

{*******************************************************************************
procedure R_Withdraw(Item : Variant; Amount : Integer);
By: Infantry001
Description: Withdraw Amount of Item. Item can be either ID or Name.
*******************************************************************************}
procedure R_Withdraw(Item : Variant; Amount : Integer);
var
I, BankSlot : Integer;
BBox : TBox;
Items : TBankSlotArray;
begin
if not R_BankScreen then exit;
Items := GetBankArray;
case VarType(Item) of
3: for I := 0 to High(Items) do
begin
if (Items[I].ID = Integer(Item)) then
begin
BankSlot := Items[I].Index + 1;
break;
end;
end;
256: for I := 0 to High(Items) do
begin
if (Items[I].Name = Item) then
begin
BankSlot := Items[I].Index + 1;
break;
end;
end;
end;
BBox := BankIndexToMSBox(BankSlot);
If Amount = 1 Then
Begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 1);
Wait(RandomRange(50, 150));
End
Else
Begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
if (Amount = 5) or (Amount = 10) then
R_ChooseOption('Withdraw-' +IntToStr(Amount))
else if Amount = 0 then
R_ChooseOption('Withdraw-All')
else
if not R_ChooseOption('Withdraw-'+IntToStr(Amount)+' ') then
begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
if (R_ChooseOption('Withdraw-X')) then
begin
Wait(1000 + Random(100));
TypeSend(IntToStr(Amount));
end;
end;
end;
end;

ZaSz

2009-07-05 22:38:57

If it works, Great Job. Was hoping for something like this to come out.

Infantry001

2009-07-05 22:44:58

Yeah, it works. Tested it with my Cowhide Powerbanker =)

ZephyrsFury

2009-07-06 06:40:02

Does this work when you have tabs in the inventory?

The Little

2009-07-06 19:52:16

Thank you very much :)! Can finally finish my Superheater now ;).

Phran6

2009-07-06 19:56:59

i tryed it and it doesnt work for me :(

mormonman

2009-07-06 20:22:32

From: francishelie
i tryed it and it doesnt work for me :(


Be sure that you get the bank id, not the inventory id of the item.

Phran6

2009-07-06 20:45:54

i did with name, and how i get bank id ?

mormonman

2009-07-06 20:51:38

From: francishelie
i did with name, and how i get bank id ?


i still use rsbot debug cuz idc about the accounts i use.

Infantry001

2009-07-11 09:06:13

From: ZephyrsFury
Does this work when you have tabs in the inventory?


Tabs in the inventory? Or in the bank?

ZephyrsFury

2009-07-11 12:05:17

From: Infintry001
Tabs in the inventory? Or in the bank?


Bank, cos you realise items in tabs have their Bank indices come first. So for this to work you'd need someway of finding how many items are in each tab, which atm I don't think we can unless we want to go through each tab and count the items using Colour.

Infantry001

2009-07-11 20:33:21

Oh wow, I never even thought about the tabs thing. I don't use them XD

So I guess this function won't work across the board yet… =(

The Little

2009-07-12 09:56:02

Nope, but it will work fine if you just tell the user to put the items in the first tab :), at least for now…