SRL Archive - SRL Archives

HOpenBank


ShowerThoughts

2008-04-27 15:18:56

Hey, I made a New bank opener!

Features:
- Handles Pin
- in 1 mouse move and fast!
- i got diff versions.
(not really a feature)
- i am pretty sure i am going to use this in the future because it works great and does what it haves to do!



IsBankOpen Without Srl's MarkTime, because i am not sure i can use it.
Function IsBankOpen(MaxTime:Integer; CheckForPinScreen:Boolean):Boolean;
Var
Count :Integer;
Begin
MaxTime:= MaxTime/100;
Count:=0;
Repeat
Wait(100);
Count:= Count + 1;
If CheckForPinScreen Then Result:=PinScreen;
If Result Then Break;
Until (BankScreen or (Count > MaxTime));
Result:= Count < Maxtime;
If Not Result Then Writeln('Failed To Find The BankScreen.');
End;


IsBankOpen Without Srl's MarkTime if i can use it then this would be better.
Function IsBankOpen(MaxTime:Integer; CheckForPinScreen:Boolean):Boolean;
Var
Timer :Integer;
Begin
MarkTime(Timer);
Repeat
Wait(100);
If CheckForPinScreen Then Result:=PinScreen;
If Result Then Break;
Until (BankScreen or (TimeFromMark(Timer) > MaxTime));
Result:= TimeFromMark(Timer) < Maxtime;
If Not Result Then Writeln('Failed To Find The BankScreen.');
End;

Example:
IsBankOpen(5000,True);


Note: All Those Versions Include IsBankOpen I could also make it included in HOpenBank but then i spend lines for nothing
Note 2: i can take the non important debug out

HOpenBank 1, You can choose the bank and fill in the pin this is basic(doesn't change the direction or anything
//By Hermpie
Function HOpenBank(WhichBank:String; HPin:Integer):Boolean;
Var
TempTpa: TpointArray;
Temp: T2DPointArray;
H, CTS, I, MSpeed, TempX, TempY, HColor, M:Integer;
Begin
M:=GetSystemTime;
Case LowerCase(WhichBank) Of
'feb','falador east':HColor:= 2243147;//4481401
'fwb','falador west':HColor:= 3496051;//4481401
'veb','varrock east':HColor:= 2050647;//2838878
'vwb','varrock west':HColor:= 1653574;
'akb','alkharid':HColor:= 738138;
//'dnb','draynor':HColor:= 5929095;
'evb','edgevillage':HColor:= 2636871;
'pcb','pestcontrol':HColor:=11647942;
End;
If HColor < 1 Then Writeln('Your Choice Is A Not Existing Bank.');
MSpeed:=MouseSpeed;
MouseSpeed:=30;
if not LoggedIn Then Exit;
CTS := GetColorToleranceSpeed;
If not CTS = 2 Then ColorToleranceSpeed(2);
FindColorsSpiralTolerance(TempX, TempY, TempTPA, HColor, MSX1+10, MSY1+10, MSX2-10, MSY2-10, 5);
Temp:= TPAtoATPAEx(TempTPA, 17, 18);
SortATPASize(Temp, True);
H:=High(Temp);
For I := 0 To H Do
Begin
MiddleTPAEx(Temp[i], TempX, TempY);
MMouse(TempX, TempY, 3, 3);
Wait(30+random(10));
Result:=IsUpText('ank');
If Result Then Break;
End;
If Result Then
Begin
Mouse(TempX, TempY, 0, 0, False);
Wait(40+random(10));
Result:=ChooseOption('uickly');
If Result Then Result:=IsOpenBank(5000,True);
If Pinscreen Then Result:= InPin(InttoStr(HPin));
If Result Then Result:=IsOpenBank(5000,False);
end;
If Result Then Writeln('HOpenBank Succesfully Openend The Bank. In '+IntToStr(GetSystemTime - M)+' MiliSecs.');
If Not result Then Writeln('HOpenBank Did Not Open The Bank.');
ColorToleranceSpeed(CTS);
MouseSpeed:=MSpeed;

End;

HOpenBank 2, Basic + makecompass('N') included

//By Hermpie
Function HOpenBank(WhichBank :String; HPin:Integer):Boolean;
Var
TempTpa: TpointArray;
Temp: T2DPointArray;
H, CTS, I, MSpeed, TempX, TempY, HColor, M:Integer;
Begin
M:=GetSystemTime;
Case LowerCase(WhichBank) Of
'feb','falador east':HColor:= 2243147;//4481401
'fwb','falador west':HColor:= 3496051;//4481401
'veb','varrock east':HColor:= 2050647;//2838878
'vwb','varrock west':HColor:= 1653574;
'akb','alkharid':HColor:= 738138;
'dnb','draynor':HColor:= 5929095;
'evb','edgevillage':HColor:= 2636871;
'pcb','pestcontrol':HColor:=11647942;
End;
If HColor < 1 Then Writeln('Your Choice Is A Not Existing Bank.');
If (lowercase(WhichBank)='dnb') or (lowercase(WhichBank)='draynor') Then MakeCompass('W') else MakeCompass('N');
MSpeed:=MouseSpeed;
MouseSpeed:=30;
if not LoggedIn Then Exit;
CTS := GetColorToleranceSpeed;
If not CTS = 2 Then ColorToleranceSpeed(2);
FindColorsSpiralTolerance(TempX, TempY, TempTPA, HColor, MSX1+10, MSY1+10, MSX2-10, MSY2-10, 5);
Temp:= TPAtoATPAEx(TempTPA, 17, 18);
SortATPASize(Temp, True);
H:=High(Temp);
For I := 0 To H Do
Begin
MiddleTPAEx(Temp[i], TempX, TempY);
MMouse(TempX, TempY, 3, 3);
Wait(30+random(10));
Result:=IsUpText('ank');
If Result Then Break;
End;
If Result Then
Begin
Mouse(TempX, TempY, 0, 0, False);
Wait(40+random(10));
Result:=ChooseOption('uickly');
If Result Then Result:=IsBankOpen(5000,True);
If Pinscreen Then Result:= InPin(InttoStr(HPin));
If Result Then Result:=IsBankOpen(5000,False);
end;
If Result Then Writeln('HOpenBank Succesfully Openend The Bank. In '+IntToStr(GetSystemTime - M)+' MiliSecs.');
If Not result Then Writeln('HOpenBank Did Not Open The Bank. ');
ColorToleranceSpeed(CTS);
MouseSpeed:=MSpeed;
MakeCompass('N');
End;

HOpenBank 3 Basic +You can choose at which angle to end;
//By Hermpie
Function HOpenBank(WhichBank, WhichDir :String; HPin:Integer):Boolean;
Var
TempTpa: TpointArray;
Temp: T2DPointArray;
H, CTS, I, MSpeed, TempX, TempY, HColor, M:Integer;
Begin
M:=GetSystemTime;
Case LowerCase(WhichBank) Of
'feb','falador east':HColor:= 2243147;//4481401
'fwb','falador west':HColor:= 3496051;//4481401
'veb','varrock east':HColor:= 2050647;//2838878
'vwb','varrock west':HColor:= 1653574;//
'akb','alkharid':HColor:= 738138;
'dnb','draynor':HColor:= 5929095;
'evb','edgevillage':HColor:= 2636871;
'pcb','pestcontrol':HColor:=11647942;
End;
If HColor < 1 Then Writeln('Your Choice Is A Not Existing Bank.');
GameTab(5)
If (lowercase(WhichBank)='dnb') or (lowercase(WhichBank)='draynor') Then MakeCompass('W') else MakeCompass('N');
MSpeed:=MouseSpeed;
MouseSpeed:=30;
if not LoggedIn Then Exit;
CTS := GetColorToleranceSpeed;
If not CTS = 2 Then ColorToleranceSpeed(2);
FindColorsSpiralTolerance(TempX, TempY, TempTPA, HColor, MSX1+10, MSY1+10, MSX2-10, MSY2-10, 5);
Temp:= TPAtoATPAEx(TempTPA, 17, 18);
SortATPASize(Temp, True);
H:=High(Temp);
For I := 0 To H Do
Begin
MiddleTPAEx(Temp[i], TempX, TempY);
MMouse(TempX, TempY, 3, 3);
Wait(30+random(10));
Result:=IsUpText('ank');
If Result Then Break;
End;
If Result Then
Begin
Mouse(TempX, TempY, 0, 0, False);
Wait(40+random(10));
Result:=ChooseOption('uickly');
If Result Then Result:=IsBankOpen(5000,True);
If Pinscreen Then Result:= InPin(InttoStr(HPin));
If Result Then Result:=IsBankOpen(5000,False);
end;
If Result Then Writeln('HOpenBank Succesfully Openend The Bank. In '+IntToStr(GetSystemTime - M)+' MiliSecs.');
If Not result Then Writeln('HOpenBank Did Not Open The Bank. ');
ColorToleranceSpeed(CTS);
MouseSpeed:=MSpeed;
MakeCompass(WhichDir);
End;

Examples:
Ver 1
If HOpenBank('Veb',Players[currentplayer]integers[0]) then Writeln('Yay!');
Ver 2
If HOpenBank('Veb',Players[currentplayer]integers[0]) then Writeln('Yay!');
Ver 3
If HOpenBank('Veb','N',Players[currentplayer]integers[0]) then Writeln('Yay!');
I think ver 2 is best because draynor works to then and in ver 1 if you got your angle at west ver 1 doesn't change the angle at all so then it could go wrong but ver 2 works perfect it only needs to change the angle at 1 bank!

The Version(2 + isbankopen(using the timer)) I Prefer:
Program Hermpie;
{.Include SRL/SRL.Scar}


Function IsBankOpen(MaxTime:Integer; CheckForPinScreen:Boolean):Boolean;
Var
Timer :Integer;
Begin
MarkTime(Timer);
Repeat
Wait(100);
If CheckForPinScreen Then Result:=PinScreen;
If Result Then Break;
Until (BankScreen or (TimeFromMark(Timer) > MaxTime));
Result:= TimeFromMark(Timer) < Maxtime;
If Not Result Then Writeln('Failed To Find The BankScreen.');
End;


//By Hermpie
Function HOpenBank(WhichBank :String; HPin:Integer):Boolean;
Var
TempTpa: TpointArray;
Temp: T2DPointArray;
H, CTS, I, MSpeed, TempX, TempY, HColor, M:Integer;
Begin
M:=GetSystemTime;
Case LowerCase(WhichBank) Of
'feb','falador east':HColor:= 2243147;//4481401
'fwb','falador west':HColor:= 3496051;//4481401
'veb','varrock east':HColor:= 2050647;//2838878
'vwb','varrock west':HColor:= 1653574;
'akb','alkharid':HColor:= 738138;
'dnb','draynor':HColor:= 5929095;
'evb','edgevillage':HColor:= 2636871;
'pcb','pestcontrol':HColor:=11647942;
End;
If HColor < 1 Then Writeln('Your Choice Is A Not Existing Bank.');
If (lowercase(WhichBank)='dnb') or (lowercase(WhichBank)='draynor') Then MakeCompass('W') else MakeCompass('N');
MSpeed:=MouseSpeed;
MouseSpeed:=30;
if not LoggedIn Then Exit;
CTS := GetColorToleranceSpeed;
If not CTS = 2 Then ColorToleranceSpeed(2);
FindColorsSpiralTolerance(TempX, TempY, TempTPA, HColor, MSX1+10, MSY1+10, MSX2-10, MSY2-10, 5);
Temp:= TPAtoATPAEx(TempTPA, 17, 18);
SortATPASize(Temp, True);
H:=High(Temp);
For I := 0 To H Do
Begin
MiddleTPAEx(Temp[i], TempX, TempY);
MMouse(TempX, TempY, 3, 3);
Wait(30+random(10));
Result:=IsUpText('ank');
If Result Then Break;
End;
If Result Then
Begin
Mouse(TempX, TempY, 0, 0, False);
Wait(40+random(10));
Result:=ChooseOption('uickly');
If Result Then Result:=IsBankOpen(5000,True);
If Pinscreen Then Result:= InPin(InttoStr(HPin));
If Result Then Result:=IsBankOpen(5000,False);
end;
If Result Then Writeln('HOpenBank Succesfully Openend The Bank. In '+IntToStr(GetSystemTime - M)+' MiliSecs.');
If Not result Then Writeln('HOpenBank Did Not Open The Bank. ');
ColorToleranceSpeed(CTS);
MouseSpeed:=MSpeed;
MakeCompass('N');
End;

Begin
SetUpSRL;
ActivateClient;
HOpenBank('Draynor',1000);
End.
I could also take the 'Useless' Debug out of it but it works great!

So What You Think Of It?
Took me a long time to edit and create those diff versions :s(very anoying)
and picking all the bank colors.
Any responce would be cool!

skilld u

2008-04-27 15:20:15

nice.

Cazax

2008-04-27 15:23:12

You declared musespeed as 30. Then you never decrease it to the original speed.

ShowerThoughts

2008-04-27 15:28:16

MSpeed:=MouseSpeed;
MouseSpeed:=30;
MouseSpeed:=MSpeed;

Cazax

2008-04-27 15:29:22

From: Hermpie
MSpeed:=MouseSpeed;
MouseSpeed:=30;
MouseSpeed:=MSpeed;


Oops i didnt see that :p

ShowerThoughts

2008-04-27 15:30:19

Newb :p

Edit: this can be used in MVP to..

ShowerThoughts

2008-04-27 18:04:10

Proof:
SRL Compiled in 16 msec
Found The Bank In 31 MiliSecs.
HOpenBank Succesfully Openend The Bank. In 1359 MiliSecs.
Successfully executed
Timer Owned-.-

Iron Man

2008-04-27 18:08:59

Found The Bank In 15 MiliSecs.

Quick enough for you? :p

ShowerThoughts

2008-04-27 18:09:34

Yepz thank you!

n3ss3s

2008-04-28 01:47:11

I used to do that If Not CTS = 2 Then ColorTol… but it's useless.

Where parts did you put the time marks in hermpie?

HayHay89

2008-04-28 02:14:06

wow nice ill take a better look at it later

The Claw

2008-04-29 08:52:19

Nice job. :)

ShowerThoughts

2008-04-29 08:57:06

Yes, n3ss3s I ripped that if not Cts2 then bla I know it is pretty useless but that is called invisible crediting :p

Thanks, for the comments dudes!

Btw I can make a new version who just does the shit what it haves to do i have now 3 versions and i want to know what you like the most so pls say version 1 2 or 3 ;)

Edit:
I Might Pick The Coors again if much people consider to use it the colours are good but some banks aren't working because i switched the colour like I accidentally put a Feb Colour In The Fwb.

EvilChicken!

2008-04-29 10:36:33

Does this support lumbridge bank? If not, you should add it. If this is better than SRL's openbank, I'll use this in my flax spinner. (w/credits to j00) ^^

ShowerThoughts

2008-04-29 18:00:59

the point is Lumbridge is suicide for HopenBank i can make it but then you must be standing close to the bank because somehow it does finds all the colours that i pick in the black area around the bank. i will try it ;)

Richard

2008-05-03 16:24:12

Nice job Hermpie, I need a better bank opener as SRL's seems to be a bit un-reliable in Al Kharid, and I trust your work :)

I'll credit you right if you let me use it.

ShowerThoughts

2008-05-04 13:08:30

From: Dude Richard
Nice job Hermpie, I need a better bank opener as SRL's seems to be a bit un-reliable in Al Kharid, and I trust your work :)

I'll credit you right if you let me use it.


I Made and special one for Al-Kharid I will pm you :D

Richard

2008-05-07 13:44:32

From: Hermpie
I Made and special one for Al-Kharid I will pm you :D


Cheers, Hermpie. I'll give you rep++ even though I know you don't care :p

You want super amazing credits in the script, or is "Hermpies, cool guy, made this" ok?

ShowerThoughts

2008-05-09 14:22:00

//By Hermpie

is enough :p

ow and dude richard you might want to change the tolerance to 10 then it might work closer to where you are standing ;)

Richard

2008-05-09 15:11:20

Kk, Al Kharid is anoyingly dynamic, so I might have to test with different tols.

ShowerThoughts

2008-05-09 15:28:05

Function HIsBankOpen(MaxTime:Integer; CheckForPinScreen:Boolean):Boolean;
Var
Timer :Integer;
Begin
If not LoggedIn then exit;
MarkTime(Timer);
Repeat
Wait(100);
If CheckForPinScreen Then Result:=PinScreen;
If Result Then Break;
Until (BankScreen or (TimeFromMark(Timer) > MaxTime));
Result:= TimeFromMark(Timer) < Maxtime;
If Not Result Then Writeln('Failed To Find The BankScreen.');
End;

Function HUptext(Text:TStringArray):boolean;
Var
MaxTime:Integer;
Begin
If not LoggedIn then exit;
MarkTime(MaxTime);
repeat
Result:= IsUpTextMultiCustom(Text);
Until (result Or (TimeFromMark(MaxTime)>100));
Result:=TimefromMark(MaxTime)<100
End;

Function HOption(Text:string):boolean;
Var
MaxTime:Integer;
Begin
If not LoggedIn then exit;
MarkTime(MaxTime);
repeat
Result:= ChooseOption(text);
Until (result Or (TimeFromMark(MaxTime)>100));
Result:=TimefromMark(MaxTime)<100
End;

Function HOpenBank:Boolean;
Var
TempTpa: TpointArray;
Temp: T2DPointArray;
H, CTS, I, MSpeed, TempX, TempY, M:Integer;
Begin
M:=GetSystemTime;
MSpeed:=MouseSpeed;
MouseSpeed:=30;
if not LoggedIn Then Exit;
CTS := GetColorToleranceSpeed;
If not CTS = 2 Then ColorToleranceSpeed(2);
FindColorsSpiralTolerance(TempX, TempY, TempTPA, 738138, MSX1+10, MSY1+10, MSX2-10, MSY2-10, 10);//738138
Temp:= TPAtoATPAEx(TempTPA, 17, 18);
SortATPASize(Temp, True);
H:=High(Temp);
For I := 0 To H Do
Begin
MiddleTPAEx(Temp[i], TempX, TempY);
Writeln('Found The Bank In '+IntToStr(GetSystemTime - M)+' MiliSecs.');
MMouse(TempX, TempY, 0, 0);
Result:=HUpText(['ank']);
If Result Then Break;
Wait(100);
End;
If Result Then
Begin
Mouse(TempX, TempY, 0, 0, False);
Wait(50+random(25));
Result:=ChooseOption('uickly');
If Result Then Result:=HIsBankOpen(5000,True);
If Pinscreen Then Result:= InPin(InttoStr(Players[CurrentPlayer].Integers[0]));
If Result Then Result:=HIsBankOpen(5000,False);
end;
If Result Then Writeln('HOpenBank Succesfully Openend The Bank. In '+IntToStr(GetSystemTime - M)+' MiliSecs.');
If Not result Then Writeln('HOpenBank Did Not Open The Bank. ');
ColorToleranceSpeed(CTS);
MouseSpeed:=MSpeed;
MakeCompass('N');
End;

FreakyMonkey

2008-05-10 20:21:50

From: Dude Richard
I need a better bank opener as SRL's seems to be a bit un-reliable in Al Kharid, and I trust your work :)



THATS SO TRUE! ive noticed that with a lotta of the scipts and mine too.

Great Job hermpie! the time u took to make all the versions hopefully wont be time wasted ;)

EvilChicken!

2008-05-11 06:18:39

Hey, bud, I improoved the code slightly. Take a look:

Function HIsBankOpen: Boolean; //IMO maxtime should be preset.
Var// Pinscreen checking should be done manually, it only takes one command
Timer :Integer;

Begin
If not LoggedIn then exit;
MarkTime(Timer);
Repeat
Wait(100 + random(150));
If TimeFromMark(Timer) > MaxTime then
begin
Result := False;
break;
end;
until (BankScreen) or (PinScreen);
If not Result then WriteLn('Failed to find bank screen.');
End;

// HUpText and HOption is completely complimentary.

function HOpenBank:Boolean;
var
TempTpa: TpointArray;
Temp: T2DPointArray;
H, CTS, I, TempX, TempY, M:Integer; // Remove the unneeded vars. ^^

Begin
if not LoggedIn then exit;
M := GetSystemTime;
// 30 mousespeed is really not needed. -.-
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2); // "If not CTS = 2 Then" = complimentary
FindColorsSpiralTolerance(TempX, TempY, TempTPA, 738138, MSX1+10, MSY1+10, MSX2-10, MSY2-10, 10);
Temp:= TPAtoATPAEx(TempTPA, 17, 18);
SortATPASize(Temp, True);
H:=High(Temp);
For I := 0 To H Do
Begin
MiddleTPAEx(Temp[i], TempX, TempY);
MMouse(TempX, TempY, 6, 6); // Randomness! O_o
Wait(175 + random(175)); // Allways worked for me. Allways.
Result:= Pos('ank', RS_GetUpText); // You didn't even use UpText arrays!
If Result Then Break;
End;
If Result Then
Begin
GetMousePos(TempX, TempY); //GETMOUSEPOS!
Mouse(TempX, TempY, 0, 0, False);
Wait(75+random(375)); // Bit more randomness wouldn't hurt.
ChooseOption('uickly');
if HIsBankOpen then
begin// InPin already has "If PinScreen" ..ect
Writeln('HOpenBank openend the bank in ' + IntToStr(GetSystemTime - M) + ' MS.');
InPin(Players[CurrentPlayer].Pin); // As I remember, Pin is string now..
end;
end else WriteLn('HOpenBank failed to open the bank.');
ColorToleranceSpeed(CTS);
// "MakeCompass('N');" Whai?
End;

I think I improoved it to the better. But this function is great, I thnk I'll use this one in my Lumby Flax spinner.

By the way, this post is based on your last input in this thread. I'm on a iMac G3 from 1998 with no scar here, so I can't test if it compiles, but please test it and tell me how it works ^_^

ShowerThoughts

2008-05-11 06:29:29

Thanks This is okay..
EvilChicken you have to do something liek MsX1+100,Msy1+100,Msx2-100,msy2-100 if you want it to not totally freak out at lumby.