Simba Code:
(*
WithdrawItem
~~~~~~~~~~~~
.. code-block:: pascal
function WithdrawItem(Ident: integer; IdentType: string; Amount: integer;
UpText: TStringArray; Tol: TIntegerArray): boolean;
Withdraws an item using WithdrawItemEx, but removes the Index check.
.. note::
Author: Nava2
Last Modified: Unknown
Example:
.. code-block:: pascal
if WithdrawItem(theColor, 'color', 27, ['ew log', 'ew l'], [3]) then
CloseBank;
*)
function WithdrawItem(Ident: integer; IdentType: string; Amount: integer; UpText: String; Tol: TIntegerArray): boolean;
var
I : Integer;
begin
Result := WithdrawItemEx(Ident, IdentType, I, Amount, UpText, Tol);
Simba Code:
(*
WithdrawItemEx
~~~~~~~~~~~~~~
.. code-block:: pascal
function WithdrawItemEx(Ident: integer; IdentType: string; var Index: integer;
Amount: integer; UpTexts: TStringArray; Tol: TIntegerArray): boolean;
Withdraws an item from the bank by using "Ident" with tol[0]
as color tolerance, tol[1] as contour tolerance in case of bmp
masks, or the count of colors for TPA item finding.
Valid IdentTypes are all in FindItem.
Index:
The Bank Index where the item is found, must be a variable.
Speeds up future withdraws.
Amount:
Amount to withdraw from bank.
UpText:
The UpText which the function checks for.
.. note::
Author: Nava2 - modified IxilisI
Last Modified: 19/01/13
Example:
.. code-block:: pascal
if WithdrawItemEx(theColor, 'color', itemSlot, 27, ['ew','ogs'], [3]) then
CloseBank;
*)
function WithdrawItemEx(Ident: integer; IdentType: string; var Index: integer; Amount: integer; Uptexts: TStringArray; Tol: TIntegerArray): Boolean;
var
x, y: integer;
BPoint: TPoint;
BankBox: TBox;
Found: Boolean;
t: TPointArray;
label
Start;
begin
Result := False;
if not BankScreen then Exit;
FixBank;
if (Index = 0) then
begin
Start:
for Index := 1 to 50 do
begin
if FindItemEx(x, y, IdentType, Ident, BankIndexToMSBox(Index), Tol) then
begin
MMouse(x, y, 4, 4);
if (Length(Uptexts) > 0) then
if (WaitUptextMulti(Uptexts, 400)) then
begin
Writeln('Found Item at Bank Slot ' + IntToStr(Index) + '.');
Found := True;
Break;
end else
Writeln('Found Incorrect Item, Moving to new Bank Spot.');
end;
end;
end else
begin
BankBox := BankIndexToMSBox(Index);
FindColors(t, srl_outline_black, BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2);
BankBox := GetTPABounds(t);
MouseBox(BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2, mouse_move);
if (Length(Uptexts) > 0) then
if (WaitUptextMulti(Uptexts, 400)) then
Found := true
else
begin
Writeln('Item Moved from Bank Slot ' + IntToStr(Index) + ', checking bank again.');
goto Start;
end;
end;
Wait(RandomRange(200, 350));
if Found then
begin
BPoint := BankIndexToBankPoint(Index);
//Writeln(IntToStr(BPoint.x) + ', ' + IntToStr(BPoint.y));
Withdraw(BPoint.x, BPoint.y, Amount);
Result := True;
end else
begin
Index := 0;
SRL_Warn('WithdrawItem', 'Could not Find ' + IdentType + ' in Bank. [Uptext: ' + UpText + ']', Warn_AllVersions);
end;
end;
(*
WithdrawItem
~~~~~~~~~~~~
.. code-block:: pascal
function WithdrawItem(Ident: integer; IdentType: string; Amount: integer;
UpText: TStringArray; Tol: TIntegerArray): boolean;
Withdraws an item using WithdrawItemEx, but removes the Index check.
.. note::
Author: Nava2 - modified IxilisI
Last Modified: 19/01/13
Example:
.. code-block:: pascal
if WithdrawItem(theColor, 'color', 27, ['ew log', 'ew l'], [3]) then
CloseBank;
*)
function WithdrawItem(Ident: integer; IdentType: string; Amount: integer; UpTexts: TStringArray; Tol: TIntegerArray): boolean;
var
I : Integer;
begin
Result := WithdrawItemEx(Ident, IdentType, I, Amount, UpTexts, Tol);
end;