SRL Archive - Research & Development Lounge

Hermpie's banking proc's and Func's makes banking a piece of a cake!


ShowerThoughts

2008-05-23 16:46:06

Hi, I present to u:
- HOpenBank:
Opens the bank + solving + waiting until bankscreen.

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, TempX, TempY, HColor, M:Integer;
Begin
M:=GetSystemTime;
Case LowerCase(WhichBank) Of
'feb','falador east':HColor:= 2243147;
'fwb','falador west':HColor:= 3496051;
'veb','varrock east':HColor:= 2050647;
'vwb','varrock west':HColor:= 1653574;
'akb','alkharid':HColor:= 738138;
'dnb','draynor':HColor:= 670801;
'evb','edgevillage':HColor:= 2636871;
'pcb','pestcontrol':HColor:=11647942;
End;
If HColor < 1 Then Writeln('Your Choice Is A Not Existing Bank.');
If (WhichBank ='Draynor') or (WhichBank ='DNB') Then MakeCompass('E') else MakeCompass('N');
if not LoggedIn Then Exit;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(TempX, TempY, TempTPA, HColor, MSX1+10, MSY1+10, MSX2-10, MSY2-10, 5);//Change the Color, Tol, Where to search.
Temp:= TPAtoATPAEx(TempTPA, 17, 18);//Change the Bigness.
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');//Change this
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 IsBankOpen(5000,True);
If Pinscreen Then Result:= InPin(InttoStr(HPin));
If Result Then 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);
End;

Begin
SetUpSRL;
HOpenBank('Falador West',Players[currentplayer].Integers[0]);
End.

- WalkBank:
Walks to every F2p bank.
Note: no one tested it yet so tell me if not working i am pretty sure they are.
Program Hermpie;
{.Include SRL/SRL.Scar}
Var
X, Y:Integer;

Function WalkBank(WhichBank:String; RanXnY:Integer; SymbolFailSafe:boolean):Boolean;
Var
DTM, BankX, BankY :Integer;
Begin
Case LowerCase(WhichBank) Of
'feb1': DTM := DTMFromString('78DA63E461646058C98002D62EEA61F80FA48' +
'1320CFF81809103C8DA00916384AAF90F542082C4670499B39180' +
'1A01206B1301352244A89100B23613502343580D00F34718AA');
'feb2': DTM := DTMFromString('78DA639462646058C78002D62EEA61F80FA48' +
'1320CFF81809103C8DA00916384AAF90F542082C467E401B23612' +
'502300646D22A0468408351240D666026A6408AB010005E318BD');
'fwb' : DTM := DTMFromString('78DA639465646058CA8002FEFFFFCFF01F483' +
'342D8FF194581AC35103946A89AEFDF19184490F88C5244A89123' +
'428D12116AD409AB0100888F16CE');
'akb' : DTM := DTMFromString('78DA63E463646058CC8002DEBF7FCFF01F480' +
'36518FE0301231B90350722C70855F3FD3B038308129F9115C85A' +
'88AA06680CAA1A16206B29AA9AFFFFD1D43003592BF1AB010029A' +
'91342');
'veb' : DTM := DTMFromString('78DA639460646058C78002AA4B8B19FE0369A' +
'00CC37F2060E405B23640E418A16ABE7F67601041E2330A02591B' +
'09A81125420DC83D9B50D5FCFF8FA64616C8DA4CC01C054C35E8E' +
'6000083EA181E');
'vwb1': DTM := DTMFromString('78DA6364656460D8C88002A23C0D19FE0369A' +
'00CC37F2060FCCB0057C30855F3FE3D038308121FAC6615AA9AFF' +
'FFD1D4800C5D44C01C909A5944A89984DF2E009D8518B2');
'vwb2': DTM := DTMFromString('78DA6394676460D8CE8002FEFFFFCFF01F483' +
'342D8FF19D5116A18E16A18184490F860351B08A8D100B25610A1' +
'660101359A40D64CFC6A00D106174F');
'evb' : DTM := DTMFromString('78DA632C616260086000032608C530B9BD93E' +
'13F906604E2FF40C0580594F14555F3E70F138324540D0830D601' +
'653C09A80199134A849A38FC6A00CF351302');
'lbb' : DTM := DTMFromString('78DA639462646058C100068C108AE1FFFFFF0' +
'C92503E90FD9F11A46601448E15AAE6FB7706B81AB05E7E20AB0E' +
'D59C20053435EC40D66DFC6A00056A0D2F');
End;
Result:= DTMRotated(DTM, BankX, BankY, MMX1, MMY1, MMX2, MMY2);
If Result Then MouseFlag(BankX, BankY, RanXnY + 1, RanXnY + 1);
If Not Result And SymbolFailSafe Then
Begin
Result:=FindSymbol(BankX, BankY, 'Bank');
If Result Then MouseFlag(BankX, BankY,RanXnY + 1, RanXnY + 1);
End else
Writeln('Failed to find the bank, you might want to set SymbolFailSafe to true.');
End;

Begin
SetUpSRL;
WalkBank('lbb',2,True);
End.
- XDtm:
Finds a Dtm in the Ms Mi or Mc will Right click it and will auto caculate what Choose option to do 1,5,10,all, or X and it will type the number.

Program LMAO;
{.Include SRL/SRL.Scar}
Var
X, Y:Integer;

Function XDTM(DTM, HowMany:Integer; Text, Where:string):Boolean;
Var
Option, Items :string;
Begin
Case LowerCase(Where) of
'mi','inv': Result:= FindDTM(DTM, X, Y, MIX1, MIY1, MIX2, MIY2);
'ms','bank' : Result:= FindDTM(DTM, X, Y, MSX1, MSY1, MSX2, MSY2);
'mc','chat': Result:= FindDTM(DTM, X, Y, MCX1, MCY1, MCX2, MCY2);
Else
Writeln(Where + ' is not allowed to use, mi, ms, mc, bank, inv, chat. Thank You.');
End;
If Result And (HowMany = 0) Then Result:=True;
If Result And (HowMany = 0) Then Exit;
If Result Then
Begin
MMouse(X, Y, 7, 7);
Wait(10+random(30));
If IsUptext(text) Then
Begin
GetMousePos(X,Y);
Mouse(X, Y, 0, 0, False);
Wait(10+random(30));
end else
Result:= False;
If Not Result Then Exit;
case HowMany of
0:Option:='ll';
1: Option:= '1';
5: Option:= '5';
10: Option:= '10';
else Option:= 'X';
end;
Result:=ChooseOption(Option)
If Option='X' Then Wait(750+random(500));//Add A Detection For The How Many X Screen.
If Option='X' Then TypeSend(IntToStr(HowMany));
End;
End;

Begin
SetUpSRL;
XDTM(DTM,12,'izza','bank');
End.


FindDTMInInvSlot:
Does what the name says.

Program LMAO;
{.Include SRL/SRL.Scar}
Var
X, Y:Integer;

Function FindDtmInInvSlot(Var DtmX, DtmY :Integer; DTM, Slot:Integer):boolean;
Var
DtmBox:TBox;
Begin
If (Slot > 28) or (Slot < 1) Then Result:=False;
If Not Result Then WriteLn('The Slot Values Must Be A Value 1 - 28.');
If Not Result Then exit;
DtmBox:= InvBox(Slot);
Result:= FindDTM(DTM, DtmX, DtmY, DTMBox.X1, DTMBox.Y1, DTMBox.X2, DTMBox.Y2)
End;

Begin
SetUpSRL;

End.

Hermpie

AbsTrACt'^.|

2008-05-23 16:58:36

Great work. Thanks for this. I really needed it.

ShowerThoughts

2008-05-23 16:59:38

[QUOTE=AbsTrACt'^.|;407928]Great work. Thanks for this. I really needed it.[/QUOTE]

Np

kor

2008-05-23 17:22:57

good job hermpie ;) easy to use and probably effective.

Program LMAO;

LOL

ShowerThoughts

2008-05-23 17:25:52

Thanks! Test it please?!

kor

2008-05-23 17:35:01

i will probably try it once i get time to :p i need a good bank opener for draynor, so i guess i could try this out. im currently fishing at edge and then ill go back to draynor. :)

ShowerThoughts

2008-05-23 17:36:13

From: kor
i will probably try it once i get time to :p i need a good bank opener for draynor, so i guess i could try this out. im currently fishing at edge and then ill go back to draynor. :)


Note it will move the compass to west or east for it so i don't think that is a good idea but dude i will give it another try for u okay ;)

Starblaster100

2008-05-24 07:30:13

[php]
Case HowMany Of
2,3,4,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27:Option:= 'X';
1:Option:= '1';
5:Option:= '5';
10:Option:= '10';
28:Option:= 'll';
End;
[/php]

???

[php]
case HowMany of
1: Option:= '1';
5: Option:= '5';
10: Option:= '10';
else Option:= 'X';
end;
[/php]

Is a tiny example of how you can make this better. You can do a lot of code optimization in this.

ShowerThoughts

2008-05-24 08:08:21

From: Starblaster100
[php]
Case HowMany Of
2,3,4,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27:Option:= 'X';
1:Option:= '1';
5:Option:= '5';
10:Option:= '10';
28:Option:= 'll';
End;
[/php]

???

[php]
case HowMany of
1: Option:= '1';
5: Option:= '5';
10: Option:= '10';
else Option:= 'X';
end;
[/php]

Is a tiny example of how you can make this better. You can do a lot of code optimization in this.

Thanks!

Nava2

2008-06-02 19:25:26

ilu.

Nava2

P.S. I'm using these ;)

ShowerThoughts

2008-06-09 10:20:54

Np!

Any ideas!?

bullzeye95

2008-06-09 12:13:46

You never free your DTM in WalkBank.
Also, you have
If Result And (HowMany = 0) Then Result:=True;
Which could just turn into
Result:= Result and (HowMany = 0);

In IsBankOpen, you don't need to set the result in the loop. It will just get overwritten later. All you need is
if(CheckForPinScreen)then if(PinScreen)then break;

In HOpenBan, you have
If (WhichBank ='Draynor') or (WhichBank ='DNB') Then
You should check for lowercase. (Lowercase(WhichBank) = 'draynor')

In WalkBank, I'm sure you can use a couple of those DTMs for multiple banks and cut down some lines.

In FindDtmInInvSlot, you have
If (Slot > 28) or (Slot < 1) Then Result:=False;
Which could be
Result:= (Slot <= 28) and (Slot >= 1);

BTW, why do you always do stuff like
  if not Result then DoSomething;
if not Result then DoSomethingElse;
?
IMO, it's more proper to just do
  if not Result then
begin
DoSomething;
DoSomethingElse;
end;

Dusk412

2008-06-10 00:56:57

Problem: Your string Where in XDTM has inv and bank mixed up. inv should search MIx1 and such and bank should search MSx1 and such. You have them backwards. Other than that XDTM works great for me.

ShowerThoughts

2008-06-11 11:16:17

From: bullzeye95
You never free your DTM in WalkBank.
Also, you have
If Result And (HowMany = 0) Then Result:=True;
Which could just turn into
Result:= Result and (HowMany = 0);

In IsBankOpen, you don't need to set the result in the loop. It will just get overwritten later. All you need is
if(CheckForPinScreen)then if(PinScreen)then break;

In HOpenBan, you have
If (WhichBank ='Draynor') or (WhichBank ='DNB') Then
You should check for lowercase. (Lowercase(WhichBank) = 'draynor')

In WalkBank, I'm sure you can use a couple of those DTMs for multiple banks and cut down some lines.

In FindDtmInInvSlot, you have
If (Slot > 28) or (Slot < 1) Then Result:=False;
Which could be
Result:= (Slot <= 28) and (Slot >= 1);

BTW, why do you always do stuff like
  if not Result then DoSomething;
if not Result then DoSomethingElse;
?
IMO, it's more proper to just do
  if not Result then
begin
DoSomething;
DoSomethingElse;
end;


U use 5 line i do 2 lines ;)