SRL Archive - SRL Archives

FixBank


Bixby Sayz

2009-09-06 06:33:44

I've been having a lot of trouble with the various withdraw methods not working if your bank does not have a scroll bar. I've tracked it down to FixBank going into an infinite loop waiting for a color indicating the scroll bar is at the top.

And since the update I've been having issues with it on bank screen that does have a scroll bar as well.

So I added a failsafe timeout and corrected colors and added color check for no scroll bar.

I'm off to bed. I'll read the feedback/comments (if any) tomorrow.

Cheers

Edit: Updated to include Dev's changes/modifications.

{*******************************************************************************
procedure FixBank;
by: lordsaturn, Nava2 & Bixby Sayz
Description: Scrolls the bank screen up.
*******************************************************************************}

procedure FixBank;
var
Timer : Integer;
begin
if (BankScreen) then
begin
if (InIntArray([2830905, 1316634], GetColor(489, 101))) then
Exit;
Timer := GetTimeRunning + 5000;
MouseBox(482, 101, 488, 111, 1);
while (GetColor(489, 101) <> 1316634) and (GetTimeRunning < Timer) do
Wait(50 + Random(50));
Wait(RandomRange(100, 200));
end;
end;

For comparison sake, the original. Note the original will fail to scroll to the top if the random coords specified come up as the far leftmost possible, and the other edges as well I think.

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;

Edit: What is it with the devs that they treat comments like they were some form of communicable disease?

ZephyrsFury

2009-09-06 10:07:19

Added this:


{*******************************************************************************
procedure FixBank;
by: lordsaturn, Nava2 & Bixby Sayz
Description: Scrolls the bank screen up.
*******************************************************************************}

procedure FixBank;
var
Timer : Integer;
begin
if (BankScreen) then
begin
if (InIntArray([2830905, 1316634], GetColor(489, 101))) then
Exit;
Timer := GetTimeRunning + 5000;
MouseBox(482, 101, 488, 111, 1);
while (GetColor(489, 101) <> 1316634) and (GetTimeRunning < Timer) do
Wait(50 + Random(50));
Wait(RandomRange(100, 200));
end;
end;

Thanks :)

Bixby Sayz

2009-09-06 17:38:55

Nice! I knew there was a way to trim it down but I was more concerned with getting it working first.

Edit: That is my coding style to indicate when a function is called vs using a variable, hence the

if (BankScreen()) then

Lets me know just by glancing at the code that BankScreen is a function and not a var/const. Personal preference, makes no difference in the code.

ZephyrsFury

2009-09-06 17:45:25

From: Bixby Sayz
Nice! I knew there was a way to trim it down but I was more concerned with getting it working first.

Edit: That is my coding style to indicate when a function is called vs using a variable, hence the

if (BankScreen()) then

Lets me know just by glancing at the code that BankScreen is a function and not a var/const. Personal preference, makes no difference in the code.


Yeah, thats fine. I guess for SRL though, I'd like to keep a uniform (or relatively uniform) coding standard.

Bixby Sayz

2009-09-06 17:53:28

No problem. Should have known to keep it in line with the SRL standards. Created that in few minute spurts in between running my ass off getting stuff ready for my brothers wedding.

Edit: Sweeeet! Just noticed something I did wound up in the dev repository. Maybe I'll get inspired and actually finish a script now. Only managed to delete my clay softener 3 times now when it's about 98% done. (Do as I say, not as I do - Back up your files dumbass)