Simba Code:
(*
GetMoneyPouchAmount
~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function GetMoneyPouchAmount: LongInt;
Returns amount of coins in pouch.
.. note ::
by Home & Richard
Example:
.. code-block:: pascal
amt := GetMoneyPouchAmount();
*)
function GetMoneyPouchAmount: Integer;
var
Previous: Boolean;
TPA: TPointArray;
B: TBox;
I :Integer;
Col :TIntegerArray;
Money :String;
begin
Previous := IsMoneyPouchOpen;
if (ToggleMoneyPouch(True)) then
WaitFunc(@IsMoneyPouchOpen, 10, 2750);
Col := [65535, 65278, 16777215, 8453888];
for I := 0 to 3 do
if (FindColors(TPA, Col[I], 450, 90, 510, 109)) then
begin
B := GetTPABounds(TPA);
B := IntToBox(B.X1 - 2, B.Y1 - 2, B.X2 + 2, B.Y2 + 2);
Money := (GetTextAtEx(B.X1 - 1, B.Y1 - 1, 0, StatChars, False, False, 0, 2, Col[I], 5, False, tr_AllChars));
Result := StrToIntDef(GetNumbers(Money), -1);
If Pos('K', Money) > 0 then
Result := Result * 1000;
If Pos('M', Money) > 0 then
Result := Result * 1000000;
break;
end;
if (not(Previous)) then
begin
Wait(RandomRange(500, 1500));
ToggleMoneyPouch(Previous);
end;
end;