EvilChicken!
2008-07-05 15:55:57
Hi, and thanks for opening this thread.
Opens all f2p banks, probably works with most member banks as well.
Replaces all bankopeners in Bank.scar.
What I mean by saying this is a 'smart' bankopener, is .. Sigh. Read.
Function SetUpBanks loads pre-picked colors of banks. I've picked two unique colors of each bank, and the procedure is made to be easily modifiable for easy addition or removal of any colors. These pre-picked colors are loaded into a 2D integer array, or one color array for every bank.
The main procedure, FindBankEx, will by itself call the SetUpBanks procedure if it has not been called already.
FindBankEx will, firstly, search for the bank with 0 tolerance for the colors in the variable array for the search target bank. If it finds the bank, it will move the color which was used to find the bank, one place ahead in the previously mentioned color array, if it isn't already in the first place if the array.
If the search with zero tolerance is of no result, a new search, this time with 10 tolerance, will be done. If it finds the bank this time, it will add the color used to find the bank, to that bank's pre-picked color array.
This menthod is preferable, at least by me, for following reasons:
There are probably more reasons, but I can't think of any more now because I'm really hungry. (In case you're interested: The scent of delicious, juicy chicken is kinda distracting me.)
Oh, and. The procedure(s) are extensively tested, and also contains random checks at the relevant places. If the function encounters a random, and SRL solves it, it will try to open the bank a second time after handling the random.
Please do comment on anything, especially bugs and your opinion on these functions.
Opens all f2p banks, probably works with most member banks as well.
Replaces all bankopeners in Bank.scar.
What I mean by saying this is a 'smart' bankopener, is .. Sigh. Read.
Function SetUpBanks loads pre-picked colors of banks. I've picked two unique colors of each bank, and the procedure is made to be easily modifiable for easy addition or removal of any colors. These pre-picked colors are loaded into a 2D integer array, or one color array for every bank.
The main procedure, FindBankEx, will by itself call the SetUpBanks procedure if it has not been called already.
FindBankEx will, firstly, search for the bank with 0 tolerance for the colors in the variable array for the search target bank. If it finds the bank, it will move the color which was used to find the bank, one place ahead in the previously mentioned color array, if it isn't already in the first place if the array.
If the search with zero tolerance is of no result, a new search, this time with 10 tolerance, will be done. If it finds the bank this time, it will add the color used to find the bank, to that bank's pre-picked color array.
This menthod is preferable, at least by me, for following reasons:
- Almost every single script that opens a bank, does it more than once. Since this procedure is progressive, it will (if not already) finally end up in being a flawless bank opener.
- The first search which uses 0 tolerance, contributes to reducing lag and improving the general performance of the script.
There are probably more reasons, but I can't think of any more now because I'm really hungry. (In case you're interested: The scent of delicious, juicy chicken is kinda distracting me.)
Oh, and. The procedure(s) are extensively tested, and also contains random checks at the relevant places. If the function encounters a random, and SRL solves it, it will try to open the bank a second time after handling the random.
program New;
{.include SRL/SRL.scar}
var// THESE ARE GLOBAL VARIABLES!
BankColors: T2DIntArray;
BankArraysSetUp: Boolean;
procedure SetUpBanks;
begin // If you know what you're doing, feel free to add more colors.
SetArrayLength(BankColors, 8); // Amount of banks.
SetArraylength(BankColors[0], 2); // Amount of colors for Lumbridge Bank.
SetArraylength(BankColors[1], 2); // Amount of colors for Al kharid Bank.
SetArraylength(BankColors[2], 2); // Amount of colors for Falador East Bank.
SetArraylength(BankColors[3], 2); // Amount of colors for Falador West Bank.
SetArraylength(BankColors[4], 2); // Amount of colors for Varrock East Bank.
SetArraylength(BankColors[5], 2); // Amount of colors for Varrock West Bank.
SetArraylength(BankColors[6], 2); // Amount of colors for Edgeville Bank.
SetArraylength(BankColors[7], 3); // Amount of colors for Draynor Bank.
BankColors[0][0] := 7963276; // [0] = Lumbridge Bank
BankColors[0][1] := 4215652;
BankColors[1][0] := 9018028; // [1] = Al Kharid Bank
BankColors[1][1] := 7772857;
BankColors[2][0] := 4938601; // [2] = Falador East Bank
BankColors[2][1] := 3954281;
BankColors[3][0] := 3952736; // [3] = Falador West Bank
BankColors[3][1] := 3756131;
BankColors[4][0] := 7110534; // [4] = Varrock East Bank
BankColors[4][0] := 2970721;
BankColors[5][0] := 2904413; // [5] = Varrock West Bank
BankColors[5][1] := 4539722;
BankColors[6][0] := 2571851; // [6] = Edgeville Bank
BankColors[6][1] := 6647670;
BankColors[7][0] := 339006; // [7] = Draynor West Bank
BankColors[7][1] := 4282984;
BankColors[7][2] := 4145738;
BankArraysSetUp := True; // Global boolean.
end;
function OpenBankEx(Which: string): Boolean; // Thanks to Zeph for help and support.
var // Also thanks to GoF for being .. Beyond epic. (My sig..)
ATPA: T2DPointArray;
TPA: TPointArray;
A, B, C, D, X, Y, ClickedColor: Integer;
BankNum, UTWaits, curCTS: Byte;
begin
Result := False;
if not LoggedIn then exit; // or NoGameTab.. ?
if not BankArraysSetUp then SetUpBanks;
case LowerCase(Which) of
'lb', 'lumbridge': BankNum := 0;
'ak', 'al kharid': BankNum := 1;
'feb', 'falador east': BankNum := 2;
'fwb', 'falador west': BankNum := 3;
'veb', 'varrock east': BankNum := 4;
'vwb', 'varrock west': BankNum := 5;
'eb', 'edgeville': BankNum := 6;
'db', 'draynor': BankNum := 7;
else
begin
srl_Warn('OpenBankEx', Which + ' is not a valid bank', warn_AllVersions);
Exit;
end;
end;
B := Length(BankColors[BankNum]) - 1;
curCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
for A := 0 to B do
begin
FindColorsSpiralTolerance(MSCX, MSCY, TPA, BankColors[BankNum][A], MSX1, MSY1, MSX2, MSY2, 12);
if GetArrayLength(TPA) = 0 then Continue;
ATPA := TPAtoATPAEx(TPA, 30, 10);
D := Length(ATPA) - 1;
for C := 0 to D do
begin
MiddleTPAEx(ATPA[C], X, Y);
MMouse(X, Y, 16, 6);
UTWaits := 0;
while LoggedIn and (not(Pos('ank booth', RS_GetUpText) > 0)) do
begin
Wait(50 + Random(45));
Inc(UTWaits); // UT = UpText, as you might've guessed already.
if UTWaits > 10 then Break;
end;
if UTWaits > 10 then Continue;
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, False);
Wait(150 + Random(175));
if not ChooseOption('quickly') then Continue;
UTWaits := 0;
if FTWait(2) then OpenBankEx(Which);
FFlag(0);
if FTWait(2) then OpenBankEx(Which);
while LoggedIn and (not BankScreen) do
begin
Inc(UTWaits);
if FTWait(2 + Random(2)) then OpenBankEx(Which);
if UTWaits > 6 then Break;
end;
if UTWaits > 6 then Continue;
if A > 0 then Swap(BankColors[BankNum][A], BankColors[BankNum][A - 1]);
if FTWait(5) then OpenBankEx(Which);
Result := True;
ColorToleranceSpeed(curCTS);
WriteLn(Which + ' bank was found without using tolerance.');
Exit;
end;
end;
for A := 0 to B do
begin
FindColorsSpiralTolerance(MSCX, MSCY, TPA, BankColors[BankNum][A], MSX1, MSY1, MSX2, MSY2, 10);
if GetArrayLength(TPA) = 0 then Continue;
ATPA := TPAtoATPAEx(TPA, 30, 10);
D := Length(ATPA) - 1;
for C := 0 to D do
begin
MiddleTPAEx(ATPA[C], X, Y);
ClickedColor := GetColor(X, Y);
MMouse(X, Y, 16, 6);
UTWaits := 0;
while LoggedIn and (not Pos('ank booth', RS_GetUpText) > 0) do
begin
Wait(50 + Random(45));
Inc(UTWaits);
if UTWaits > 10 then break;
end;
if UTWaits > 10 then Continue;
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, False);
Wait(150 + Random(175));
if not ChooseOption('quickly') then Continue;
if FTWait(2) then OpenBankEx(Which);
UTWaits := 0;
while LoggedIn and (not BankScreen) do
begin
Inc(UTWaits);
if FTWait(2 + Random(2)) then OpenBankEx(Which);
if UTWaits > 6 then Break;
end;
if UTWaits > 6 then Continue;
X := Length(BankColors[BankNum]);
SetArrayLength(BankColors[BankNum], X + 1);
BankColors[BankNum][X] := ClickedColor; // Add the clicked color the the
if FTWait(5) then OpenBankEx(Which);
Result := True; // corresponding bank's color array.
ColorToleranceSpeed(curCTS);
WriteLn(Which + ' bank was found using tolerance.');
Exit;
end;
end;
if FTWait(5) then OpenBankEx(Which);
Result := True;
ColorToleranceSpeed(curCTS);
end;
begin
SetUpSRL;
NumberOfPlayers(1);
Players[0].Nick := 'moo'; // to avoid AntiRandoms.scar conflicts.
ActivateClient;
Wait(500);
OpenBankEx('lb');
end.Please do comment on anything, especially bugs and your opinion on these functions.