SRL Archive - SRL Bugs

Pouch


xtrapsp

2012-10-02 17:05:00

hey guys,

Recently made a script which logs into all my accounts and creates a total of how much money is in their money pouches added together.

The bug that I'm reporting on is that it occasionally clicks the XP icon rather than the Money Pouch.

Anyone had similar issues? I'm using this:
procedure statistics;
begin
writeln('Player has : ' + IntToStr(GetMoneyPouchAmount));
TotalGP := TotalGP + GetMoneyPouchAmount
writeln('Total GP: ' + IntToStr(TotalGP));
end;

It literally just completely misses the pouch… Heres the GetMoneyPouchAmount I have:


(*
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;