onilika
08-01-2011, 05:59 PM
How do I set this for "Thread" and "Needle"? (Is this form for many objects, or just one object?)
function R_ItemExists(TheVar: Variant; var Item: TInvItem): Boolean;
var
Items: TInvItemArray;
begin
Result := R_ItemExistsEx([TheVar], Items);
if Result then
Item := Items[0];
end;
If not in inventory, how do I set to withdraw from bank?
function R_WithdrawItemsEx(TheVarArr: TVariantArray; All: Boolean): Boolean;
var
Items: TBankItemArray;
TempItem: TBankItem;
Item: TInterfaceComponent;
I, X, Y, Inv, T: Integer;
begin
Result := False;
if not R_BankScreen then
Exit;
if not R_ItemsExistInBankEx(TheVarArr, Items)then
begin
R_Debug('Items not found in bank.', 'R_WithdrawItemsEx');
Exit;
end;
Result := True;
for I := 0 to High(Items) do
begin
if not R_ItemExistsInBank(Items[i].Name, TempItem)then
begin
Result := False;
R_Debug('Unable to find '+Items[i].Name, 'R_WithdrawItemsEx');
Continue;
end;
if not R_ScrollToIndex(TempItem.Slot) then
begin
Result := False;
R_Debug('Unable to scroll to '+Items[i].Name, 'R_WithdrawItemsEx');
Continue;
end;
Item := R_GetInterfaceComponent(INTERFACE_BANK, INTERFACE_BANK_SLOTS, TempItem.Slot);
R_ClickInterface(Item, 3);
GetMousePos(X, Y);
Inv := R_InvCount;
case All of
True: begin
Mouse(x, y, 0, 0, false);
if(not R_WaitOption('Withdraw-All', 2000))then
begin
R_Debug('Unable to withdraw '+Item.Name, 'R_WithdrawItemsEx');
Result := False;
Continue;
end;
end;
False: Mouse(x, y, 0, 0, true);
end;
MarkTime(T);
while (R_InvCount = Inv)do
begin
if(TimeFromMark(T) > 5000)then
begin
R_Debug('Unable to withdraw '+Item.Name, 'R_WithdrawItemsEx');
Result := False;
Break;
end;
Wait(50+Random(50));
end;
Wait(500+Random(1000));
//Need to give the bank interface time to reload if an item was removed.
end;
end;
function R_ItemExists(TheVar: Variant; var Item: TInvItem): Boolean;
var
Items: TInvItemArray;
begin
Result := R_ItemExistsEx([TheVar], Items);
if Result then
Item := Items[0];
end;
If not in inventory, how do I set to withdraw from bank?
function R_WithdrawItemsEx(TheVarArr: TVariantArray; All: Boolean): Boolean;
var
Items: TBankItemArray;
TempItem: TBankItem;
Item: TInterfaceComponent;
I, X, Y, Inv, T: Integer;
begin
Result := False;
if not R_BankScreen then
Exit;
if not R_ItemsExistInBankEx(TheVarArr, Items)then
begin
R_Debug('Items not found in bank.', 'R_WithdrawItemsEx');
Exit;
end;
Result := True;
for I := 0 to High(Items) do
begin
if not R_ItemExistsInBank(Items[i].Name, TempItem)then
begin
Result := False;
R_Debug('Unable to find '+Items[i].Name, 'R_WithdrawItemsEx');
Continue;
end;
if not R_ScrollToIndex(TempItem.Slot) then
begin
Result := False;
R_Debug('Unable to scroll to '+Items[i].Name, 'R_WithdrawItemsEx');
Continue;
end;
Item := R_GetInterfaceComponent(INTERFACE_BANK, INTERFACE_BANK_SLOTS, TempItem.Slot);
R_ClickInterface(Item, 3);
GetMousePos(X, Y);
Inv := R_InvCount;
case All of
True: begin
Mouse(x, y, 0, 0, false);
if(not R_WaitOption('Withdraw-All', 2000))then
begin
R_Debug('Unable to withdraw '+Item.Name, 'R_WithdrawItemsEx');
Result := False;
Continue;
end;
end;
False: Mouse(x, y, 0, 0, true);
end;
MarkTime(T);
while (R_InvCount = Inv)do
begin
if(TimeFromMark(T) > 5000)then
begin
R_Debug('Unable to withdraw '+Item.Name, 'R_WithdrawItemsEx');
Result := False;
Break;
end;
Wait(50+Random(50));
end;
Wait(500+Random(1000));
//Need to give the bank interface time to reload if an item was removed.
end;
end;