Added use of the new functions in Timing.scar in SRL.
I noticed it got a bit messy, my excuses again.. It's hard showing everything without making a big mess.
Simply added WaitOption/WaitUpText to functions/procedures inside SRL.. Skipped those that don't need/would mess up at.
Note: Couldn't attach all the files, to many...
Bank.scar
WithdrawItemEx
New:
SCAR Code:
{*******************************************************************************
function WithdrawItemEx(Ident: integer; IdentType: string; var Index: integer; Amount: integer; UpText: String; Tol: TIntegerArray): boolean;
By: Nava2
Description: Withdraws an item from the bank by using "Ident" with tol[0]
as color tolerance, tol[1] as contour tolerance in case of bmp
masks, or the count of colors for TPA item finding.
Valid IdentTypes are all in FindItem.
Index: The Bank Index where the item is found, must be a variable.
Speeds up future withdraws.
Amount: Amount to withdraw from bank.
UpText: The UpText which the function checks for.
*******************************************************************************}
function WithdrawItemEx(Ident: integer; IdentType: string; var Index: integer; Amount: integer; UpText: String; Tol: TIntegerArray): Boolean;
var
x, y: integer;
BPoint: TPoint;
BankBox: TBox;
Found: Boolean;
t: TPointArray;
label
Start;
begin
Result := False;
if not BankScreen then Exit;
FixBank;
if (Index = 0) then
begin
Start:
for Index := 1 to 50 do
begin
if FindItemEx(x, y, IdentType, Ident, BankIndexToMSBox(Index), Tol) then
begin
MMouse(x, y, 4, 4);
if WaitUpText(UpText, 200+Random(100)) then
begin
Writeln('Found Item at Bank Slot ' + IntToStr(Index) + '.');
Found := True;
Break;
end else
Writeln('Found Incorrect Item, Moving to new Bank Spot.');
end;
end;
end else
begin
BankBox := BankIndexToMSBox(Index);
FindColors(t, 65536, BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2);
BankBox := GetTPABounds(t);
MouseBox(BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2, 3);
Wait(120 + Random(50));
if IsUpText(UpText) then
Found := true
else
begin
Writeln('Item Moved from Bank Slot ' + IntToStr(Index) + ', checking bank again.');
GoTo Start;
end;
end;
Wait(RandomRange(200, 350));
if Found then
begin
BPoint := BankIndexToBankPoint(Index);
//Writeln(IntToStr(BPoint.x) + ', ' + IntToStr(BPoint.y));
Withdraw(BPoint.x, BPoint.y, Amount);
Result := True;
end else
begin
Index := 0;
SRL_Warn('WithdrawItem', 'Could not Find ' + IdentType + ' in Bank. [Uptext: ' + UpText + ']', Warn_AllVersions);
end;
end;
end;
Old:
SCAR Code:
{*******************************************************************************
function WithdrawItemEx(Ident: integer; IdentType: string; var Index: integer; Amount: integer; UpText: String; Tol: TIntegerArray): boolean;
By: Nava2
Description: Withdraws an item from the bank by using "Ident" with tol[0]
as color tolerance, tol[1] as contour tolerance in case of bmp
masks, or the count of colors for TPA item finding.
Valid IdentTypes are all in FindItem.
Index: The Bank Index where the item is found, must be a variable.
Speeds up future withdraws.
Amount: Amount to withdraw from bank.
UpText: The UpText which the function checks for.
*******************************************************************************}
function WithdrawItemEx(Ident: integer; IdentType: string; var Index: integer; Amount: integer; UpText: String; Tol: TIntegerArray): Boolean;
var
x, y: integer;
BPoint: TPoint;
BankBox: TBox;
Found: Boolean;
t: TPointArray;
label
Start;
begin
Result := False;
if not BankScreen then Exit;
FixBank;
if (Index = 0) then
begin
Start:
for Index := 1 to 50 do
begin
if FindItemEx(x, y, IdentType, Ident, BankIndexToMSBox(Index), Tol) then
begin
MMouse(x, y, 4, 4);
Wait(120 + Random(50));
if IsUpText(UpText) then
begin
Writeln('Found Item at Bank Slot ' + IntToStr(Index) + '.');
Found := True;
Break;
end else
Writeln('Found Incorrect Item, Moving to new Bank Spot.');
end;
end;
end else
begin
BankBox := BankIndexToMSBox(Index);
FindColors(t, 65536, BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2);
BankBox := GetTPABounds(t);
MouseBox(BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2, 3);
Wait(120 + Random(50));
if IsUpText(UpText) then
Found := true
else
begin
Writeln('Item Moved from Bank Slot ' + IntToStr(Index) + ', checking bank again.');
GoTo Start;
end;
end;
Wait(RandomRange(200, 350));
if Found then
begin
BPoint := BankIndexToBankPoint(Index);
//Writeln(IntToStr(BPoint.x) + ', ' + IntToStr(BPoint.y));
Withdraw(BPoint.x, BPoint.y, Amount);
Result := True;
end else
begin
Index := 0;
SRL_Warn('WithdrawItem', 'Could not Find ' + IdentType + ' in Bank. [Uptext: ' + UpText + ']', Warn_AllVersions);
end;
end;
OpenBankQuiet
New:
SCAR Code:
{*******************************************************************************
function OpenBankQuiet(WhichBank: string): Boolean;
By: WT-Fakawi and modified by Ron
Description: Opens any given bank in the free world using
FindDeformedBitmapToleranceIn. Avoids strange mouse movements. Will cause
significant lag (approx. 1 second), but finds the bank with one click.
Valid arguments are:
'feb' (Falador East Bank)
'fwb' (Falador West Bank)
'veb' (Varrock East Bank)
'vwb' (Varrock West Bank)
'db' (Draynor Bank)
'eb' (Edgeville Bank)
'akb' (Al-Kharid Bank)
*******************************************************************************}
function OpenBankQuiet(WhichBank: string): Boolean;
var
TheCounter, dx, dy, tol, Mark2, Mark3: Integer;
acc, accthres: Extended;
begin
case WhichBank of
'feb', 'fwb': TheCounter := BitmapFromString(1, 10, '6C583296897A948779948779736' +
'C63A59E968C7F6F9686749B8A7685663E');
// varrock west
'vwb': TheCounter:= BitmapFromString(10, 1, 'A0997F504A49504A49504A495E4' +
'F215E4F215E4F215E4F212C250EA0997F');
// varrock east
'veb': TheCounter := BitmapFromString(1, 10, '5E4D1589826D88806D88806D867' +
'F6C9996907C7664847D648C836891876B');
// draynor and this works too for alkharid
'akb', 'db', 'eb': TheCounter:= BitmapFromString(12, 1, '584209735C29735C29735C29605' +
'85558504D60504D58504D58504D58504D58504D605855');
else
begin
srl_Warn('OpenBankQuiet', 'Unknown bank: ' + WhichBank, warn_AllVersions);
Exit;
end;
end;
MarkTime(Mark3);
tol := 1;
accthres := 0.6;
repeat
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
if BankScreen or PinScreen then
begin
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
if WaitUptextMulti(['ank', 'Bo', 'ot'], 200) then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, False);
if WaitOption('uickly', 200) then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen or PinScreen;
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
end;
FindDeformedBitmapToleranceIn(TheCounter, dx, dy, MSX1 + 50, MSY1 + 50, MSX2
- 50, MSY2 - 50, tol, 4, True, acc);
if (acc >= accthres) then
begin
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
if BankScreen or PinScreen then
begin
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
MMouse(dx, dy, 0, 0);
if WaitUptextMulti(['ank', 'Bo', 'ot'], 200) then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, False);
if WaitOption('uickly', 200) then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen or PinScreen;
end;
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
end;
Wait(100);
tol := tol + 4;
if tol >= 20 then
begin
tol := 1;
accthres := accthres - 0.1;
if accthres < 0.2 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
end;
until TimeFromMark(Mark3) > 60000;
FreeBitmap(TheCounter);
end;
Old:
SCAR Code:
{*******************************************************************************
function OpenBankQuiet(WhichBank: string): Boolean;
By: WT-Fakawi and modified by Ron
Description: Opens any given bank in the free world using
FindDeformedBitmapToleranceIn. Avoids strange mouse movements. Will cause
significant lag (approx. 1 second), but finds the bank with one click.
Valid arguments are:
'feb' (Falador East Bank)
'fwb' (Falador West Bank)
'veb' (Varrock East Bank)
'vwb' (Varrock West Bank)
'db' (Draynor Bank)
'eb' (Edgeville Bank)
'akb' (Al-Kharid Bank)
*******************************************************************************}
function OpenBankQuiet(WhichBank: string): Boolean;
var
TheCounter, dx, dy, tol, Mark2, Mark3: Integer;
acc, accthres: Extended;
begin
case WhichBank of
'feb', 'fwb': TheCounter := BitmapFromString(1, 10, '6C583296897A948779948779736' +
'C63A59E968C7F6F9686749B8A7685663E');
// varrock west
'vwb': TheCounter:= BitmapFromString(10, 1, 'A0997F504A49504A49504A495E4' +
'F215E4F215E4F215E4F212C250EA0997F');
// varrock east
'veb': TheCounter := BitmapFromString(1, 10, '5E4D1589826D88806D88806D867' +
'F6C9996907C7664847D648C836891876B');
// draynor and this works too for alkharid
'akb', 'db', 'eb': TheCounter:= BitmapFromString(12, 1, '584209735C29735C29735C29605' +
'85558504D60504D58504D58504D58504D58504D605855');
else
begin
srl_Warn('OpenBankQuiet', 'Unknown bank: ' + WhichBank, warn_AllVersions);
Exit;
end;
end;
MarkTime(Mark3);
tol := 1;
accthres := 0.6;
repeat
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
if BankScreen or PinScreen then
begin
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
if IsUpTextMultiCustom(['ank', 'Bo', 'ot']) then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, False);
if ChooseOption('uickly') then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen or PinScreen;
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
end;
FindDeformedBitmapToleranceIn(TheCounter, dx, dy, MSX1 + 50, MSY1 + 50, MSX2
- 50, MSY2 - 50, tol, 4, True, acc);
if (acc >= accthres) then
begin
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
if BankScreen or PinScreen then
begin
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
MMouse(dx, dy, 0, 0);
if IsUpTextMultiCustom(['ank', 'Bo', 'ot']) then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, False);
if ChooseOption('uickly') then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen or PinScreen;
end;
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
end;
Wait(100);
tol := tol + 4;
if tol >= 20 then
begin
tol := 1;
accthres := accthres - 0.1;
if accthres < 0.2 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
end;
until TimeFromMark(Mark3) > 60000;
FreeBitmap(TheCounter);
end;
OpenBankGlass
New:
SCAR Code:
{*******************************************************************************
function OpenBankGlass(WhichBank: String; ChangeCompass, ChangeAngle: Boolean): Boolean;
By: Wizzup? and modified by Ron updated to P2p banks by N1ke!
Description: Opens the bank.
Valid arguments are:
'feb' (Falador East Bank)
'fwb' (Falador West Bank)
'veb' (Varrock East Bank)
'vwb' (Varrock West Bank)
'db' (Draynor Bank)
'akb' (Al-Kharid Bank)
'ctb' (Catherby bank)
'clt' (Camelot bank)
'nab' (North Ardougne bank)
'sab' (South Ardougne bank)
'ynb' (Yanille bank)
'ngb' (North gnome bank)
'sgb' (South gnome bank)
'wgb' (Warrior guild bank)
'fgb' (Fishing guild bank)
*******************************************************************************}
function OpenBankGlass(WhichBank: string; ChangeCompass, ChangeAngle: Boolean): Boolean;
var
OBC: TPoint;
c, Speed, Col: Integer;
begin
Speed := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
if ChangeAngle then SetAngle(True);
if ChangeCompass then
begin
c := Random(2);
case WhichBank of
'feb', 'fwb', 'veb', 'ctb', 'clt', 'nab': if c = 0 then MakeCompass('N') else MakeCompass('S');
'akb', 'db', 'eb', 'vwb', 'sab', 'ynb', 'sgb', 'wgb', 'fgb': if c = 0 then MakeCompass('E') else MakeCompass('W');
'ngb': if c = 0 then MakeCompass(45) else MakeCompass(225);
end;
end;
Col := 10070458;
If (WhichBank = 'nab') or (WhichBank = 'sab')then
Col := 8095371;
if FindColorSpiralTolerance(OBC.x, OBC.y, Col, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(OBC.x, OBC.y, 4, 4);
if WaitUptextMulti(['nk', 'bo', 'ot'], 200) then
begin
Mouse(OBC.x, OBC.y, 0, 0, False);
WaitOption('uickly', 200);
FFlag(0);
Wait(2000 + Random(500));
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
end;
end else
if FindObj(OBC.x, OBC.y, 'ank', 10070458, 20) then
begin
Mouse(OBC.x, OBC.y, 0, 0, False);
WaitOption('uickly', 200);
FFlag(0);
Wait(2000 + Random(500));
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
end;
ColorToleranceSpeed(Speed);
end;
Old:
SCAR Code:
{*******************************************************************************
function OpenBankGlass(WhichBank: String; ChangeCompass, ChangeAngle: Boolean): Boolean;
By: Wizzup? and modified by Ron updated to P2p banks by N1ke!
Description: Opens the bank.
Valid arguments are:
'feb' (Falador East Bank)
'fwb' (Falador West Bank)
'veb' (Varrock East Bank)
'vwb' (Varrock West Bank)
'db' (Draynor Bank)
'akb' (Al-Kharid Bank)
'ctb' (Catherby bank)
'clt' (Camelot bank)
'nab' (North Ardougne bank)
'sab' (South Ardougne bank)
'ynb' (Yanille bank)
'ngb' (North gnome bank)
'sgb' (South gnome bank)
'wgb' (Warrior guild bank)
'fgb' (Fishing guild bank)
*******************************************************************************}
function OpenBankGlass(WhichBank: string; ChangeCompass, ChangeAngle: Boolean): Boolean;
var
OBC: TPoint;
c, Speed, Col: Integer;
begin
Speed := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
if ChangeAngle then SetAngle(True);
if ChangeCompass then
begin
c := Random(2);
case WhichBank of
'feb', 'fwb', 'veb', 'ctb', 'clt', 'nab': if c = 0 then MakeCompass('N') else MakeCompass('S');
'akb', 'db', 'eb', 'vwb', 'sab', 'ynb', 'sgb', 'wgb', 'fgb': if c = 0 then MakeCompass('E') else MakeCompass('W');
'ngb': if c = 0 then MakeCompass(45) else MakeCompass(225);
end;
end;
Col := 10070458;
If (WhichBank = 'nab') or (WhichBank = 'sab')then
Col := 8095371;
if FindColorSpiralTolerance(OBC.x, OBC.y, Col, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(OBC.x, OBC.y, 4, 4);
Wait(RandomRange(80, 110));
if IsUpTextMultiCustom(['nk', 'bo', 'ot']) then
begin
Mouse(OBC.x, OBC.y, 0, 0, False);
Wait(RandomRange(80, 110));
ChooseOption('uickly');
FFlag(0);
Wait(2000 + Random(500));
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
end;
end else
if FindObj(OBC.x, OBC.y, 'ank', 10070458, 20) then
begin
Mouse(OBC.x, OBC.y, 0, 0, False);
Wait(RandomRange(80, 110));
ChooseOption('uickly');
FFlag(0);
Wait(2000 + Random(500));
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
end;
ColorToleranceSpeed(Speed);
end;
OpenBankFast
New:
SCAR Code:
{*******************************************************************************
function OpenBankFast(Location: String): Boolean;
By: Wizzup? and Nielsie95 updated by N1ke!
Description: Opens the bank.
Valid arguments are:
'feb', 'falador east bank'
'fwb', 'falador west bank'
'veb', 'varrock east bank'
'vwb', 'varrock west bank'
'db' , 'draynor bank'
'akb', 'al-kharid bank'
'ctb', 'catherby bank'
'clt', 'camelot bank'
'nab', 'north ardougne bank'
'sab', 'south ardougne bank'
'ynb', 'yanille bank'
'ngb', 'north gnome bank'
'sgb', 'south gnome bank'
'wgb', 'warrior guild bank'
'fgb', 'fishing guild bank'
*******************************************************************************}
function OpenBankFast(Location: String): Boolean;
var
x, y, i, l, c, z: Integer;
Info: TIntegerArray;
Booths, t: TPointArray;
begin
Wait(400);
case LowerCase(Location) of
'akb', 'al kharid': Info := [MSCX, MSCY, 7969203, 25, 1];
'lb', 'lumbridge': Info := [MSCX, MSCY, 4807788, 10, 1];
'veb', 'varrock east': Info := [MSCX, MSCY, 2971236, 10, 1];
'vwb', 'varrock west': Info := [270, 270, 5689318, 25, 1];
'feb', 'falador east': Info := [MSCX, MSCY + 50, 4612728, 14, 1];
'fwb', 'falador west': Info := [MSCY, MSCY, 4612728, 14, 1];
'db', 'draynor': Info := [MSCX, MSCY, 2512235, 4, 2];
'eb', 'edgeville bank': Info := [MSCX + 50, MSCY, 3230295, 9, 2];
'ctb', 'catherby bank': Info := [MSCX, MSCY, 3239049, 8, 2];
'clt', 'camelot bank': Info := [MSCX, MSCY, 7636882, 5, 2];
'nab', 'north ardougne bank': Info := [MSCX, MSCY, 4084572, 5, 2];
'sab', 'south ardougne bank': Info := [MSCX, MSCY, 4084572, 5, 2];
'ynb', 'yanille bank': Info := [MSCX, MSCY, 3239049, 7, 2];
'ngb', 'north gnome bank': Info := [MSCX, MSCY, 3239049, 7, 2];
'sgb', 'south gnome bank': Info := [MSCX, MSCY, 3239049, 7, 2];
'wgb', 'warrior guild bank': Info := [MSCX, MSCY, 2578286, 7, 2];
'fgb', 'fishing guild bank': Info := [MSCX, MSCY, 2908796, 10, 2];
else
begin
srl_Warn('OpenBankFast', 'Unknown bank: '+Location, warn_AllVersions);
Exit;
end;
end;
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 BankScreen or PinScreen then
Break;
if (LowerCase(Location) = 'vwb') or (LowerCase(Location) = 'varrock west') then
begin
Booths[i].X := Booths[i].X + 5;
Booths[i].Y := Booths[i].Y - 20;
end;
MMouse(Booths[i].X, Booths[i].Y, 3, 3);
if WaitUpText('ooth', 200) Then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
if WaitOption('uickly', 200) then
begin
FFLag(0);
MarkTime(c);
repeat
Wait(100);
until (BankScreen) or (PinScreen) or (TimeFromMark(c) > 3000);
Wait(Random(300));
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
end;
end;
end;
Result := (BankScreen) or (PinScreen);
end;
Old:
SCAR Code:
{*******************************************************************************
function OpenBankFast(Location: String): Boolean;
By: Wizzup? and Nielsie95 updated by N1ke!
Description: Opens the bank.
Valid arguments are:
'feb', 'falador east bank'
'fwb', 'falador west bank'
'veb', 'varrock east bank'
'vwb', 'varrock west bank'
'db' , 'draynor bank'
'akb', 'al-kharid bank'
'ctb', 'catherby bank'
'clt', 'camelot bank'
'nab', 'north ardougne bank'
'sab', 'south ardougne bank'
'ynb', 'yanille bank'
'ngb', 'north gnome bank'
'sgb', 'south gnome bank'
'wgb', 'warrior guild bank'
'fgb', 'fishing guild bank'
*******************************************************************************}
function OpenBankFast(Location: String): Boolean;
var
x, y, i, l, c, z: Integer;
Info: TIntegerArray;
Booths, t: TPointArray;
begin
Wait(400);
case LowerCase(Location) of
'akb', 'al kharid': Info := [MSCX, MSCY, 7969203, 25, 1];
'lb', 'lumbridge': Info := [MSCX, MSCY, 4807788, 10, 1];
'veb', 'varrock east': Info := [MSCX, MSCY, 2971236, 10, 1];
'vwb', 'varrock west': Info := [270, 270, 5689318, 25, 1];
'feb', 'falador east': Info := [MSCX, MSCY + 50, 4612728, 14, 1];
'fwb', 'falador west': Info := [MSCY, MSCY, 4612728, 14, 1];
'db', 'draynor': Info := [MSCX, MSCY, 2512235, 4, 2];
'eb', 'edgeville bank': Info := [MSCX + 50, MSCY, 3230295, 9, 2];
'ctb', 'catherby bank': Info := [MSCX, MSCY, 3239049, 8, 2];
'clt', 'camelot bank': Info := [MSCX, MSCY, 7636882, 5, 2];
'nab', 'north ardougne bank': Info := [MSCX, MSCY, 4084572, 5, 2];
'sab', 'south ardougne bank': Info := [MSCX, MSCY, 4084572, 5, 2];
'ynb', 'yanille bank': Info := [MSCX, MSCY, 3239049, 7, 2];
'ngb', 'north gnome bank': Info := [MSCX, MSCY, 3239049, 7, 2];
'sgb', 'south gnome bank': Info := [MSCX, MSCY, 3239049, 7, 2];
'wgb', 'warrior guild bank': Info := [MSCX, MSCY, 2578286, 7, 2];
'fgb', 'fishing guild bank': Info := [MSCX, MSCY, 2908796, 10, 2];
else
begin
srl_Warn('OpenBankFast', 'Unknown bank: '+Location, warn_AllVersions);
Exit;
end;
end;
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 BankScreen or PinScreen then
Break;
if (LowerCase(Location) = 'vwb') or (LowerCase(Location) = 'varrock west') then
begin
Booths[i].X := Booths[i].X + 5;
Booths[i].Y := Booths[i].Y - 20;
end;
MMouse(Booths[i].X, Booths[i].Y, 3, 3);
Wait(125 + Random(75));
if IsUpText('ooth') Then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(75 + Random(75));
if ChooseOption('uickly') then
begin
FFLag(0);
MarkTime(c);
repeat
Wait(100);
until (BankScreen) or (PinScreen) or (TimeFromMark(c) > 3000);
Wait(Random(300));
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
end;
end;
end;
Result := (BankScreen) or (PinScreen);
end;
GameTab.scar
SetRest
New:
SCAR Code:
{*******************************************************************************
function SetRest: Boolean;
By: ZephyrsFury
Description: Turns Rest on. Result True if successful.
*******************************************************************************}
function SetRest: Boolean;
var
T: Integer;
begin
if (CountColor(3777879, 713, 107, 732, 115) < 10) then
begin
Mouse(715, 95, 10, 10, False);
if (WaitOption('Rest', 200)) then
begin
T := GetSystemTime;
while (CountColor(3777879, 713, 107, 732, 115) < 10) and (GetSystemTime - T < 5000) do
Wait(100);
Result := (CountColor(3777879, 713, 107, 732, 115) > 10);
end;
end;
end;
Old:
SCAR Code:
{*******************************************************************************
function SetRest: Boolean;
By: ZephyrsFury
Description: Turns Rest on. Result True if successful.
*******************************************************************************}
function SetRest: Boolean;
var
T: Integer;
begin
if (CountColor(3777879, 713, 107, 732, 115) < 10) then
begin
Mouse(715, 95, 10, 10, False);
Wait(100 + Random(100));
if (ChooseOption('Rest')) then
begin
T := GetSystemTime;
while (CountColor(3777879, 713, 107, 732, 115) < 10) and (GetSystemTime - T < 5000) do
Wait(100);
Result := (CountColor(3777879, 713, 107, 732, 115) > 10);
end;
end;
end;
Inventory.scar
ClickAllItemsExcept
New:
SCAR Code:
{*******************************************************************************
function ClickAllItemsExcept(Identifier: Integer; ItemType, option: string; SlotIgnores: TIntegerArray; waitnum: Integer; tol: TIntegerArray):Integer;
By: WT-Fakawi / Sumilion & Nava2
Description: Performs "option" popup menu action on all items with:
ItemType - 'dtm', 'bitmap', 'bitmap mask', 'color'
Item - name/value of your dtm/bmp/color/bmpmask.
Tol - 'dtm' - [] (dtm's can't have tolerance).
'bmp' - [BMPTol].
'color' - [COLOUR Tol, Colour Count].
'bmpmask' - [BMPTol, ContourTol].
Will not click items in slots SlotIgnores
*******************************************************************************}
function ClickAllItemsExcept(Identifier: Integer; ItemType, option: string; SlotIgnores: TIntegerArray; waitnum: Integer; tol: TIntegerArray):Integer;
var
i, x, y: Integer;
TB: Tbox;
arr:array of Integer;
begin
Result := 0;
arr :=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,
18,19,20,21,22,23,24,25,26,27,28];
for i := 1 to 28 - 4 do
Swap(arr[RandomRange(i - 1, i + 4)], arr[RandomRange(i - 1, i + 4)] );
SetLength(Tol, 2);
GameTab(4);
for i := 0 to 27 do
begin
if InIntArray(SlotIgnores, arr[i] + 1) then Continue;
TB := InvBox(arr[i]);
if ExistsItem(arr[i]) then
try
if not FindItemEx(x, y, ItemType, Identifier, TB, Tol) then Continue;
if Option <> '' then
begin
MouseItem(arr[i], False);
WaitOption(Option, waitnum);
Inc(Result);
end
else
MouseItem(arr[i], True);
Wait(waitnum);
except end;
end;
end;
Old:
SCAR Code:
{*******************************************************************************
function ClickAllItemsExcept(Identifier: Integer; ItemType, option: string; SlotIgnores: TIntegerArray; waitnum: Integer; tol: TIntegerArray):Integer;
By: WT-Fakawi / Sumilion & Nava2
Description: Performs "option" popup menu action on all items with:
ItemType - 'dtm', 'bitmap', 'bitmap mask', 'color'
Item - name/value of your dtm/bmp/color/bmpmask.
Tol - 'dtm' - [] (dtm's can't have tolerance).
'bmp' - [BMPTol].
'color' - [COLOUR Tol, Colour Count].
'bmpmask' - [BMPTol, ContourTol].
Will not click items in slots SlotIgnores
*******************************************************************************}
function ClickAllItemsExcept(Identifier: Integer; ItemType, option: string; SlotIgnores: TIntegerArray; waitnum: Integer; tol: TIntegerArray):Integer;
var
i, x, y: Integer;
TB: Tbox;
arr:array of Integer;
begin
Result := 0;
arr :=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,
18,19,20,21,22,23,24,25,26,27,28];
for i := 1 to 28 - 4 do
Swap(arr[RandomRange(i - 1, i + 4)], arr[RandomRange(i - 1, i + 4)] );
SetLength(Tol, 2);
GameTab(4);
for i := 0 to 27 do
begin
if InIntArray(SlotIgnores, arr[i] + 1) then Continue;
TB := InvBox(arr[i]);
if ExistsItem(arr[i]) then
try
if not FindItemEx(x, y, ItemType, Identifier, TB, Tol) then Continue;
if Option <> '' then
begin
MouseItem(arr[i], False);
Wait(waitnum);
ChooseOption(option);
Inc(Result);
end
else
MouseItem(arr[i], True);
Wait(waitnum);
except end;
end;
end;
DropItem
New:
SCAR Code:
{*******************************************************************************
procedure DropItem(i: Integer);
By: Lorax
Description: Drops item at given position (1-28)
*******************************************************************************}
function DropItem(i: Integer): Boolean;
begin
Result := False;
if ExistsItem(i) then
begin
MouseItem(i, False);
if (WaitOption('rop', 250)) then
begin
Result := True;
Wait(RandomRange(50, 200));
end;
end;
end;
Old:
SCAR Code:
{*******************************************************************************
procedure DropItem(i: Integer);
By: Lorax
Description: Drops item at given position (1-28)
*******************************************************************************}
function DropItem(i: Integer): Boolean;
begin
Result := False;
if ExistsItem(i) then
begin
MouseItem(i, False);
Wait(170 + Random(50));
if (ChooseOption('rop')) then
begin
Result := True;
Wait(RandomRange(50, 200));
end;
end;
end;
ClickAllItemsBlackLine
New:
SCAR Code:
{*******************************************************************************
Function ClickAllItemsBlackLine(Count, Tol: Integer; Option: String): Integer;
By: n3ss3s
Description: Finds all items in inventory with blackline points amount of Count
with Tol tolerance, and returns the amount of items could choose the
option Option to. Waits the WaitT amount of millisecs between items, with
WaitR randomness of milliseconds.
*******************************************************************************}
Function ClickAllItemsBlackLine(Count, Tol, WaitT, WaitR: Integer; Option: String): Integer;
Var
TPA: TPointArray;
X, Y, Z, H: Integer;
TPAA: T2DPointArray;
Begin
GameTab(2);
FindColorsTolerance(TPA, 65536, MIX1, MIY1, MIX2, MIY2, 0);
TPAA := TPAToATPAEx(TPA, 42, 36);
H := High(TPAA);
For z := 0 To H Do
If InRange(GetArrayLength(TPAA[z]), Count - Tol, Count + Tol) Then
Begin
MiddleTPAEx(TPAA[z], X, Y);
Mouse(X, Y, 2, 2, False);
If WaitOption(Option, 250) Then
Begin
Result := Result + 1;
Wait(WaitT + Random(WaitR));
End;
End;
End;
Old:
SCAR Code:
{*******************************************************************************
Function ClickAllItemsBlackLine(Count, Tol: Integer; Option: String): Integer;
By: n3ss3s
Description: Finds all items in inventory with blackline points amount of Count
with Tol tolerance, and returns the amount of items could choose the
option Option to. Waits the WaitT amount of millisecs between items, with
WaitR randomness of milliseconds.
*******************************************************************************}
Function ClickAllItemsBlackLine(Count, Tol, WaitT, WaitR: Integer; Option: String): Integer;
Var
TPA: TPointArray;
X, Y, Z, H: Integer;
TPAA: T2DPointArray;
Begin
GameTab(2);
FindColorsTolerance(TPA, 65536, MIX1, MIY1, MIX2, MIY2, 0);
TPAA := TPAToATPAEx(TPA, 42, 36);
H := High(TPAA);
For z := 0 To H Do
If InRange(GetArrayLength(TPAA[z]), Count - Tol, Count + Tol) Then
Begin
MiddleTPAEx(TPAA[z], X, Y);
Mouse(X, Y, 2, 2, False);
If ChooseOption(Option) Then
Begin
Result := Result + 1;
Wait(WaitT + Random(WaitR));
End;
End;
End;
Mouse.scar
Added
SCAR Code:
Function WaitUptextMulti(S: TStringArray; Time: integer): Boolean;Forward;
To line 268, So it compiles.
SpiralMouseMulti
New:
SCAR Code:
{*******************************************************************************
function SpiralMouseMulti(var fx, fy: Integer; x1, y1, x2, y2: Integer; UpText: TStringArray; PpC, aInc: Integer): Boolean;
By: Nava2
Description: Spirals the mouse in a circle from the center of the defined box.
It will continue to spiral until it finds a spiral completely outside
the box, always skipping points outside.
Returns the occurance of the first occurance of UpText into fx, fy.
Takes multiple UpTexts as a TStringArray.
PpC: The number of pixels to increase per spiral.
aInc: The number of stops to make around each spiral.
Takes some testing to get the right combination of PpC and aInc.
*******************************************************************************}
function SpiralMouseMulti(var fx, fy: Integer; x1, y1, x2, y2: Integer; UpText: TStringArray; PpC, aInc: Integer): Boolean;
var
aStep, a, rStep, rV, oB: Extended;
pX, pY, ms: Integer;
sP: TPoint;
L2R: Boolean;
begin
Result := False;
ms := MouseSpeed;
MouseSpeed := 25 + RandomRange(-3, 3);
sP := MiddleTPA([Point(x1, y1), Point(x2, y2)]);
aStep := Pi / (aInc / 2);
a := 0;
rStep := (PpC / aInc);
L2R := Random(2) = 0;
//Writeln('aStep: ' + FloatToStr(aStep) + ' rStep ' + FloatToStr(rStep));
repeat
rV := rV + rStep;
pX := Round(rV * cos(a)) + sP.x;
pY := Round(rV * sin(a)) + sP.y;
if L2R then
a := a + aStep
else
a := a - aStep;
if InRange(pX, x1, x2) and InRange(pY, y1, y2) then
begin
oB := 0;
MMouse(pX - 2, pY - 2, 5, 5);
if WaitUptextMulti(UpText, 100+Random(60)) then
begin
GetMousePos(fx, fy);
Result := True;
end;
end else
oB := oB + aStep;
until Result or (oB > (2 * Pi));
MouseSpeed := ms;
end;
Old:
SCAR Code:
{*******************************************************************************
function SpiralMouseMulti(var fx, fy: Integer; x1, y1, x2, y2: Integer; UpText: TStringArray; PpC, aInc: Integer): Boolean;
By: Nava2
Description: Spirals the mouse in a circle from the center of the defined box.
It will continue to spiral until it finds a spiral completely outside
the box, always skipping points outside.
Returns the occurance of the first occurance of UpText into fx, fy.
Takes multiple UpTexts as a TStringArray.
PpC: The number of pixels to increase per spiral.
aInc: The number of stops to make around each spiral.
Takes some testing to get the right combination of PpC and aInc.
*******************************************************************************}
function SpiralMouseMulti(var fx, fy: Integer; x1, y1, x2, y2: Integer; UpText: TStringArray; PpC, aInc: Integer): Boolean;
var
aStep, a, rStep, rV, oB: Extended;
pX, pY, ms: Integer;
sP: TPoint;
L2R: Boolean;
begin
Result := False;
ms := MouseSpeed;
MouseSpeed := 25 + RandomRange(-3, 3);
sP := MiddleTPA([Point(x1, y1), Point(x2, y2)]);
aStep := Pi / (aInc / 2);
a := 0;
rStep := (PpC / aInc);
L2R := Random(2) = 0;
//Writeln('aStep: ' + FloatToStr(aStep) + ' rStep ' + FloatToStr(rStep));
repeat
rV := rV + rStep;
pX := Round(rV * cos(a)) + sP.x;
pY := Round(rV * sin(a)) + sP.y;
if L2R then
a := a + aStep
else
a := a - aStep;
if InRange(pX, x1, x2) and InRange(pY, y1, y2) then
begin
oB := 0;
MMouse(pX - 2, pY - 2, 5, 5);
Wait(100 + Random(60));
if IsUpTextMultiCustom(UpText) then
begin
GetMousePos(fx, fy);
Result := True;
end;
end else
oB := oB + aStep;
until Result or (oB > (2 * Pi));
MouseSpeed := ms;
end;
Object.scar
FindObjEx
New:
SCAR Code:
{*******************************************************************************
function FindObjEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
Tol, Step, xs, ys, xe, ye: Integer): Boolean;
By: Starblaster100
Description: Searches for an object using an array of colors and texts within the area
you specify. Will start searching from the middle and returns true if found.
Parameters:
cx, cy: Coordinate Position of object if result is true
Text: Array of string you want to search for
Color: Array of colors you want to search for
Tol: Tolerance of the colors you will allow
Step: How big you want to make the search squares. 50 = Default. 30-70 Recommended
xs, ys, xe, ye: Bounds you want to search in
*******************************************************************************}
function FindObjEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
Tol, Step, xs, ys, xe, ye: Integer): Boolean;
var
CurX, CurY, a, b, c, i: Integer;
Start: Boolean;
begin
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorSpiralTolerance(cx, cy, color[b], xs, ys, xe, ye, Tol)) then
begin
Start := True;
Break;
end;
end;
if (Start) then
begin
CurX := Round((xs + xe) div 2);
CurY := Round((ys + ye) div 2) - Step;
i := 1;
repeat
for c := 1 to i do
begin
case a of
0: begin //To allow for beginning offset and loop
a := a + 1;
i := 0;
CurY := CurY + Step;
end;
1: CurX := CurX + Step;
2: CurY := CurY - Step;
3: CurX := CurX - Step;
4: CurY := CurY + Step;
end;
if (CurX >= xs) and (CurX <= xe) and (CurY >= ys) and (CurY <= ye) then
begin
try
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorTolerance(cx, cy, Color[b], CurX-(Step/2), CurY-(Step/2), CurX+(Step/2), CurY+(Step/2), Tol)) then
begin
MMouse(cx, cy, 3, 3);
If (WaitUptextMulti(Text, 75+Random(50))) then
begin
GetMousePos(cx, cy);
Result := True;
Exit;
end;
end;
end;
except
end;
end;
end;
a := a + 1;
if a mod 5 = 0 then a := 1;
if (a = 1) or (a = 3) then i := i + 1;
until (Result) or ((CurX > xe) and (CurY > ye))
end;
end;
Old:
SCAR Code:
{*******************************************************************************
function FindObjEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
Tol, Step, xs, ys, xe, ye: Integer): Boolean;
By: Starblaster100
Description: Searches for an object using an array of colors and texts within the area
you specify. Will start searching from the middle and returns true if found.
Parameters:
cx, cy: Coordinate Position of object if result is true
Text: Array of string you want to search for
Color: Array of colors you want to search for
Tol: Tolerance of the colors you will allow
Step: How big you want to make the search squares. 50 = Default. 30-70 Recommended
xs, ys, xe, ye: Bounds you want to search in
*******************************************************************************}
function FindObjEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
Tol, Step, xs, ys, xe, ye: Integer): Boolean;
var
CurX, CurY, a, b, c, i: Integer;
Start: Boolean;
begin
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorSpiralTolerance(cx, cy, color[b], xs, ys, xe, ye, Tol)) then
begin
Start := True;
Break;
end;
end;
if (Start) then
begin
CurX := Round((xs + xe) div 2);
CurY := Round((ys + ye) div 2) - Step;
i := 1;
repeat
for c := 1 to i do
begin
case a of
0: begin //To allow for beginning offset and loop
a := a + 1;
i := 0;
CurY := CurY + Step;
end;
1: CurX := CurX + Step;
2: CurY := CurY - Step;
3: CurX := CurX - Step;
4: CurY := CurY + Step;
end;
if (CurX >= xs) and (CurX <= xe) and (CurY >= ys) and (CurY <= ye) then
begin
try
for b := 0 to (GetArrayLength(Color)-1) do
begin
if (FindColorTolerance(cx, cy, Color[b], CurX-(Step/2), CurY-(Step/2), CurX+(Step/2), CurY+(Step/2), Tol)) then
begin
MMouse(cx, cy, 3, 3);
Wait(50 + Random(50));
If (IsUpTextMultiCustom(Text)) then
begin
GetMousePos(cx, cy);
Result := True;
Exit;
end;
end;
end;
except
end;
end;
end;
a := a + 1;
if a mod 5 = 0 then a := 1;
if (a = 1) or (a = 3) then i := i + 1;
until (Result) or ((CurX > xe) and (CurY > ye))
end;
end;
FindObjectDeformed
New:
SCAR Code:
{*******************************************************************************
function FindObjectDeformed(var ObjX, ObjY: Integer; UpText1, UpText2: String; BMP, a, b, c, d: Integer): Boolean;
By: WT-Fakawi
Description: Finds Object in Box a,b,c,d, specified by BitMap and Uptext1 or Uptext2
Returns coords in ObjX and ObjY.
Uses Deformed Bitmap. FindObjectDeformed will gradually lower Tol and reduce Accuracy.
Functon can cause severe Lag when using bitmaps bigger then 16 pixels. Works but Lags.
*******************************************************************************}
function FindObjectDeformed(var ObjX, ObjY: Integer; UpText1, UpText2: string;
BMP, a, b, c, d: Integer): Boolean;
var
acc, ref: Extended;
XT, YT, times, tol: Integer;
begin
ref := 0.9;
tol := 0;
for times := 1 to 50 do
begin
FindDeformedBitmapToleranceIn(BMP, XT, YT, a, b, c, d, tol, 2, True, acc);
if (acc >= ref) then
begin
MMouse(XT, YT, 0, 0);
if (WaitUptextMulti([UpText1, UpText2], 400+Random(400))) then
begin
ObjX := XT;
ObjY := YT;
Result := True;
Exit;
end;
end;
if times mod 5 = 0 then
begin
ref := ref - 0.1;
tol := tol + 10;
end;
Wait(1);
end;
end;
Old:
SCAR Code:
{*******************************************************************************
function FindObjectDeformed(var ObjX, ObjY: Integer; UpText1, UpText2: String; BMP, a, b, c, d: Integer): Boolean;
By: WT-Fakawi
Description: Finds Object in Box a,b,c,d, specified by BitMap and Uptext1 or Uptext2
Returns coords in ObjX and ObjY.
Uses Deformed Bitmap. FindObjectDeformed will gradually lower Tol and reduce Accuracy.
Functon can cause severe Lag when using bitmaps bigger then 16 pixels. Works but Lags.
*******************************************************************************}
function FindObjectDeformed(var ObjX, ObjY: Integer; UpText1, UpText2: string;
BMP, a, b, c, d: Integer): Boolean;
var
acc, ref: Extended;
XT, YT, times, tol: Integer;
begin
ref := 0.9;
tol := 0;
for times := 1 to 50 do
begin
FindDeformedBitmapToleranceIn(BMP, XT, YT, a, b, c, d, tol, 2, True, acc);
if (acc >= ref) then
begin
MMouse(XT, YT, 0, 0);
Wait(400 + Random(400));
if (IsUpText(UpText1) or IsUpText(UpText2)) then
begin
ObjX := XT;
ObjY := YT;
Result := True;
Exit;
end;
end;
if times mod 5 = 0 then
begin
ref := ref - 0.1;
tol := tol + 10;
end;
Wait(1);
end;
end;
__________________________________________________ ________________________________________
Use turtoise diff to check the diffrence between these.
New Bank.scar
SCAR Code:
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Bank Routines --//
//-----------------------------------------------------------------//
// * function BankScreen: Boolean; // * by SRL Dev Team
// * function DepositScreen: Boolean; // * by Shuttleu
// * function PinScreen: Boolean; // * by Starblaster100
// * function InPin(Pin: string): Boolean; // * by ZephyrsFury and Nava2
// * function BankIndexToBankPoint(Ind: Integer): TPoint; // * by Wizzup
// * function BankPointToIndex(P: TPoint): Integer; // * by Wizzup
// * function BankIndexToMSBox(Ind: Integer): TBox; // * by Wizzup
// * function MSTPointToBankIndex(P: TPoint): Integer; // * by Wizzup
// * function DepositItemBox: TBox; // * by ZephyrsFury
// * Procedure Fixbank // * by lordsaturn & Nava2
// * Function FixBankTab: Boolean; // * by Wizzup?
// * Function CurrentBankTab: Integer; // * by Narcle
// * Function ExistsBankTab(T: Integer): Boolean; // * by Narcle
// * Function BankTab(T: Integer): Boolean; // * by Narcle
// * procedure SearchBank(Item: string); // * by ZephyrsFury
// * Procedure Deposit(SlotFrom, SlotTo: Integer; vType: Variant); // * by PPLSUQBAWLZ / Stupid3ooo
// * procedure Withdraw(Col,Row,Amount:integer); // * by Odie3355/Stupid3ooo/Starblaster100 fixed by Town
// * procedure DepositAll; // * by ZephyrsFury
// * procedure Notes(SwitchOn: Boolean); // * by lordsaturn, idea by R1ch
// * Procedure CloseBank; // * by Starblaster100
// * Function OpenBankQuiet(WhichBank:string):Boolean; // * by WT-Fakawi
// * Function OpenBankGlass(WhichBank:String; ChangeCompass:Boolean): Boolean; // * By Wizzup? & N1ke!
// * function OpenBankFast(Location: String): Boolean; // * by Wizzup?, Nielsie95 & N1ke!
// * function OpenBank(WhichBank:String; ChangeCompass:Boolean): Boolean; // * by SRL
// * Function FindBank(TheBank: string): Boolean; // * by WT-Fakawi & N1ke!
// * function OpenDepositBox: Boolean; // * by Shuttleu
{*******************************************************************************
function BankScreen: Boolean;
by: SRL Dev Team
Description: Finds Bankscreen. Returns true if Found.
*******************************************************************************}
function BankScreen: Boolean;
var
c: Integer;
begin
if (CountColor(0, MSX1, MSY1, MSX2, MSY2) > 113000) then
begin
MouseBox(26, 138, 489, 157, 1);
c := GetTimeRunning + 45000;
while (not BankScreen) and (GetTimeRunning < c) do
Wait(50);
Wait(RandomRange(100, 150));
end;
Result := FindTextTPA(4106994, 20, 20, 22, 400, 45, 'Bank', upchars, Nothing);
end;
{*******************************************************************************
function DepositScreen: Boolean;
by: Shuttleu
Description: Returns true if deposit screen is Found.
*******************************************************************************}
function DepositScreen: Boolean;
var
X, Y: Integer;
begin
Result := FindText(x, y, 'Deposit Box', upchars, 92, 29, 396, 54);
end;
{*******************************************************************************
function PinScreen: Boolean;
by: Starblaster100
Description: Finds Pin Screen. Returns true if Found.
*******************************************************************************}
function PinScreen: Boolean;
Var
x, y: Integer;
begin
Result := FindText(x, y, 'First', upchars, 175, 80, 212, 100);
end;
{*******************************************************************************
function InPin(Pin: String): Boolean;
by: ZephyrsFury and Nava2
Description: Enters bank pin. Will try 3 times, returns true if bank is opened.
*******************************************************************************}
function InPin(Pin: string): Boolean;
var
TMouseSpeed, iNumber, Tx, Ty, Counter, i: Integer;
Boxes: array of TBox;
OnBox: Boolean;
begin
Result := False;
if (not(PinScreen)) then Exit;
if (GetNumbers(Pin) <> Pin) then
begin
srl_Warn('InPin', '''' + Pin + ''' is not a valid Pin', warn_AllVersions);
Exit;
end;
if (Length(Pin) <> 4) then
begin
srl_Warn('InPin', 'Pin must be 4 digits long', warn_AllVersions);
Exit;
end;
Boxes := [IntToBox(37, 107, 100, 170), IntToBox(131, 107, 194, 170), IntToBox(225, 107, 288, 170), IntToBox(309, 107, 372, 170),
IntToBox(37, 179, 100, 242), IntToBox(131, 179, 194, 242), IntToBox(225, 179, 288, 242), IntToBox(37, 251, 100, 314),
IntToBox(131, 251, 194, 314), IntToBox(225, 251, 288, 314)];
TMouseSpeed := MouseSpeed;
MouseSpeed := 25;
Counter := 0;
repeat
if (PinScreen) then
begin
for iNumber := 1 to Length(Pin) do
begin
if OnBox then
begin
repeat
Tx := Random(MSX2);
Ty := Random(MSY2);
for i := 0 to 9 do
begin
if IntInBox(Tx, ty, Boxes[i]) then
begin
OnBox := True;
Break;
end;
OnBox := False;
end;
until (not(OnBox));
MMouse(Tx, Ty, 0, 0);
Wait(500 + Random(500));
end;
if (FindText(Tx, Ty, Pin[iNumber], UpChars, 30, 100, 383, 319)) then
Begin
for i := 0 to 9 do
begin
OnBox := False;
if IntInBox(Tx, Ty, Boxes[i]) then
with Boxes[i] do
begin
OnBox := True;
MouseBox(x1, y1, x2, y2, 1);
Break;
end;
end;
Wait(1000 + Random(500));
End;
end;
end;
Wait(1000 + Random(500));
if (BankScreen) then
begin
Result := True;
MouseSpeed := TMouseSpeed;
Exit;
end;
ClickContinue(True, True);
while (not(FindColor(Tx, Ty, 0, 7, 460, 69, 474))) do
begin
if (not(LoggedIn)) then
begin
MouseSpeed := TMouseSpeed;
Exit;
end;
Wait(1000 + Random(500));
end;
Inc(Counter);
until(Counter > 2);
end;
{*******************************************************************************
Function MSTPointToBankPoint(P: TPoint): TPoint;
by: Wizzup
Description: Converts a point on the Mainscreen to the point in the Bank.
First Row and Col are (0,0).
*******************************************************************************}
Function MSTPointToBankPoint(MSP: TPoint): TPoint;
Begin
Result.X := (MSP.X - 38) / 44;
Result.Y := (MSP.Y - 90) / 45;
End;
{*******************************************************************************
function BankPointToBankIndex(P: TPoint): Integer;
by: Wizzup?
Description: Converts a Bank Point (Row,Col) to Bank Index (spot in bank).
(0, 0) = 1
*******************************************************************************}
Function BankPointToBankIndex(P: TPoint): Integer;
Begin
Result := P.Y * 10 + P.X + 1;
End;
{*******************************************************************************
function BankIndexToBankPoint(ind: Integer): TPoint;
by: Wizzup
Description: Converts the Bank Index (spot in bank) to a Bank Point (Row,Col).
1 = (0, 0)
*******************************************************************************}
Function BankIndexToBankPoint(Index: Integer): TPoint;
Begin
Index := Index - 1;
Result := Point((Index Mod 10), Floor(Index Div 10));
End;
{*******************************************************************************
Function BankIndexToMSPoint(Index: Integer): TPoint;
by: Wizzup?
Description: Converts the Bank Index (spot in bank) to a Mainscreen TPoint of
the Index. (Top Left)
*******************************************************************************}
Function BankIndexToMSPoint(Index: Integer): TPoint;
Begin
Index := Index - 1;
Result := Point(38 + (Index Mod 10) * 44, 90 + Floor(Index Div 10) * 45);
End;
{*******************************************************************************
function BankIndexToMSBox(ind:Integer): TBox;
by: Wizzup
Description: Converts the Bank Index (spot in bank) to a Mainscreen TBox of
the Index.
*******************************************************************************}
Function BankIndexToMSBox(Index: Integer): TBox;
Var
P: TPoint;
Begin
P := BankIndexToMSPoint(Index);
Result.X1 := P.X;
Result.Y1 := P.Y;
Result.X2 := Result.X1 + 31;
Result.Y2 := Result.Y1 + 32;
End;
{*******************************************************************************
function DepositItemBox(Item: Integer): TBox;
by: ZephyrsFury
Description: Returns a TBox surround Item (1 to 28) in the Deposit Box screen.
*******************************************************************************}
function DepositItemBox(Item: Integer): TBox;
begin
Result.X1 := 97 + (Item - 1) mod 7 * 48;
Result.Y1 := 60 + (Item - 1) div 7 * 50;
Result.X2 := Result.X1 + 48;
Result.Y2 := Result.Y1 + 50;
end;
{*******************************************************************************
procedure FixBank;
by: lordsaturn and Nava2
Description: Scrolls the bank screen up.
*******************************************************************************}
procedure FixBank;
begin
if GetColor(489, 101) = 2830904 then exit;
if BankScreen then
if GetColor(489, 101) <> 1316634 then
begin
Mouse(485, 102, 7, 10, True);
while GetColor(489, 101) <> 1316634 do
Wait(20);
Wait(100 + Random(200));
end;
end;
{*******************************************************************************
Function FixBankTab: Boolean;
by: Wizzup?
Description: Fixes the BankTab to 'View All'
*******************************************************************************}
Function FixBankTab: Boolean;
Var
activeTPA, notactiveTPA: TPointArray;
T: Integer;
Begin
Result := False;
FindColorsTolerance(activeTPA, 2896954, 25, 45, 70, 80, 5);
FindColorsTolerance(notactiveTPA, 2437688, 25, 45, 70, 80, 5);
If Length(activeTPA) > Length(notactiveTPA) Then
Begin
Result := True;
Exit;
End;
Mouse(40, 60, 10, 10, True);
T := GetSystemTime;
While Length(activeTPA) <= Length(notactiveTPA) Do
Begin
FindColorsTolerance(activeTPA, 2896954, 25, 45, 70, 80, 5);
FindColorsTolerance(notactiveTPA, 2437688, 25, 45, 70, 80, 5);
Wait(500);
If ((GetSystemTime - T) / 1500) Mod 2 = 0 Then
Mouse(40, 60, 10, 10, True);
If GetSystemTime - T > 10000 Then
Exit;
End;
End;
{*******************************************************************************
Function CurrentBankTab: Integer;
by: Narcle
Description: Returns Current Bank Tab selected
*******************************************************************************}
function CurrentBankTab: Integer;
begin
if not BankScreen then
Exit;
for Result := 1 to 9 do
if GetColor(40 + 48 * (Result - 1), 83) = 2896954 then
Exit;
Result := 0;
end;
{*******************************************************************************
Function ExistsBankTab(T: Integer): Boolean;
by: Narcle
Description: Returns true if Bank Tab Exists
*******************************************************************************}
Function ExistsBankTab(T: Integer): Boolean;
var
x, y: integer;
begin
Result := False;
if not BankScreen then
begin
srl_Warn('ExistsBankTab', 'Bank not open.', warn_AllVersions);
Exit;
end;
if (not(InRange(T, 1, 9))) then
begin
srl_Warn('ExistsBankTab', 'Bank Tab: ' + IntToStr(T) + ' is not possible (1..9) only.', warn_AllVersions);
Exit;
end;
if T = 1 then
Result := true;
if FindColor(x, y, 65536, 27+(T-1)*48, 51, 70+(T-1)*48, 81) then
Result := true;
end;
{*******************************************************************************
Function BankTab(T: Integer): Boolean;
by: Narcle
Description: If Bank Tab is there will switch to it.
*******************************************************************************}
Function BankTab(T: Integer): Boolean;
begin
if not BankScreen then
Exit;
if T = CurrentBankTab then
Begin
Result := true;
Exit;
end;
if not ExistsBankTab(T) then
srl_Warn('BankTab', 'Bank Tab '+inttostr(T) +' does not Exist.', warn_AllVersions)
else
Mouse(48 * T, 57, 10, 10, true);
Result := T = CurrentBankTab;
end;
{*******************************************************************************
procedure SearchBank(Item: string);
by: ZephyrsFury
Description: Searches for Item in your bank.
*******************************************************************************}
procedure SearchBank(Item: string);
var
T, II: Integer;
begin
if (not(BankScreen)) then Exit;
for II := 0 to 2 do
begin
FixBankTab;
Mouse(75, 300, 20, 10, True);
T := GetSystemTime;
while (BankScreen) and (GetSystemTime - T < 5000) do
begin
Wait(500 + Random(500));
if (FindTextTpa(0, 0, 350, 392, 399, 410, 'search', UpChars, Nothing)) then
begin
TypeSend(Item);
Exit;
end;
end;
Wait(500 + Random(500));
end;
end;
{*******************************************************************************
Procedure Deposit(SlotFrom, SlotTo: Integer; vType: Variant);
by: WT-Fakawi/PPLSUQBAWLZ/Stupid3ooo/Town
Description: Deposits from Slot to ToSlot.
vType True = Deposit All. vType False = Deposit one by one.
Any integer is deposit with Deposit X. (except for 5 and 10)
*******************************************************************************}
Procedure Deposit(SlotFrom, SlotTo: Integer; vType: Variant);
Var
DepositX, BScreen, DScreen: Boolean;
All: Variant;
I, T, x, y: Integer;
B: TBox;
Begin
BScreen := BankScreen;
if (not(BScreen)) then
DScreen := DepositScreen;
If Not (BScreen or DScreen) Then
Exit;
If vType = 2 Then
srl_Warn('Deposit', '2 now means store per 2, not ''All''', 15);
DepositX := False;
Case VarType(vType) Of
3: Begin
DepositX := Not InIntArray([1, 5, 10], vType);
If vType = 1 Then
All := False
Else
All := True;
End;
11: All := vType;
End;
For I := SlotFrom To SlotTo Do
Begin
if (BScreen) then
begin
If Not ExistsItem(I) Then
Continue;
MouseItem(I, Not All);
end else
begin
B := DepositItemBox(I);
if (not(FindColor(X, Y, 65536, B.X1, B.Y1, B.X2, B.Y2))) then
Continue;
Mouse((B.X1 + B.X2) shr 1, (B.Y1 + B.Y2) shr 1, 0, 0, not All);
end;
If DepositX Then
Begin
ChooseOption('Deposit-X');
T := GetSystemTime;
While (Not FindColor(x, y, 8388608, MCX1, MCY1, MCX2, MCY2)) And (GetSystemTime - T < 3000) Do
Wait(100);
TypeSend(vType);
End Else If VarType(vType) = 3 Then
ChooseOption('Deposit-' + vType)
Else
ChooseOption('Deposit-All');
T := GetSystemTime;
Wait(RandomRange(200, 300));
repeat
if (BScreen) then
if (not(ExistsItem(I))) then Break;
if (DScreen) then
if (not(FindColor(X, Y, 65536, B.X1, B.Y1, B.X2, B.Y2))) then Break;
Wait(50);
until(GetSystemTime - T > 2000);
End;
End;
{*******************************************************************************
procedure Withdraw(Col, Row, Amount: Integer);
by: Starblaster100, Town, Wizzup? and Narcle
Description: Withdraws Amount at Column/Row.
*******************************************************************************}
procedure Withdraw(col, row, Amount: Integer);
var
BBox: TBox;
begin
FixBank;
FixBankTab;
{
if Col > 1 then Dec(Col);
if Row > 1 then Dec(Row);
}
BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
If Amount = 1 Then
Begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 1);
Wait(RandomRange(50, 150));
End
Else
Begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
if (Amount = 5) or (Amount = 10) then
ChooseOption('Withdraw-' +IntToStr(Amount))
else if Amount = 0 then
ChooseOption('Withdraw-All')
else
if not ChooseOption('Withdraw-'+IntToStr(Amount)+' ') then
begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
if (ChooseOption('Withdraw-X')) then
begin
Wait(1000 + Random(100));
TypeSend(IntToStr(Amount));
end;
end;
end;
end;
{*******************************************************************************
function WithdrawItemEx(Ident: integer; IdentType: string; var Index: integer; Amount: integer; UpText: String; Tol: TIntegerArray): boolean;
By: Nava2
Description: Withdraws an item from the bank by using "Ident" with tol[0]
as color tolerance, tol[1] as contour tolerance in case of bmp
masks, or the count of colors for TPA item finding.
Valid IdentTypes are all in FindItem.
Index: The Bank Index where the item is found, must be a variable.
Speeds up future withdraws.
Amount: Amount to withdraw from bank.
UpText: The UpText which the function checks for.
*******************************************************************************}
function WithdrawItemEx(Ident: integer; IdentType: string; var Index: integer; Amount: integer; UpText: String; Tol: TIntegerArray): Boolean;
var
x, y: integer;
BPoint: TPoint;
BankBox: TBox;
Found: Boolean;
t: TPointArray;
label
Start;
begin
Result := False;
if not BankScreen then Exit;
FixBank;
if (Index = 0) then
begin
Start:
for Index := 1 to 50 do
begin
if FindItemEx(x, y, IdentType, Ident, BankIndexToMSBox(Index), Tol) then
begin
MMouse(x, y, 4, 4);
if WaitUpText(UpText, 200) then
begin
Writeln('Found Item at Bank Slot ' + IntToStr(Index) + '.');
Found := True;
Break;
end else
Writeln('Found Incorrect Item, Moving to new Bank Spot.');
end;
end;
end else
begin
BankBox := BankIndexToMSBox(Index);
FindColors(t, 65536, BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2);
BankBox := GetTPABounds(t);
MouseBox(BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2, 3);
Wait(120 + Random(50));
if IsUpText(UpText) then
Found := true
else
begin
Writeln('Item Moved from Bank Slot ' + IntToStr(Index) + ', checking bank again.');
GoTo Start;
end;
end;
Wait(RandomRange(200, 350));
if Found then
begin
BPoint := BankIndexToBankPoint(Index);
//Writeln(IntToStr(BPoint.x) + ', ' + IntToStr(BPoint.y));
Withdraw(BPoint.x, BPoint.y, Amount);
Result := True;
end else
begin
Index := 0;
SRL_Warn('WithdrawItem', 'Could not Find ' + IdentType + ' in Bank. [Uptext: ' + UpText + ']', Warn_AllVersions);
end;
end;
{*******************************************************************************
function WithdrawItem(Ident: integer; IdentType: string; Amount: integer; UpText: TStringArray; Tol: TIntegerArray): boolean;
by: Nava2
Description: Withdraws an item using WithdrawItemEx, but removes the Index check.
*******************************************************************************}
function WithdrawItem(Ident: integer; IdentType: string; Amount: integer; UpText: String; Tol: TIntegerArray): boolean;
var
I : Integer;
begin
Result := WithdrawItemEx(Ident, IdentType, I, Amount, UpText, Tol);
end;
{*******************************************************************************
function DepositAll: Boolean;
by: ZephyrsFury & Quickmarch
Description: Deposits all items in your inventory
*******************************************************************************}
function DepositAll: Boolean;
var
T, X, Y: Integer;
BScreen, DScreen: Boolean;
begin
BScreen := BankScreen;
if (not(BScreen)) then
DScreen := DepositScreen;
if (BScreen) or (DScreen) then
if (InvCount > 0) or (FindColor(X, Y, 65536, 98, 68, 436, 257) and (DSCreen)) then
begin
Mouse(390 - 50 * Integer(DScreen), 305 - 30 * Integer(DScreen), 15, 10, True);
Wait(200 + Random(300));
T := GetSystemTime;
while (InvCount > 0) or (FindColor(X, Y, 65536, 98, 68, 436, 257) and (DSCreen)) and (GetSystemTime - T < 2000) do
Wait(100);
Result := (InvEmpty) or (not(FindColor(X, Y, 65536, 98, 68, 436, 257)) and (DScreen));
end;
end;
{*******************************************************************************
procedure Notes(SwitchOn: Boolean);
By: lordsaturn, idea by R1ch
Description: Toggles note withdrawal on or off.
*******************************************************************************}
procedure Notes(SwitchOn: Boolean);
begin
if BankScreen then
if (GetColor(254, 306) = 5863290) xor SwitchOn then
Mouse(250, 300, 10, 10, True);
end;
{*******************************************************************************
function CloseBank: Boolean;
By: Starblaster100
Description: Closes the bank window - Tries twice before exiting
*******************************************************************************}
function CloseBank: Boolean;
var
i, Timer: Integer;
begin
Result := False;
if BankScreen then
begin
Timer := GetTimeRunning + 8000;
repeat
Mouse(483, 28, 10, 12, True);
for i := 0 to 30 do
begin
if not BankScreen then
begin
Result:= True;
Break;
end;
Wait(100);
end;
Wait(Random(100));
until (GetTimeRunning > Timer) or Result;
end;
end;
{*******************************************************************************
function OpenBankQuiet(WhichBank: string): Boolean;
By: WT-Fakawi and modified by Ron
Description: Opens any given bank in the free world using
FindDeformedBitmapToleranceIn. Avoids strange mouse movements. Will cause
significant lag (approx. 1 second), but finds the bank with one click.
Valid arguments are:
'feb' (Falador East Bank)
'fwb' (Falador West Bank)
'veb' (Varrock East Bank)
'vwb' (Varrock West Bank)
'db' (Draynor Bank)
'eb' (Edgeville Bank)
'akb' (Al-Kharid Bank)
*******************************************************************************}
function OpenBankQuiet(WhichBank: string): Boolean;
var
TheCounter, dx, dy, tol, Mark2, Mark3: Integer;
acc, accthres: Extended;
begin
case WhichBank of
'feb', 'fwb': TheCounter := BitmapFromString(1, 10, '6C583296897A948779948779736' +
'C63A59E968C7F6F9686749B8A7685663E');
// varrock west
'vwb': TheCounter:= BitmapFromString(10, 1, 'A0997F504A49504A49504A495E4' +
'F215E4F215E4F215E4F212C250EA0997F');
// varrock east
'veb': TheCounter := BitmapFromString(1, 10, '5E4D1589826D88806D88806D867' +
'F6C9996907C7664847D648C836891876B');
// draynor and this works too for alkharid
'akb', 'db', 'eb': TheCounter:= BitmapFromString(12, 1, '584209735C29735C29735C29605' +
'85558504D60504D58504D58504D58504D58504D605855');
else
begin
srl_Warn('OpenBankQuiet', 'Unknown bank: ' + WhichBank, warn_AllVersions);
Exit;
end;
end;
MarkTime(Mark3);
tol := 1;
accthres := 0.6;
repeat
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
if BankScreen or PinScreen then
begin
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
if WaitUptextMulti(['ank', 'Bo', 'ot'], 200) then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, False);
if WaitOption('uickly', 200) then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen or PinScreen;
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
end;
FindDeformedBitmapToleranceIn(TheCounter, dx, dy, MSX1 + 50, MSY1 + 50, MSX2
- 50, MSY2 - 50, tol, 4, True, acc);
if (acc >= accthres) then
begin
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
if BankScreen or PinScreen then
begin
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
MMouse(dx, dy, 0, 0);
if WaitUptextMulti(['ank', 'Bo', 'ot'], 200) then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, False);
if WaitOption('uickly', 200) then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen or PinScreen;
end;
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
end;
Wait(100);
tol := tol + 4;
if tol >= 20 then
begin
tol := 1;
accthres := accthres - 0.1;
if accthres < 0.2 then
begin
WriteLn('Couldn''t find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
end;
until TimeFromMark(Mark3) > 60000;
FreeBitmap(TheCounter);
end;
{*******************************************************************************
function OpenBankGlass(WhichBank: String; ChangeCompass, ChangeAngle: Boolean): Boolean;
By: Wizzup? and modified by Ron updated to P2p banks by N1ke!
Description: Opens the bank.
Valid arguments are:
'feb' (Falador East Bank)
'fwb' (Falador West Bank)
'veb' (Varrock East Bank)
'vwb' (Varrock West Bank)
'db' (Draynor Bank)
'akb' (Al-Kharid Bank)
'ctb' (Catherby bank)
'clt' (Camelot bank)
'nab' (North Ardougne bank)
'sab' (South Ardougne bank)
'ynb' (Yanille bank)
'ngb' (North gnome bank)
'sgb' (South gnome bank)
'wgb' (Warrior guild bank)
'fgb' (Fishing guild bank)
*******************************************************************************}
function OpenBankGlass(WhichBank: string; ChangeCompass, ChangeAngle: Boolean): Boolean;
var
OBC: TPoint;
c, Speed, Col: Integer;
begin
Speed := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
if ChangeAngle then SetAngle(True);
if ChangeCompass then
begin
c := Random(2);
case WhichBank of
'feb', 'fwb', 'veb', 'ctb', 'clt', 'nab': if c = 0 then MakeCompass('N') else MakeCompass('S');
'akb', 'db', 'eb', 'vwb', 'sab', 'ynb', 'sgb', 'wgb', 'fgb': if c = 0 then MakeCompass('E') else MakeCompass('W');
'ngb': if c = 0 then MakeCompass(45) else MakeCompass(225);
end;
end;
Col := 10070458;
If (WhichBank = 'nab') or (WhichBank = 'sab')then
Col := 8095371;
if FindColorSpiralTolerance(OBC.x, OBC.y, Col, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(OBC.x, OBC.y, 4, 4);
if WaitUptextMulti(['nk', 'bo', 'ot'], 200) then
begin
Mouse(OBC.x, OBC.y, 0, 0, False);
WaitOption('uickly', 200);
FFlag(0);
Wait(2000 + Random(500));
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
end;
end else
if FindObj(OBC.x, OBC.y, 'ank', 10070458, 20) then
begin
Mouse(OBC.x, OBC.y, 0, 0, False);
WaitOption('uickly', 200);
FFlag(0);
Wait(2000 + Random(500));
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
end;
ColorToleranceSpeed(Speed);
end;
{*******************************************************************************
function OpenBankFast(Location: String): Boolean;
By: Wizzup? and Nielsie95 updated by N1ke!
Description: Opens the bank.
Valid arguments are:
'feb', 'falador east bank'
'fwb', 'falador west bank'
'veb', 'varrock east bank'
'vwb', 'varrock west bank'
'db' , 'draynor bank'
'akb', 'al-kharid bank'
'ctb', 'catherby bank'
'clt', 'camelot bank'
'nab', 'north ardougne bank'
'sab', 'south ardougne bank'
'ynb', 'yanille bank'
'ngb', 'north gnome bank'
'sgb', 'south gnome bank'
'wgb', 'warrior guild bank'
'fgb', 'fishing guild bank'
*******************************************************************************}
function OpenBankFast(Location: String): Boolean;
var
x, y, i, l, c, z: Integer;
Info: TIntegerArray;
Booths, t: TPointArray;
begin
Wait(400);
case LowerCase(Location) of
'akb', 'al kharid': Info := [MSCX, MSCY, 7969203, 25, 1];
'lb', 'lumbridge': Info := [MSCX, MSCY, 4807788, 10, 1];
'veb', 'varrock east': Info := [MSCX, MSCY, 2971236, 10, 1];
'vwb', 'varrock west': Info := [270, 270, 5689318, 25, 1];
'feb', 'falador east': Info := [MSCX, MSCY + 50, 4612728, 14, 1];
'fwb', 'falador west': Info := [MSCY, MSCY, 4612728, 14, 1];
'db', 'draynor': Info := [MSCX, MSCY, 2512235, 4, 2];
'eb', 'edgeville bank': Info := [MSCX + 50, MSCY, 3230295, 9, 2];
'ctb', 'catherby bank': Info := [MSCX, MSCY, 3239049, 8, 2];
'clt', 'camelot bank': Info := [MSCX, MSCY, 7636882, 5, 2];
'nab', 'north ardougne bank': Info := [MSCX, MSCY, 4084572, 5, 2];
'sab', 'south ardougne bank': Info := [MSCX, MSCY, 4084572, 5, 2];
'ynb', 'yanille bank': Info := [MSCX, MSCY, 3239049, 7, 2];
'ngb', 'north gnome bank': Info := [MSCX, MSCY, 3239049, 7, 2];
'sgb', 'south gnome bank': Info := [MSCX, MSCY, 3239049, 7, 2];
'wgb', 'warrior guild bank': Info := [MSCX, MSCY, 2578286, 7, 2];
'fgb', 'fishing guild bank': Info := [MSCX, MSCY, 2908796, 10, 2];
else
begin
srl_Warn('OpenBankFast', 'Unknown bank: '+Location, warn_AllVersions);
Exit;
end;
end;
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 BankScreen or PinScreen then
Break;
if (LowerCase(Location) = 'vwb') or (LowerCase(Location) = 'varrock west') then
begin
Booths[i].X := Booths[i].X + 5;
Booths[i].Y := Booths[i].Y - 20;
end;
MMouse(Booths[i].X, Booths[i].Y, 3, 3);
if WaitUpText('ooth', 200) Then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
if WaitOption('uickly', 200) then
begin
FFLag(0);
MarkTime(c);
repeat
Wait(100);
until (BankScreen) or (PinScreen) or (TimeFromMark(c) > 3000);
Wait(Random(300));
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
end;
end;
end;
Result := (BankScreen) or (PinScreen);
end;
{*******************************************************************************
function OpenBank(WhichBank: String, ChangeCompass, ChangeAngle: Boolean): Boolean;
by: SRL Development Team
Description: Opens the bank if possible.
Valid arguments are:
'feb' (Falador East Bank)
'fwb' (Falador West Bank)
'veb' (Varrock East Bank)
'vwb' (Varrock West Bank)
'db' (Draynor Bank)
'akb' (Al-Kharid Bank)
'lb' (Lumbridge Bank)
'ctb' (Catherby bank)
'clt' (Camelot bank)
'nab' (North Ardougne bank)
'sab' (South Ardougne bank)
'ynb' (Yanille bank)
'ngb' (North gnome bank)
'sgb' (South gnome bank)
'wgb' (Warrior guild bank)
'fgb' (Fishing guild bank)
*******************************************************************************}
function OpenBank(WhichBank: String; ChangeCompass, ChangeAngle: Boolean): Boolean;
begin
if not BankScreen then
begin
Result := True;
if LowerCase(WhichBank) <> 'eb' then
if OpenBankFast(WhichBank) then Exit;
if LowerCase(WhichBank) <> 'lb' then
begin
if (Random(11) > 5) then
begin
if not OpenBankGlass(WhichBank, ChangeCompass, ChangeAngle) then
if not OpenBankQuiet(WhichBank) then
Result := False;
end else
begin
if not OpenBankQuiet(WhichBank) then
if not OpenBankGlass(WhichBank, ChangeCompass, ChangeAngle) then
Result := False;
end;
end;
end else
Result := True;
end;
{*******************************************************************************
function FindBank(TheBank: String): Boolean;
By: WT-Fakawi and modified by Ron Updated to P2p by N1ke!
Description: Finds and opens any given bank in the free world.
If the MM DTM is found it will find and open the bank.
Valid arguments are:
'feb' (Falador East Bank)
'fwb' (Falador West Bank)
'veb' (Varrock East Bank)
'vwb' (Varrock West Bank)
'db' (Draynor Bank)
'akb' (Al-Kharid Bank)
'ctb' (Catherby bank)
'clt' (Camelot bank)
'nab' (North Ardougne bank)
'sab' (South Ardougne bank)
'ynb' (Yanille bank)
'ngb' (North gnome bank)
'sgb' (South gnome bank)
'fgb' (Fishing guild bank)
*******************************************************************************}
function FindBank(TheBank: string): Boolean;
var
bx, by, TheDTM: Integer;
WhichAngle: Extended;
begin
TheBank := LowerCase(TheBank);
case TheBank of
'feb': TheDTM := DTMFromString('78DA63AC67626088634001FFFFFD63F80FA41' +
'9416C2060AC01AA4987C83141D5FCF9C3C4C0055503028CAD44A8' +
'E924AC0600131E11B5');
'fwb': TheDTM := DTMFromString('78DA636C676260086540038C0CFFC12403C37' +
'F206004A98986C8304155FCF9C3C4C0055503D6D14C849A6EC26A' +
'009F5A0EA1');
'db': TheDTM := DTMFromString('78DA632C6162608866400181DEDE0CFF81342' +
'310FF0702C62CA09A4454357FFE30313043D58000584D1C116AC2' +
'F0AB0100EC370F0C');
'veb': TheDTM := DTMFromString('78DA63EC61626008624001FFFFFD63F80FA41' +
'9416C2060EC00AA8982C83141D5FCF9C3C4C0055503028C138850' +
'D343580D00122211A9');
'vwb': TheDTM := DTMFromString('78DA63EC606260B066C000FF819811440301E' +
'354A01A3B88381354FECF1F260611A81A1000AB3125428D2E7E35' +
'0087F80E5E');
'akb': TheDTM := DTMFromString('78DA636C606260F06140019D9D710CFF81342' +
'310FF0702C652A01A37881C1354CD9F3F4C0C5C5035200056E345' +
'841A3FFC6A002A3B0F97');
'ctb': TheDTM := DTMFromString('78DA63CC63626008624001478F1E65F80FA41' +
'981F83F1030A602D578A0AAF9F387898119AA060418F388505344' +
'849A32C26A00FE5D12EE');
'clt': TheDTM := DTMFromString('78DA63CC67626008604001E78E1F67F80FA41' +
'981F83F10306601D5B8A2AAF9F387898119AA060418CB88505345' +
'849A3AC26A000B52130B');
'nab': TheDTM := DTMFromString('78DA63AC61626008654001135A8B19FE03694' +
'620FE0F048C454035B1A86AFEFC61626086AA0101C66A22D47400' +
'D5C4E057030045F20FE7');
'sab': TheDTM := DTMFromString('78DA632C656260086040017DCD850CFF81342' +
'310FF0702C63AA09A6454357FFE30313043D58000584D180135F5' +
'40359EF8D500003F560FC7');
'ynb': TheDTM := DTMFromString('78DA632C60626008654001E78E1F67F80FA41' +
'981F83F10305601D5F8A2AAF9F387898119AA0604182B31CDC1AA' +
'260ABF1A009CFB108C');
'ngb': TheDTM := DTMFromString('78DA632C66626008654001FFFFFF67F80FA41' +
'921ECFF8CB94035B1A86AFEFC61626086AA0101C632C26A00AD6D' +
'0E64');
'sgb': TheDTM := DTMFromString('78DA632C606260086640038C0CFFC12403C37' +
'F20604C05AA894255F1E70F130333540D5807484D18116AFCF0AB' +
'01006D100DF4');
'fgb': TheDTM := DTMFromString('78DA632C626260F0654001F5311E0CFF81342' +
'310FF0702C64CA01A1754357FFE30313043D58000588D27116A02' +
'8950138A5F0D0041A911BD');
else
begin
srl_Warn('FindBank', 'Invalid bank name', warn_Warning);
Exit;
end;
end;
Result := False;
if FindDtmRotated(TheDTM, bx, by, MMX1, MMY1, MMX2, MMY2, Radians(-30), Radians(30), 0.05, WhichAngle) then
begin
Mouse(bx, by, 0, 0, True);
FFlag(0);
Wait(300+Random(400));
Result := OpenBank(TheBank, False, False);
end;
FreeDTM(TheDTM);
end;
{*******************************************************************************
function OpenDepositBox : Boolean;
by: Shuttleu
Description: Opens the deposit box.
*******************************************************************************}
function OpenDepositBox : Boolean;
var
X, Y, T:integer;
begin
If(not(LoggedIn)) then exit;
begin
if FindObjTPA(x, y, 739167, 10, -1, 30, 30, 200, ['deposit']) then
begin
GetMousePos(X, Y);
Mouse(x, y, 0, 0, True);
Result := True;
T :=0
repeat
Inc(T);
Wait(500+random(500));
until (DepositScreen) or (T>=30);
end else
Writeln('Could not find the deposit box');
end;
end;