SRL Archive - SRL Suggestions

Bank.Simba


NCDS

2010-09-10 14:39:29


{*******************************************************************************
procedure FixBank;
by: lordsaturn, Nava2, IceFire908 & Bixby Sayz
Description: Scrolls the bank screen up.
*******************************************************************************}
procedure FixBank;
var
Timer : Integer;
begin
if (SimilarColors(GetColor(481, 110), 723981, 20)) then
if (BankScreen) then
if (not (SimilarColors(GetColor(489, 101), 1316634, 5))) then
begin
Timer := GetTimeRunning + 5000;
MouseBox(482, 101, 488, 111, 1);
while ((not (SimilarColors(GetColor(489, 101), 1316634, 5))) and (GetTimeRunning < Timer)) do
Wait(50 + Random(50));
Wait(RandomRange(100, 200));
end;
end;
FixBank works quite well, though wouldn't it make more sense to check for the BankScreen before doing any SimilarColors checks? Not a big deal, just something that stuck out to me.


{*******************************************************************************
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) div 1500) mod 2 = 0 then
Mouse(40, 60, 10, 10, True);
if GetSystemTime - T > 10000 then
Exit;
end;
end;
FixBankTab work's well too as long as the 'View All' tab is already selected. Otherwise, it will return a False negative as the Result is never set at the end of the function. Also, there is no BankScreen check in the current function, so if the BankScreen isn't open, it just starts clicking.

With updates:

{*******************************************************************************
function FixBankTab: Boolean;
by: Wizzup?
Description: Fixes the BankTab to 'View All'
*******************************************************************************}
function FixBankTab: Boolean;
var
activeTPA, notactiveTPA: TPointArray;
T: Integer;
begin
if (not (BankScreen)) then
Exit;

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) div 1500) mod 2 = 0 then
Mouse(40, 60, 10, 10, True);
if GetSystemTime - T > 10000 then
Exit;
end;

Result := (Length(activeTPA) > Length(notactiveTPA));
end;

I believe everything else is working as it should in Bank.Simba. I tested everything that seemed like it might have had a problem.

Time to go for a bit now though.