SRL Archive - SRL Suggestions

function GetMoneyPouchAmount: LongInt; (Plus Required)


Home

2011-12-13 15:55:13

Functions for Money Pouch.
Tested, confirmed working.

function IsMoneyPouchOpen: Boolean;
var
Cols :TIntegerArray;
I :Integer;
begin
Cols := [65535, 16777215, 8453888];
for I := 0 to 2 do
If CountColor(Cols[I],450, 90, 510, 109) > 10 then
Result := CountColor(Cols[I],450, 90, 510, 109) > 10;
end;


function ToggleMoneyPouch(Open: Boolean): Boolean;
begin
Result := IsMoneyPouchOpen <> Open;
if (not (Result)) then
Exit;
MouseBox(528, 94, 533, 107, mouse_Left);
end;


function GetMoneyPouchAmount: LongInt;
var
Previous: Boolean;
TPA: TPointArray;
B: TBox;
I :Integer;
Col :TIntegerArray;
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);
Result := StrToIntDef(GetNumbers(GetTextAtEx(B.X1 - 1, B.Y1 - 1, 0, StatChars, False, False, 0, 2, Col[I], 5, False, tr_Digits)), -1);
Case I of
2: Result := Result * 1000;
3: Result := Result * 1000000;
end;
end;
if (not(Previous)) then
Wait(RandomRange(500, 1500));
ToggleMoneyPouch(Previous);
end;


function DepositToPouch :Boolean;
var
MoneyPoint :TPoint;
begin
Result := False;
If FindCoins(MoneyPoint.X, MoneyPoint.Y, 'Inv') then
begin
MMouse(MoneyPoint.X, MoneyPoint.Y, 3, 3);
If WaitUpText('Coins', 500) then
begin
Mouse(MoneyPoint.X, MoneyPoint.Y, 0, 0, False);
Result := WaitOption('Add', 500);
end;
end;
end;



function WithdrawFromPouch(Amount :Integer) :Boolean;
var
T :Integer;
begin
Result := False;
MouseBox(528, 94, 533, 107, 2);
If WaitOption('draw', 500) then
begin
T := GetSystemTime + 10000;
while (T >= GetSystemTime) and (not (InRange(CountColor(0, 250, 396, 307, 410), 160, 175))) do
Wait(50);
Wait(RandomRange(75, 400));
TypeSend(IntToStr(Amount));
Result := True;
end;
end;


~Home

YoHoJo

2011-12-13 15:57:45

While you're add it you should make a function to withdraw and deposit coins to/from it.
Can't see these ever being used in a script, but good work Home! :D

Home

2011-12-13 15:58:32

From: YoHoJo
While you're add it you should make a function to withdraw and deposit coins to/from it.
Can't see these ever being used in a script, but good work Home! :D


Sure. Yes I know, mabey for antiban.

~Home

Kyle Undefined

2011-12-13 16:04:21

From: Home
Sure. Yes I know, mabey for antiban.

~Home


15:56 Camo`Office: Home, I really don't see a purpose for those, tbh. Except for Antiban maybe.
15:57 Home: Camo`Office: True, neither do I. Though I don't play RS
15:57 Home: Mabey someone will find them interesting


Lol, sounds like we all agree :) Still good code though.

Home

2011-12-13 16:28:29

Added:
- function DepositToPouch :Boolean;
- function WithdrawFromPouch(Amount :Integer) :Boolean;

~Home

Hobbit

2011-12-14 16:56:41

Committed :)