SRL Archive - SRL Archives

BankDepositBox - Functions


BazzBarrett

2008-09-25 17:54:34

hey i noticed there were no deposit box functions so i made a few of my own i think u will find them quite interesting and all locations work =)

PS: if u like please vote yes for my members apliacation (Thats isent against any rules is it?) http://www.villavu.com/forum/showthread.php?t=35592?p=468153
program New;
{.Include SRL/SRL.Scar}

Function OpenDepositBox(Location :string):boolean;
var
CTS, II, x, y, Info : Integer;
TPA : TPointArray;
ATPA: Array of TPointArray;
begin
If Not(loggedin) then exit;
case LowerCase(Location) of
'lb', 'lumbridge': Info := 3161932;//done - checked
'feb', 'falador east': Info := 406857;//done - checked
'fwb', 'falador west': Info := 406857;//done - checked
'db', 'draynor': Info := 406857;//done - checked
'eb', 'edgeville bank': Info := 4809843;//done - checked
else
begin
srl_Warn('OpenBankFast', 'Unknown bank: '+Location, warn_AllVersions);
Exit;
end;
End;
if GetColor(149, 38) = 2070783 Then
begin
Result := True;
Exit;
end;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 338491, MSX1, MSY1, MSX2, MSY2, 15);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For II := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[II], X, Y)
MMouse(X, Y, 2, 2);
Wait(50+Random(10));
If(IsUpText('eposit'))then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
Mouse(x, y, 1, 1, True);
Wait(100+random(200));
For II := 0 to 10 do
begin
if GetColor(149, 38) = 2070783 Then
begin
Result := True;
Exit;
end;
if II = 10 then
begin
Result := False;
Writeln('Deposit Box Never opened!');
Exit;
end;
Wait(500+random(500));
end;
end;

Function DepositItemDepositBox(Col, Row :integer; DepositAll :boolean):Boolean;
var
Cx, Cy :integer;
begin
If Not(loggedin) then exit;
if Not(GetColor(149, 38) = 2070783) Then
begin
Result := False;
Exit;
end;
If (Row > 5) or (Col > 7) then
begin
Result := False;
Writeln('Invalid Row or col number!');
Exit;
end;
Cx := (Col*50)+70;
Cy := (Row*50)+85;
if DepositAll then
begin
mouse(Cx, Cy, 3, 3, False);
wait(200+random(200));
ChooseOption('All');
Result := true;
Exit;
end else
begin
Mouse(Cx, Cy, 3, 3, true);
wait(200+random(200));
Result := True;
end;
end;

//To deposit all just use 28 as ammount!
Function DepositBoxFast(InvSlot, Ammount :Integer; Location:string):Boolean;
var
InvPos : TPoint;
Row, Col, Info :integer;
DepAll :Boolean;
CTS, II, Cx, Cy : Integer;
TPA : TPointArray;
ATPA: Array of TPointArray;
begin
If Not(loggedin) then exit;
if (InvSlot > 28) or (InvSlot < 1) then
begin
Writeln('Invalid InvSlot!');
Exit;
end;
case LowerCase(Location) of
'lb', 'lumbridge': Info := 3161932;//done - checked
'feb', 'falador east': Info := 406857;//done - checked
'fwb', 'falador west': Info := 406857;//done - checked
'db', 'draynor': Info := 406857;//done - checked
'eb', 'edgeville bank': Info := 4809843;//done - checked
else
begin
srl_Warn('DepositBoxFast', 'Unknown Deposit Box: '+Location, warn_AllVersions);
Exit;
end;
end;
if GetColor(149, 38) = 2070783 Then
begin
Row := (InvSlot/7)+1;
if Row = 5 then Row := 4;
Col := (InvSlot/4)+1
if Col = 8 then Col := 7;
if ammount = 28 then DepAll := True;
DepositItemDepositBox(Col, Row, DepAll);
Exit;
end;
InvPos := ItemCoords(InvSlot);
mmouse(InvPos.x, InvPos.y, 3, 3);
Wait(50+random(50));
If GetUpText = '' then Exit;
Mouse(InvPos.x, InvPos.y, 3, 3, False);
if Not ChooseOption('Use') then Exit;
Wait(100+random(200));
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Info, MSX1, MSY1, MSX2, MSY2, 15);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For II := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[II], CX, CY)
MMouse(CX, CY, 2, 2);
Wait(50+Random(10));
If(IsUpText('eposit'))then
begin
Result := True;
GetMousePos(Cx, Cy);
Break;
end;
end;
Mouse(Cx, Cy, 1, 1, True);
For II := 0 to 10 do
begin
if FindColor(Cx, Cy, 9343516, 13, 350, 93, 388) Then Break;
if II = 10 then
begin
Result := False;
Writeln('Deposit Box Never Found!');
Exit;
end;
Wait(500+random(500));
end;
If Ammount = 28 then
begin
Mouse(259, 447, 5, 0, true);
Result := True;
Exit;
end else
begin
Mouse(259, 425, 5, 0, true);
Wait(200+random(200));
TypeSend(inttostr(Ammount));
Result := True;
Exit;
end;
end;

begin
SetUpSRL;
writeln(booltostr(DepositBoxFast(20, 1, 'lb')));

end.

Cazax

2008-09-25 18:09:46

Dont do:
if … then
begin
break;
end;

if you will only do 1 action after and if then, dont use begin and end.

Shuttleu

2008-09-25 18:39:00

i made a deposit box banker in one of my scripts because there was no bank around

baiscaly i modded the existing functions to work with the deposit box :p
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 ItemExists(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);
var
Item: TPointArray;
T: integer;
begin
If(not(LoggedIn)) then exit;
if (i < 1) or (i > 28) then exit;
SetLength(Item, 29);
Item:= [Point(109+(0 * 48), 78+(0 * 50)), Point(109+(1 * 48), 78+(0 * 50)),
Point(109+(2 * 48), 78+(0 * 50)), Point(109+(3 * 48), 78+(0 * 50)),
Point(109+(4 * 48), 78+(0 * 50)), Point(109+(5 * 48), 78+(0 * 50)),
Point(109+(6 * 48), 78+(0 * 50)), Point(109+(0 * 48), 78+(1 * 50)),
Point(109+(1 * 48), 78+(1 * 50)), Point(109+(2 * 48), 78+(1 * 50)),
Point(109+(3 * 48), 78+(1 * 50)), Point(109+(4 * 48), 78+(1 * 50)),
Point(109+(5 * 48), 78+(1 * 50)), Point(109+(6 * 48), 78+(1 * 50)),
Point(109+(0 * 48), 78+(2 * 50)), Point(109+(1 * 48), 78+(2 * 50)),
Point(109+(2 * 48), 78+(2 * 50)), Point(109+(3 * 48), 78+(2 * 50)),
Point(109+(4 * 48), 78+(2 * 50)), Point(109+(5 * 48), 78+(2 * 50)),
Point(109+(6 * 48), 78+(2 * 50)), Point(109+(0 * 48), 78+(3 * 50)),
Point(109+(1 * 48), 78+(3 * 50)), Point(109+(2 * 48), 78+(3 * 50)),
Point(109+(3 * 48), 78+(3 * 50)), Point(109+(4 * 48), 78+(3 * 50)),
Point(109+(5 * 48), 78+(3 * 50)), Point(109+(6 * 48), 78+(3 * 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;
begin
If(not(LoggedIn)) then exit;
Result := FindText(x, y, 'ank', upchars, 92, 29, 396, 54);
end;

Procedure BankEverything(from, upto:integer);
begin
If(not(LoggedIn)) then exit;
for i:=from to upto do
if itemExists(i) then BankDeposit(i);
Mouse(426, 34, 15, 15, True);
end;
:)

~shut

BazzBarrett

2008-09-25 18:39:59

From: Cazax
Dont do:
if … then
begin
break;
end;

if you will only do 1 action after and if then, dont use begin and end.


ok.. that is picky.. i did it once in the whole script and it doesnt effect how the script runs wat so ever ive altered it just 4 u ;)

BazzBarrett

2008-09-25 18:44:34

From: Shuttleu
i made a deposit box banker in one of my scripts because there was no bank around

baiscaly i modded the existing functions to work with the deposit box :p
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 ItemExists(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);
var
Item: TPointArray;
T: integer;
begin
If(not(LoggedIn)) then exit;
if (i < 1) or (i > 28) then exit;
SetLength(Item, 29);
Item:= [Point(109+(0 * 48), 78+(0 * 50)), Point(109+(1 * 48), 78+(0 * 50)),
Point(109+(2 * 48), 78+(0 * 50)), Point(109+(3 * 48), 78+(0 * 50)),
Point(109+(4 * 48), 78+(0 * 50)), Point(109+(5 * 48), 78+(0 * 50)),
Point(109+(6 * 48), 78+(0 * 50)), Point(109+(0 * 48), 78+(1 * 50)),
Point(109+(1 * 48), 78+(1 * 50)), Point(109+(2 * 48), 78+(1 * 50)),
Point(109+(3 * 48), 78+(1 * 50)), Point(109+(4 * 48), 78+(1 * 50)),
Point(109+(5 * 48), 78+(1 * 50)), Point(109+(6 * 48), 78+(1 * 50)),
Point(109+(0 * 48), 78+(2 * 50)), Point(109+(1 * 48), 78+(2 * 50)),
Point(109+(2 * 48), 78+(2 * 50)), Point(109+(3 * 48), 78+(2 * 50)),
Point(109+(4 * 48), 78+(2 * 50)), Point(109+(5 * 48), 78+(2 * 50)),
Point(109+(6 * 48), 78+(2 * 50)), Point(109+(0 * 48), 78+(3 * 50)),
Point(109+(1 * 48), 78+(3 * 50)), Point(109+(2 * 48), 78+(3 * 50)),
Point(109+(3 * 48), 78+(3 * 50)), Point(109+(4 * 48), 78+(3 * 50)),
Point(109+(5 * 48), 78+(3 * 50)), Point(109+(6 * 48), 78+(3 * 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;
begin
If(not(LoggedIn)) then exit;
Result := FindText(x, y, 'ank', upchars, 92, 29, 396, 54);
end;

Procedure BankEverything(from, upto:integer);
begin
If(not(LoggedIn)) then exit;
for i:=from to upto do
if itemExists(i) then BankDeposit(i);
Mouse(426, 34, 15, 15, True);
end;
:)

~shut

Very nice i could learn alot from that script =) but (and correct me if im wrong) when does that actuly find the diposit box? also mine will click an item then the diposit box saving alot of time and alot less can go wrong in my opinion this works perfect every time at every location ive tested it 20+ times at draynor and it worked perfect all 20 times including all settings i cant think of any bugs exsept it asummes your already in the bank :p anyways im off to learn as much as i can about reflection i cant wait to start scripting in that :f:

Shuttleu

2008-09-25 18:55:16

From: bazzbarrett
Very nice i could learn alot from that script =) but (and correct me if im wrong) when does that actuly find the diposit box? also mine will click an item then the diposit box saving alot of time and alot less can go wrong in my opinion this works perfect every time at every location ive tested it 20+ times at draynor and it worked perfect all 20 times including all settings i cant think of any bugs exsept it asummes your already in the bank :p anyways im off to learn as much as i can about reflection i cant wait to start scripting in that :f:


yes your right it doesnt find the deposit box but i will my box opener as well then (i have only used this deposit bix opener at port kazahrd)
and a few changes to one of the functions
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 ItemExists(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, amount:integer; all:boolean );
var
Item: TPointArray;
T: integer;
begin
If(not(LoggedIn)) then exit;
if (i < 1) or (i > 28) then exit;
SetLength(Item, 29);
Item:= [Point(109+(0 * 48), 78+(0 * 50)), Point(109+(1 * 48), 78+(0 * 50)),
Point(109+(2 * 48), 78+(0 * 50)), Point(109+(3 * 48), 78+(0 * 50)),
Point(109+(4 * 48), 78+(0 * 50)), Point(109+(5 * 48), 78+(0 * 50)),
Point(109+(6 * 48), 78+(0 * 50)), Point(109+(0 * 48), 78+(1 * 50)),
Point(109+(1 * 48), 78+(1 * 50)), Point(109+(2 * 48), 78+(1 * 50)),
Point(109+(3 * 48), 78+(1 * 50)), Point(109+(4 * 48), 78+(1 * 50)),
Point(109+(5 * 48), 78+(1 * 50)), Point(109+(6 * 48), 78+(1 * 50)),
Point(109+(0 * 48), 78+(2 * 50)), Point(109+(1 * 48), 78+(2 * 50)),
Point(109+(2 * 48), 78+(2 * 50)), Point(109+(3 * 48), 78+(2 * 50)),
Point(109+(4 * 48), 78+(2 * 50)), Point(109+(5 * 48), 78+(2 * 50)),
Point(109+(6 * 48), 78+(2 * 50)), Point(109+(0 * 48), 78+(3 * 50)),
Point(109+(1 * 48), 78+(3 * 50)), Point(109+(2 * 48), 78+(3 * 50)),
Point(109+(3 * 48), 78+(3 * 50)), Point(109+(4 * 48), 78+(3 * 50)),
Point(109+(5 * 48), 78+(3 * 50)), Point(109+(6 * 48), 78+(3 * 50))];
if ItemExists(i) then
begin
Mouse(Item[i].x, Item[i].y, 20, 20, False);
Wait(400+random(400));
if all then
begin
if ChooseOption('sit-All') then
begin
T:=0
repeat
Inc(T);
Wait(500+random(500));
until (not(ItemExists(i))) or (T>=30);
end;
end else
begin
if ChooseOption('sit-X') then
begin
Wait(500+Random(500));
TypeSend(IntToStr(amount));
T:=0
repeat
Inc(T);
Wait(500+random(500));
until (not(ItemExists(i))) or (T>=30);
end;
end;
end;
end;

function DepositScreen: Boolean;
begin
If(not(LoggedIn)) then exit;
Result := FindText(x, y, 'ank', upchars, 92, 29, 396, 54);
end;

function OpenDeposit: Boolean;
var
x, y, i, l, c, z: Integer;
Info: TIntegerArray;
Booths, t: TPointArray;
begin
Wait(400);
Info := [MSCX, MSCY, 739167, 10, 2]
MakeCompass('n');
z := GetColorToleranceSpeed;
ColorToleranceSpeed(Info[4]);
FindColorsSpiralTolerance(Info[0], Info[1], Booths, Info[2], MSX1, MSY1, MSX2, MSY2, Info[3]);
ColorToleranceSpeed(z);
SetArrayLength(t, 0);
t := Booths;
SetArrayLength(Booths, 0);
Booths := ReArrangeAndShortenArray(t, 14);
l := GetArrayLength(Booths) -1;
for i := 0 to l do
begin
if (not LoggedIn) or DepositScreen then
Break;
MMouse(Booths[i].X, Booths[i].Y, 3, 3);
Wait(75 + Random(75));
if IsUpText('epos') Then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Wait(70 + Random(75));
FFLag(0);
MarkTime(c);
repeat
Wait(100);
until (DepositScreen)or (TimeFromMark(c) > 3000);
end;
end;
Result := (DepositScreen);
end;

Procedure BankEverything(from, upto:integer);
begin
If(not(LoggedIn)) then exit;
for i:=from to upto do
if itemExists(i) then BankDeposit(i, 0, True);
Mouse(426, 34, 15, 15, True);
end;
:)

~shut

bullzeye95

2008-09-25 21:25:30

    if II = 10 then
begin
Result := False;
Writeln('Deposit Box Never opened!');
Exit;
end;
I assume you're checking if the loop completed without you exiting. If so, you'd actually want to do "if II = 11 then" ;)

Good job though.

Nava2

2008-09-27 00:05:17

case LowerCase(Location) of
'lb', 'lumbridge': Info := 3161932;//done - checked
'feb', 'falador east': Info := 406857;//done - checked
'fwb', 'falador west': Info := 406857;//done - checked
'db', 'draynor': Info := 406857;//done - checked
'eb', 'edgeville bank': Info := 4809843;//done - checked
else
begin
srl_Warn('OpenBankFast', 'Unknown bank: '+Location, warn_AllVersions);
Exit;
end;

Don't lie. This doesn't compile.

A. There is no end on the case.
B. You don't even use the Info variable in the first function.

*Waits for response*

BazzBarrett

2008-09-27 17:01:10

From: Nava2
case LowerCase(Location) of
'lb', 'lumbridge': Info := 3161932;//done - checked
'feb', 'falador east': Info := 406857;//done - checked
'fwb', 'falador west': Info := 406857;//done - checked
'db', 'draynor': Info := 406857;//done - checked
'eb', 'edgeville bank': Info := 4809843;//done - checked
else
begin
srl_Warn('OpenBankFast', 'Unknown bank: '+Location, warn_AllVersions);
Exit;
end;

Don't lie. This doesn't compile.

A. There is no end on the case.
B. You don't even use the Info variable in the first function.

*Waits for response*


soz compleatly forgot about taht bit i tihnk i edited it about a day ago just never saw ur post ill duble check i know it works..

edit: lol by the //done - checked it lituraly just means ive checked the colors i only used the fast 1 =/ o well dm its all fixed now i hope every1 likes =)

Nava2

2008-09-28 01:24:23

That was harsh, sorry.

UgH. I was in a bad mood :( It was late :).

But, you do need to make sure everything works well before posting it.