Simba Code:
(*
WithdrawEx
~~~~~~~~~~
.. code-block:: pascal
function WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
Withdraws Amount at Column/Row.
.. note::
Author: Starblaster100, Town, Wizzup? and Narcle, small fixes by r!ch!e & EvilChicken!
Last Modified: Unknown
Example:
.. code-block:: pascal
WithdrawEx(1, 3, 28, ['ron ore', 'ore', 'on or']);
*)
function WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
var
BBox: TBox;
X, Y: Integer;
begin
Result := False;
if(Amount < -1)then
begin
srl_Warn('WithdrawEx', 'Invalid Selection for amount: '+IntToStr(Amount), warn_AllVersions);
exit;
end;
FixBank;
BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
GetMousePos(X, Y);
if (not PointInBox(Point(X, Y), BBox)) then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_move);
if (Length(Uptexts) > 0) then
if (not WaitUptextMulti(Uptexts, 500+Random(200))) then
Exit;
Case Amount of
-1 : begin
ClickMouse2(mouse_Right);
if (WaitOptionMultiEx(['Withdraw-All but', 'l b'], 'All', Nothing, 300+Random(200))) then
Result := ChooseOptionMulti(['Withdraw-All but', 'l b']);
exit;
end;
0 : begin
ClickMouse2(mouse_Right);
if (WaitOptionMultiEx(['Withdraw-All', 'w-A'], 'All', Nothing, 300+Random(200))) then
Result := ChooseOptionMulti(['Withdraw-All', 'w-A']);
exit;
end;
1 : begin
ClickMouse2(mouse_Left);
Result := True;
Wait(RandomRange(250, 550));
exit;
end;
end;
ClickMouse2(mouse_Right);
if (WaitOptionMultiEx(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)], 'All', Nothing, 300+Random(200))) then
begin
Result := ChooseOptionMulti(['Withdraw-' + IntToStr(Amount)+' ', 'w-' + IntToStr(Amount)+' ']);
exit;
end;
if (Amount > 1) then
begin
if (not OptionsExist(['Withdraw', 'ithdraw', 'draw'], nothing)) then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_right);
if WaitOptionMulti(['Withdraw-X', 'w-X'], 500) then
begin
X := GetSystemTime + 10000;
while (X >= GetSystemTime) and (not (InRange(CountColor(0, 250, 396, 307, 410), 155, 165))) do
Wait(Random(50));
Wait(RandomRange(75, 400));
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;
I got rid of a lot of the ifs and put in a case statement to neaten things up...