SRL Archive - SRL Suggestions

OpenBankFast Compass


Fwd Motion

2012-02-10 19:50:41

So I noticed that the compass would change depending on which bank you were at when using OpenBankChest, but this is not the case for OpenBankFast. I noticed that many banks will require a different compass direction rather than just 'N'. So I put in the directions that are required for most banks, I didn't do anything with the gnome banks, because I'm not sure which direction is required for those. I also made it so that the Varrock west bank parameter creates a random compass direction of either 'E' or 'W'(This might need to stay 'N').

So the compass direction has become "Info[10]".

I also added numbering at the top to make it more convenient for future editors.

Have a look at it and tell me what you think.

(*
OpenBankFast
~~~~~~~~~~~~

.. code-block:: pascal

function OpenBankFast(Location: String): Boolean;

Opens the bank.
Valid arguments are:
'feb', 'falador east bank'
'fwb', 'falador west bank'
'veb', 'varrock east bank'
'vwb', 'varrock west bank'
'db' , 'draynor bank'
'akb', 'al-kharid bank'
'eb' (Edgeville Bank)
'ctb', 'catherby bank'
'clt', 'camelot bank'
'nab', 'north ardougne bank'
'sab', 'south ardougne bank'
'ynb', 'yanille bank'
'ngb', 'north gnome bank'
'sgb', 'south gnome bank'
'wgb', 'warrior guild bank'
'fgb', 'fishing guild bank'
'tavb', 'taverly bank'

.. note::

Author: Wizzup? and Nielsie95
Last Modified: Unknown

Example:

.. code-block:: pascal

if OpenBankFast('feb') then
Withdraw(...);
*)
function OpenBankFast(Location: String): Boolean;
var
bo, i, l, c, z, vwbint: Integer;
Info: TVariantArray;
Booths: TPointArray;
ABooths: T2DPointArray;
UpText: TStringArray;
B: TBox;
vwbstring:String;
begin
result := false;
if (not LoggedIn) then
Exit;
if BankScreen or PinScreen then
begin
Result := True;
Exit;
end;
UpText := ['Bank booth', 'ank boo'];

{ 0 1 2 3 4 5 6 7 8 9 10 }
case LowerCase(Location) of { Sort X Sort Y Color Tol Hue Sat Count SplitTPA? W H Compass}
'akb', 'al kharid': Info := [MSCX - 50, MSCY, 11196157, 20, 0.20, 1.15, 100, False, 10, 10, 'W']; // Fixed 12/7, #40
'lb', 'lumbridge': Info := [MSCX, MSCY - 50, 6780805, 10, 0.19, 0.27, 100, False, 10, 10, 'N']; // Fixed 12/7, #40
'veb', 'varrock east': Info := [MSCX, MSCY + 50, 3037545, 5, 0.41, 1.32, 100, False, 10, 10, 'S']; // Fixed 12/7, #40
'vwb', 'varrock west': begin vwbint := random(10); case vwbint of 0..5: vwbstring := 'E'; 6..10 : vwbstring := 'W'; end;
Info := [MSCX, MSCY, 3037545, 5, 0.41, 1.32, 100, False, 10, 10, vwbstring]; // Fixed 12/7, #40
end;
'feb', 'falador east': Info := [MSCX, MSCY + 50, 5008519, 10, 0.22, 0.67, 100, False, 10, 10, 'S']; // Fixed 12/7, #40
'fwb', 'falador west': Info := [MSCX, MSCY + 50, 5074569, 15, 0.22, 0.67, 50, False, 10, 10, 'S']; // Fixed 12/7, #40
'db', 'draynor': begin UpText := ['ount', 'unte', 'oun', 'unter'];
Info := [MSCX - 50, MSCY, 5136741, 5, 0.73, 0.49, 15, False, 10, 10, 'W']; // Fixed 12/7, #40
end;
'eb', 'edgeville bank': Info := [MSCX + 20, MSCY, 3561835, 20, 0.32, 0.61, 50, False, 10, 10, 'E']; // Fixed 12/7, #40
'ctb', 'catherby bank': Info := [MSCX, MSCY, 3239049, 8, 0.20, 0.20, 100, False, 10, 10, 'N'];
'clt', 'camelot bank': Info := [MSCX, MSCY, 7636882, 5, 0.20, 0.20, 100, False, 10, 10, 'N'];
'nab', 'north ardougne bank': Info := [MSCX, MSCY, 4084572, 5, 0.20, 0.20, 100, False, 10, 10, 'S'];
'sab', 'south ardougne bank': Info := [MSCX, MSCY, 4084572, 5, 0.20, 0.20, 100, False, 10, 10, 'E'];
'ynb', 'yanille bank': Info := [MSCX, MSCY, 3239049, 7, 0.20, 0.20, 100, False, 10, 10, 'E'];
'ngb', 'north gnome bank': Info := [MSCX, MSCY, 3239049, 7, 0.20, 0.20, 100, False, 10, 10, 'N'];
'sgb', 'south gnome bank': Info := [MSCX, MSCY, 3239049, 7, 0.20, 0.20, 100, False, 10, 10, 'N'];
'wgb', 'warrior guild bank': Info := [MSCX, MSCY, 2578286, 7, 0.20, 0.20, 100, False, 10, 10, 'W'];
'fgb', 'fishing guild bank': Info := [MSCX, MSCY, 2908796, 10, 0.20, 0.20, 100, False, 10, 10, 'W'];
'tavb', 'taverly bank': begin UpText := ['ount','unte','oun','unter'];
Info := [MSCX, MSCY, 3556433, 7, 0.20, 0.20, 100, False, 10, 10, 'W'];
end;
else
begin
srl_Warn('OpenBankFast', 'Unknown bank: '+Location, warn_AllVersions);
Exit;
end;
end;

MakeCompass(Info[10]);
z := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Info[4], Info[5]);

FindColorsSpiralTolerance(Info[0], Info[1], Booths, Info[2], MSX1, MSY1, MSX2, MSY2, Info[3]);
ColorToleranceSpeed(z);
SetColorSpeed2Modifiers(0.2, 0.2);

{ Split to ATPA. }
if Info[7] then
ABooths := SplitTPA(Booths, 1)
else
ABooths := TPAtoATPA(Booths, 10);

Booths := [];

{ Go through ATPA. }
l := GetArrayLength(ABooths) -1;
for i := 0 to l do
begin
{ Too few pixels. }
if (Length(ABooths[i]) < Info[6]) then
Continue;

{ Too small TPA bounds. }
B := GetTPABounds(ABooths[i]);
If ((B.X2 - B.X1) < Info[8]) Or ((B.Y2 - B.Y1) < Info[9]) Then
Continue;

Inc(bo);
SetArrayLength(Booths, bo);
Booths[bo-1] := MiddleTPA(ABooths[i]);

end;

SortTPAFrom(Booths, Point(Info[0], Info[1]));

l := GetArrayLength(Booths) -1;
for i := 0 to l do
begin

MMouse(Booths[i].X, Booths[i].Y, 3, 3);
if WaitUpTextMulti(UpText, 1000) Then
begin
GetMousePos(Booths[i].X, Booths[i].Y);
Mouse(Booths[i].X, Booths[i].Y, 0, 0, mouse_left);
FFLag(0);
MarkTime(c);
repeat
Wait(100);
until (BankScreen) or (PinScreen) or (TimeFromMark(c) > 10000);
Wait(Random(300));
if (HowManyPlayers > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
if (Result) then Exit;
end;
end;
end;

(I'm not totally sure this is even 100% necessary, I was just looking for another way to contribute :P)

Coh3n

2012-02-11 15:00:48

That's actually not a bad idea.

How come you have FE, FW, and VE at south? They work perfectly fine at north. I would say you only need to change the compass angle for banks facing east or west. North and south aren't really necessary as they'd look the same no matter which direction you're at.

Also, because Edgeville and Draynor are counters, I think they can stay at north.

I'm also not sure if this is necessary. I would say add a parameter so the scripter can choose to change the camera angle, but that would break scripts.

Fwd Motion

2012-02-11 15:45:54

From: Coh3n
That's actually not a bad idea.

How come you have FE, FW, and VE at south? They work perfectly fine at north. I would say you only need to change the compass angle for banks facing east or west. North and south aren't really necessary as they'd look the same no matter which direction you're at.

Also, because Edgeville and Draynor are counters, I think they can stay at north.

I'm also not sure if this is necessary. I would say add a parameter so the scripter can choose to change the camera angle, but that would break scripts.


I have them looking south, mainly because then you'd be looking directly at bank booths, but then again, I guess this also isn't necessary.

We could create a new function where the compass direction is declared by the script writer, but then again, we could just take out the compass change all together, which wouldn't break any scripts, but the writer of the script would have to "makecompass();"

But I have noticed that it will open banks better if its looking at the directly, which is why I thought this to be a somewhat good idea.

Coh3n

2012-02-11 19:24:13

From: Fwd Motion
But I have noticed that it will open banks better if its looking at the directly, which is why I thought this to be a somewhat good idea.
I agree except I don't that would be the case for, say, Varrock East Bank. I think it would work just as well if the compass was facing north or south. The difference is most scripts keep the compass facing north for walking.

E: I've elected not to add this. Not because it's a bad idea, but because it changes the way the function works significantly, but could really mess with scripts. If the compass angle really needs to be changed, it can be done in the script.