SRL Archive - SRL Suggestions

Change to CloseBank.


Naum

2009-06-07 14:14:08

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;

Could be changed to:

Function CloseBank : Boolean;
Begin
Result := (Not (BankScreen));
If Result Then Exit Else
Mouse(483, 28, 10, 12, True);
Wait(500 + Random(300));
Result := (Not (BankScreen));
End;

I'm pretty sure Text.scar is called before Bank.Scar in SRL.Scar.

Naike

2009-06-07 14:22:14

Once again, nice find.
Don't see how this could be bad.

Support ;)

Dynamite

2009-06-07 14:22:58

Same as above ;)
Support
T~M

Naum

2009-06-07 14:25:14

Thanks everyone :).

Da 0wner

2009-06-07 14:28:43

There is no point then. Just do CloseWindow;…

Naum

2009-06-07 14:33:10

No this point is in the name, most people are suited to CloseBank rather than CloseWindow.

Gu3st...

2009-06-07 14:46:49

From: NaumanAkhlaQ
No this point is in the name, most people are suited to CloseBank rather than CloseWindow.

+ it would break ALOT of scripts xP

ZephyrsFury

2009-06-07 15:57:37

CloseWindows USES CloseBank.. Nava said CloseWindow didn't work with the bank for some reason.

Naum

2009-06-07 16:10:20

Zephy It does, he fixed it :)

I've tested it as well :p. It used to get mixed up with the question mark box, but then Nava used a SortATPA to fix it.

Nava2

2009-06-07 16:20:28

No, it still messes up.

It's easier to leave this. I might just get all the lengths since they appear to be constant.

ZephyrsFury

2009-06-07 16:21:41

From: NaumanAkhlaQ
Zephy It does, he fixed it :)

I've tested it as well :p. It used to get mixed up with the question mark box, but then Nava used a SortATPA to fix it.



function CloseWindow: Boolean;
var
Col: TIntegerArray;
b: T2DPointArray;
a: T2DPointArray;
Pa: TBox;
I, ii, h, l: Integer;
begin
Result := CloseBank; //Eh??
Col := [1118997, 1449250, {Main typ 1}
8042720, 4160933, {Skill}
6854059, 2902100, {Quest}
4282212, 2503226, {Main typ 2}
39423, 13567, {Red X}
1514271, 1580837, {Deposit Box}
2106925, 1250584];
SetLength(b, 2);
for I := 0 to 6 do
begin
FindColors(b[0], Col[i*2], MSCX, MSY1, MSX2, MSCY);
FindColors(b[1], Col[i*2+1], MSCX, MSY1, MSX2, MSCY);
l := (High(b[0]) + High(b[1]));
//Writeln(IntToStr(i) + ' Col1: ' + IntToStr(High(b[0])) + ' Col2: ' + IntToStr(High(b[1])) + ' T: ' + IntToStr(l));
if InRange(l, 6, 53) or InRange(l, 94, 250) then
begin
a := SplitTPA(CombineTPA(b[0], b[1]), 5);
SortATPAFromFirstPoint(a, Point(385, 100));
//DebugATPA(a, '');
for ii := 0 to h do
begin
Pa := GetTPABounds(a[ii]);
if ((Pa.x2 - Pa.x1) > 50) or ((Pa.y2 - Pa.y1) > 50) then Continue;
MMouse(RandomRange(Pa.x1, Pa.x2), RandomRange(Pa.y1, Pa.y2), 0, 0);
Wait(100 + Random(50));
if rs_GetUpText = 'Close' then
begin
GetMousePos(Pa.x1, Pa.y1);
Mouse(Pa.x1, Pa.y1, 0, 0, True);
Result := True;
Writeln('Close Window Type ' + IntToStr(i));
Exit;
end;
end;
end;
end;
end;

Naum

2009-06-07 16:41:03

Ahh crap, my bad, guess I didn't see that line :(

Edited FirstPost :)

marpis

2009-06-09 02:04:35

how hard can it be, clicking 'x' which is always in the same place?
edit: i mean the current CloseBank. why did that monster appear in SRL in the first place ^^

Richard

2009-06-09 02:33:09

From: marpis
how hard can it be, clicking 'x' which is always in the same place?
edit: i mean the current CloseBank. why did that monster appear in SRL in the first place ^^


The old one checked whether it was at the BankScreen before and after, meaning it can result if it fails. Although its only really going to fail if there's lag.