SRL Archive - Discussions and Debates

OpenBankQuiet Bug?


Fizzi

2007-08-17 01:16:35

Here is the current OpenBankQuiet:

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');
end;

MarkTime(Mark3);
tol := 1;
accthres := 0.6;
repeat
if IsUpTextMulti('ank', 'Bo', 'ot') then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, False);
if ChooseOption(dx, dy, 'uickly') then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('couldnt find the bank. Exiting');
Break;
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen;
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
MMouse(dx, dy, 0, 0);
if IsUpTextMulti('ank', 'Bo', 'ot') then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, False);
if ChooseOption(dx, dy, 'uickly') then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('couldnt find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen;
end;
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
end;
Wait(100);
FindNormalRandoms;
tol := tol + 4;
if tol >= 20 then
begin
tol := 1;
accthres := accthres - 0.1;
if accthres < 0.2 then
begin
WriteLn('couldnt find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
end;
until TimeFromMark(Mark3) > 60000;
FreeBitmap(TheCounter);
end;


I was looking at this part of the code, and something was bothering me:

FindDeformedBitmapToleranceIn(TheCounter, dx, dy, MSX1 + 50, MSY1 + 50, MSX2
- 50, MSY2 - 50, tol, 4, True, acc);
if (acc >= accthres) then
begin
MMouse(dx, dy, 0, 0);
if IsUpTextMulti('ank', 'Bo', 'ot') then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, False);
if ChooseOption(dx, dy, 'uickly') then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('couldnt find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen;
end;
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
end;


I think that the positioning of these lines is incorrect:

Result := True;
FreeBitmap(TheCounter);
Exit;


The way it is now… if it finds the uptext and right clicks, but for some reason right clicks somewhere besides the bank booth (Which has happened to me before), it will still Exit the procedure. I think a better place to put it would be:

FindDeformedBitmapToleranceIn(TheCounter, dx, dy, MSX1 + 50, MSY1 + 50, MSX2
- 50, MSY2 - 50, tol, 4, True, acc);
if (acc >= accthres) then
begin
MMouse(dx, dy, 0, 0);
if IsUpTextMulti('ank', 'Bo', 'ot') then
begin
GetMousePos(dx, dy);
Mouse(dx, dy, 0, 0, False);
if ChooseOption(dx, dy, 'uickly') then
begin
MarkTime(Mark2);
repeat
Wait(10);
if TimeFromMark(Mark2) > 20000 then
begin
WriteLn('couldnt find the bank. Exiting');
FreeBitmap(TheCounter);
Exit;
end;
until BankScreen;
Result := True;
FreeBitmap(TheCounter);
Exit;
end;
end;
end;


This way… it won't stop looking for the bank booth until it actually clicks the option 'uickly'.

By the way, the reason I posted this here is because I wasn't sure if this was intended or not.

The Claw

2007-08-17 02:00:16

Well I think your right, but I think its there for a reason. For example what if the bank isnt there, and you call this function? Then it would just keep right clickign everywhere, if the colours/bitmaps were similar and it didnt find the uptext. I think its meant to be used in a loop, as in:

MarkTime(arrr);
repeat
OpenBankQuiet('zzzzzzz')
until TimeFromMark(arrrr) > 20000000000) or result;

If the function was a loop in itself, it would take away the possibility of using it like this, in a sense.

Fizzi

2007-08-17 06:10:21

The function has it's own failsafe:
until TimeFromMark(Mark3) > 60000;

Besides… if it was the way it is now, it doesn't right click unless it finds the uptext. And at the moment, after it right clicks, even if it right clicked in the wrong spot, the function will stop looking for the bank. If the bank isn't there, the function would take the same amount of time both ways because it would never find the uptext and therefor never right click.

Santa_Clause

2007-08-17 08:32:55

OpenBankQuiet is laggy if I remember correctly. Why not just use FindBank?

Fizzi

2007-08-17 09:08:57

From: SantaClause
OpenBankQuiet is laggy if I remember correctly. Why not just use FindBank?


FindBank uses OpenBankQuiet in it ;). I do use FindBank, but the problem i described was happening sometimes, so I looked it up.

Boreas

2007-08-17 09:48:06

All/most of the banking has been redone for SRL 4.

Special Ed

2007-08-17 13:27:34

From: Boreas
All/most of the banking has been redone for SRL 4.
Well that beats any suggestions I had… Well done Boreas! Lol :p

P.S. If you need an open bank for draynor ask bullzeye95 he made a awesome one for MSI / FCMB. It might work at other places… I forget.

Boreas

2007-08-18 00:03:09

I didn't do it, it was part of the big clean up of SRL.

Let's test the one a lot and then we will see where we need another.

Special Ed

2007-08-18 01:09:10

Ahh I wasn't saying it was your fault "not really (fault) even if it was you" but just the way you posted, it and I as gonna suggest something, lol :D Also when is SRL 4 projected to be released? Like late week, or early?

Fizzi

2007-08-19 02:55:56

Woot :). This was changed to how I changed it in SRL 4 Beta. I just wonder if it was because of this thread or not.

Fizzi

2007-09-18 01:41:38

After looking at this again, I realized that it wasn't actually fixed for SRL 4.0 Beta. The top part of this function is like the same as the bottom part, and it's right in the top part, but not in the bottom. I was wondering if anyone could change this for the next version… it's frustrating when my characters right click at the wrong spot (which happens) and then the loop just exists even though it pressed cancel.

EDIT: 100th post, kinda exciting :)

The Claw

2007-09-18 03:32:46

Why not use OpenBankFast? Works a lot better imo

Fizzi

2007-09-18 11:01:56

From: The Claw
Why not use OpenBankFast? Works a lot better imo


I like the fact that openbankquiet finds it in "one click", although… this is not always the case at the moment, but it would be if FFlag(0); was working. I use FindBank('feb'); in my script, and that calls openbankquiet. Course i could just make one that uses OpenBankFast;.. but the above is still true.