SRL Archive - SRL Archives

CloseBank, shorten


Naum

2009-07-27 19:54:35

The current function:

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;

Shortened:

Function CloseBank : Boolean;
Var I : Byte;
Begin
While ((BankScreen) And (I <= 2)) Do
Begin
Result := (Not (BankScreen));
If Result Then Break;
Mouse(483, 28, 10, 12, True);
Wait(1200 + Random(800));
Inc(I);
End;
Wait(Random(100));
End;

Effectively does the same thing.

HyperSecret

2009-07-27 19:59:33

Yours re-written could potentially be slower though…if bankScreen is gone it could possibly wait 1400ms. The one currently in SRL loops through with the for loop every 100ms to check if bankScreen is gone…

not as efficient, good job though.

Naum

2009-07-27 20:10:55

From: HyperSecret
Yours re-written could potentially be slower though…if bankScreen is gone it could possibly wait 1400ms. The one currently in SRL loops through with the for loop every 100ms to check if bankScreen is gone…

not as efficient, good job though.


Eeek, sorry my bad. that was meant to be 1200 not 2600, don't know how that happened :duh:

Simtoon

2009-07-28 01:08:23

Why not post in Public SVN?

Naum

2009-07-28 01:13:58

From: Simtoon
Why not post in Public SVN?


Because it's a tweak, and there's also a lot going on in the Svn, SRL Random-wise. Frankly, I think it will be buried.

Simtoon

2009-07-28 01:37:15

ahh ok.

senrath

2009-07-28 02:02:56

I like the one we have currently better. Yours will wait a minimum of 1300 miliseconds, no matter how fast the bank screen disappears, while the current one's minimum wait is only 200 miliseconds.