SRL Archive - Test corner

OpenBankQuiet


WT-Fakawi

2006-05-11 19:04:31

Dont you hate it when the mouse swings from left to right trying to find the bank?
I have made an experimental OpenBankQuiet function, that checks for a Deformed Bitmap of the specified BankCounter.
It lags terrible (for approx 2 seconds) but it finds the counter almost always flawless (at least on my world), i.e. with ONE mouse swing!…. and that was my intention.
Try it out if you please and post some results…

Notes:
- Be sure to have your Map Northish and Up.
- Stand at the Bank.
- unblank the appropriate line, depending onthe bank your standing.
- OpenbankQuiet only lasts one minute. You can try it on any character.

[php]program OpenBankQuiet;

{.include SRL/SRL.scar}



Procedure DeclarePlayers;
begin
HowManyPlayers :=1; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='test';
Players[0].Active:=True;


end;

//—————————————————————————//

Function OpenBankQuiet(WhichBank:string):Boolean;
var
VarrockEastCounter, VarrockWestCounter, DraynorCounter,
FaladorEastCounter, FaladorWestCounter, TheCounter, Dx,Dy,tol:integer;
var
acc, accthres:extended;
begin
VarrockEastCounter := BitmapFromString(30, 1, 'z78DA6DC' +
'E5D0A80300C03E02BCDD92EE9E3DCF0FE4732EC077D90908F5228' +
'9460E689AEDC0C35D13E068DCEAA6E5DDB34E7E2D6524C1D96B7E' +
'5B0D0DCCCFF1CF70945095C92CBAE56E6F1C972C4DEE046457B00' +
'D4FB2728');

VarrockWestCounter := BitmapFromString(30, 1, 'z78DA333530B' +
'130B1304521413484044218DB05C6868A1A98184144CC0C4D5C8C' +
'8C9149134B6333034B9C24C24C98692011430C930DA1A48BB1235' +
'0171209001C2C2544');

FaladorEastCounter := BitmapFromString(1, 43, '252323554227644D' +
'2D6E55337B5F3A7B5F3A6E5A336E5A33968979948778928677928' +
'677756D6383786A8D7F6F9586719C8B7687683F8C6D42896E4D80' +
'68498068497D65487D65487A63467A6346776145776145755F437' +
'55F436E5533715735775C38775C387762388F6F43816A3B7E683A' +
'816A3B9276547E683A846C3D746036');

FaladorWestCounter := BitmapFromString(1, 29, '98887381' +
'633B87683F7D6548836A4A7D65487D65487A63467A63467A63467' +
'76145776145755F43755F436B52316B52316E5533715735775C38' +
'A1835C9F815B8C6D428C6D428C6D428C6D427B643A7B643A74603' +
'68B866F');

DraynorCounter := BitmapFromString(34, 1, 'z78DA658E4B0' + // works too for al karid
'E80300844AF34FCB45DAA70FF2B89B40B12339997F0C980BA5C98' +
'06837A7AE828CE74551F77FF51CBCD1FC5D901369614282816E59' +
'683EF94207AF2BA55C9948672BFB2FB7D5A1F6E8A10D0C9274552' +
'39FD022AE92A73');

case WhichBank of
'feb': TheCounter := FaladorEastCounter;
'fwb': TheCounter := FaladorWestCounter;
'vwb': TheCounter := VarrockWestCounter;
'veb': TheCounter := VarrockEastCounter;
'akb': TheCounter := DraynorCounter;
'db' : TheCounter := DraynorCounter;
end;

MarkTime(Mark);
Tol:=1;
accthres:=0.6;
Repeat
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('e Bank','Booth','ooth') then
begin
GetMousePos(Dx,Dy);
Mouse(Dx,Dy,0,0,False);
if ChooseOption(Dx,Dy,'uickly') then
begin
repeat
Wait(10);
until BankScreen;
end;
Result:=True;
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');
Exit;
end;
end;
until TimeFromMark(Mark)>60000;

end;

//************************************************************************//

Procedure SetUp;
begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
end;

//************************************************************************//

begin
Setup;
// OpenBankQuiet('feb'); // Falador East Bank
// OpenBankQuiet('fwb'); // Falador West Bank
OpenBankQuiet('vwb'); // Varrock East Bank
// OpenBankQuiet('veb'); // Varrock West Bank
// OpenBankQuiet('akb'); // Al-Kharid Bank
// OpenBankQuiet('db'); // Draynor Bank
end.[/php]

Bebe

2006-05-11 19:12:26

Fakawi! You made a mistake! :p
On line 76 it should be "if IsUpTextMulti('e Bank','Booth','ooth') then"

;)

WT-Fakawi

2006-05-11 19:14:16

how the … did that get in there?

anyway, fixed :)

thanks bebe!

Sdcit

2006-05-11 19:36:47

Great thing fakawi :D!. I cant test it now though :( maybey some failsafes ? if not logged in then terminatescript?

Cheesehunk

2006-05-11 22:05:18

Found it on thrid try when I lowered the angle of the screen a bit.

By third, I mean 3 mouse movemetns.

Good job!

WT-Fakawi

2006-05-12 18:33:58

haha it is working even better then I had expected. Works at almost every angle. Slow, but very stable'

Added to Version 2 :)

Krazy_Meerkat

2006-05-12 19:22:16

Wow I'm suprised it works at multiple angles with one bmp… Great work :)

Ejjman

2006-05-12 19:57:30

Great work Fakawi! I was in Draynor bank, and it took around 15 seconds. I dunno if that's good or bad, but it did find it and went directly there and clicked quick open or whatever. Good Job, and keep up the good work.