SRL Archive - SRL Archives

DepositScreen


Shuttleu

2009-05-25 13:48:27

it was being asked for and it still hadn't been added to srl

{*******************************************************************************
Function DepositBox(i :Integer): TBox;
by: Shuttleu
Description: Returns a TBox of the item i slots for the deposit box.
*******************************************************************************}
Function DepositBox(i :Integer): TBox;
var
row, col: Integer;

begin
If(not(LoggedIn)) then exit;
if (i < 1) or (i > 28) then exit;
row :=i mod 7;
if row = 0 then row := 7;
col := i / 7 ;
if i mod 7 <> 0 then Inc(col);
Result.x1 := 48 + (row * 48);
Result.y1 := 13 + (col * 50);
Result.x2 := 96 + (row * 48);
Result.y2 := 63 + (col * 50);
end;

{*******************************************************************************
function DepositItemExists(i: Integer): Boolean;
by: Shuttleu
Description: Returns true if a item at point i in the deposit box is Found.
*******************************************************************************}
function DepositItemExists(i: Integer): Boolean;
var
x, y:Integer;
TB: TBox;
begin
If(not(LoggedIn)) then exit;
TB := DepositBox(i);
Result := FindColor(x, y, 65536, TB.x1 + 5, TB.y1 + 5, TB.x2 - 5, TB.y2 - 5);
end;

{*******************************************************************************
Procedure BankDeposit(i:integer);
by: Shuttleu
Description: Deposits the item at i in the deposit box
*******************************************************************************}
Procedure BankDeposit(i:integer);
var
Item: TPointArray;
T: integer;
begin
If(not(LoggedIn)) then exit;
if (i < 1) or (i > 28) then exit;
SetLength(Item, 29);
for I := 1 to 28 do
Item[i] := Point(109 + (I - 1) mod 7 * 48, 78 + (I - 1) div 7 * 50);
if ItemExists(i) then
begin
Mouse(Item[i].x, Item[i].y, 20, 20, False);
Wait(400+random(400));
if ChooseOption('sit-All') then
begin
T:=0
repeat
Inc(T);
Wait(500+random(500));
until (not(ItemExists(i))) or (T>=30);
end;
end;
end;

{*******************************************************************************
function DepositScreen: Boolean;
by: Shuttleu
Description: Returns true if deposit screen is Found.
*******************************************************************************}
function DepositScreen: Boolean;
begin
If(not(LoggedIn)) then exit;
Result := FindText(x, y, 'ank', upchars, 92, 29, 396, 54);
end;

{*******************************************************************************
function OpenDeposit : Boolean;
by: Shuttleu
Description: Opens the deposit box.
*******************************************************************************}
function OpenDeposit : Boolean;
var
T:integer;
begin
If(not(LoggedIn)) then exit;
begin
FindNormalRandoms;
if FindObjTPA(x, y, 739167, 10, -1, 30, 30, 1, ['ank', 'epos', 'sit']) then
begin
Mouse(x, y, 5, 5, True);
Result:= True;
T:=0
repeat
Inc(T);
Wait(500+random(500));
until (DepositScreen) or (T>=30);
end else
Writeln('Coluld not find open the deposit box');
end;
end;

~shut

Naum

2009-05-25 13:54:55

Lol, I had just made one :p

function DepositScreen: Boolean;

begin
Result := FindTextTPA(2070783, 20, 298, 35, 365, 52, 'Deposit', upchars, Nothing);
end;

ZephyrsFury

2009-05-25 13:58:34

This part:


Item[1]:= Point(109+(0 * 48), 78+(0 * 50));
Item[2]:= Point(109+(1 * 48), 78+(0 * 50));
Item[3]:= Point(109+(2 * 48), 78+(0 * 50));
Item[4]:= Point(109+(3 * 48), 78+(0 * 50));
Item[5]:= Point(109+(4 * 48), 78+(0 * 50));
Item[6]:= Point(109+(5 * 48), 78+(0 * 50));
Item[7]:= Point(109+(6 * 48), 78+(0 * 50));
Item[8]:= Point(109+(0 * 48), 78+(1 * 50));
Item[9]:= Point(109+(1 * 48), 78+(1 * 50));
Item[10]:= Point(109+(2 * 48), 78+(1 * 50));
Item[11]:= Point(109+(3 * 48), 78+(1 * 50));
Item[12]:= Point(109+(4 * 48), 78+(1 * 50));
Item[13]:= Point(109+(5 * 48), 78+(1 * 50));
Item[14]:= Point(109+(6 * 48), 78+(1 * 50));
Item[15]:= Point(109+(0 * 48), 78+(2 * 50));
Item[16]:= Point(109+(1 * 48), 78+(2 * 50));
Item[17]:= Point(109+(2 * 48), 78+(2 * 50));
Item[18]:= Point(109+(3 * 48), 78+(2 * 50));
Item[19]:= Point(109+(4 * 48), 78+(2 * 50));
Item[20]:= Point(109+(5 * 48), 78+(2 * 50));
Item[21]:= Point(109+(6 * 48), 78+(2 * 50));
Item[22]:= Point(109+(0 * 48), 78+(3 * 50));
Item[23]:= Point(109+(1 * 48), 78+(3 * 50));
Item[24]:= Point(109+(2 * 48), 78+(3 * 50));
Item[25]:= Point(109+(3 * 48), 78+(3 * 50));
Item[26]:= Point(109+(4 * 48), 78+(3 * 50));
Item[27]:= Point(109+(5 * 48), 78+(3 * 50));
Item[28]:= Point(109+(6 * 48), 78+(3 * 50));


can be shortened to this:


for I := 1 to 28 do
Item[I] := Point(109 + (I - 1) mod 7 * 48, 78 + (I - 1) div 7 * 50);

Also, this got me thinking. Would it be good to have SRL's Deposit also work with the deposit box? I'm sure editing it wouldn't be too hard.

Shuttleu

2009-05-25 14:03:06

okie doke
thanks
rep++

~shut

Naum

2009-05-25 14:19:44

@ HobbitNavaRastaZephy;
In this case whats the difference between mod and div accept Mod gets the remainder.

ZephyrsFury

2009-05-30 22:03:30

Btw I added similar functions to Bank.scar. Deposit and DepositAll now work for both the bank screen and deposit screens. Thanks.