Yago
2011-04-08 21:58:46
There is a problem when Reflection tries to open the bank booth, but the menu is tabbed. Here's a screen-shot of the problem:

Problem: Current Function Does Not Support Tabbed Menus.
Here's my proposed code to solve the problem:
Here is what I changed:
I am currently using this code as I have encountered no errors… It works great!!!

Problem: Current Function Does Not Support Tabbed Menus.
Here's my proposed code to solve the problem:
function R_OpenBankBooth(Bank : String) : Boolean;
var
Tiles: TPointArray;
P: TPoint;
Tries: Integer;
begin
Result := R_BankScreen or R_PinScreen;
if Result then Exit;
case LowerCase(Bank) of
'veb', 'varrock east':
Tiles := [Point(3251,3419), Point(3252,3419), Point(3253,3419),
Point(3254,3419), Point(3255,3419), Point(3256,3419)];
'vwb', 'varrock west':
Tiles := [Point(3190,3435), Point(3190,3437), Point(3190,3439),
Point(3190,3441), Point(3190,3443), Point(3181,3444),
Point(3181,3442), Point(3181,3440), Point(3181,3438),
Point(3181,3436)];
'falador west', 'fwb':
Tiles := [Point(2945,3367), Point(2946,3367), Point(2947,3367),
Point(2948,3367)];
'falador east', 'feb':
Tiles := [Point(3010,3354), Point(3011,3354), Point(3012,3354),
Point(3013,3354), Point(3014,3354), Point(3015,3354)];
'lumbridge', 'lb':
Tiles := [Point(3208,3221)];
'draynor', 'db':
Tiles := [Point(3091,3245), Point(3091,3243), Point(3091,3242)];
'al kharid', 'akb':
Tiles := [Point(3268,3168), Point(3268,3167), Point(3268,3166),
Point(3268,3169), Point(3268,3164)];
'seb', 'seers':
Tiles := [Point(2729,3494), Point(2728,3494), Point(2727,3494),
Point(2724,3494), Point(2722,3494), Point(2721,3494)];
'ctb', 'catherby':
Tiles := [Point(2807,3442), Point(2809,3442), Point(2810,3442),
Point(2811,3442)];
'eb', 'edgeville':
Tiles := [Point(3095,3489), Point(3095,3491), Point(3095,3493),
Point(3097,3495)];
'fgb', 'fishing guild':
Tiles := [Point(2584, 3423), Point(2584, 3422)];
'mc', 'moonclan':
Tiles := [Point(2098, 3920), Point(2097, 3920), Point(2098, 3920)];
'yb', 'yanille':
Tiles := [Point(2614, 3094), Point(2614, 3092), Point(2614, 3091)];
'da', 'duel arena': Tiles := [Point(3381, 3269), Point(3382, 3270)];
'anb', 'ardougne north': Tiles := [Point(2618, 3331), Point(2619, 3331), Point(2614, 3331)];
'asb', 'ardougne south': Tiles := [Point(2656, 3286), Point(2656, 3283), Point(2656, 3280)];
'pc', 'pest control':
Tiles := [Point(2667, 2652), Point(2666, 2652), Point(2665, 2652),
Point(2668, 2652)];
'cw', 'castle wars': Tiles := [Point(2445, 3083)];
else
begin
SRL_Warn('R_OpenBankBooth', 'Unsupported bank name.', -1);
Exit;
end;
end;
SortTPAFrom(Tiles, GetMyPos);
if (DistanceFrom(Tiles[0]) > 3) or not TileOnMS(Tiles[0], 10) then
begin
if not(TileOnMM(Tiles[0])) then
begin
SRL_Warn('R_OpenBankBooth', 'Could not find Bank Booth.', Warn_AllVersions);
Exit;
end;
WalkToTile(Tiles[0], 0, 0);
Wait(50);
R_Flag;
Wait(RandomRange(100, 200));
end;
if not(TileOnMS(Tiles[0], 10)) then
begin
SetAngle(True);
MakeCompass('n');
Wait(RandomRange(200, 400));
if not(TileOnMS(Tiles[0], 10)) then
begin
SRL_Warn('R_OpenBankBooth', 'Could get MS Point.', Warn_AllVersions);
Exit;
end;
end;
if (Bank = 'veb') or (Bank = 'varrock east') then
begin
if (GetMyPos = Tile(3250, 3419)) or (GetMyPos = Tile(3257, 3419)) then
begin
WalkToTile(Tile(3253, 3421), 1, 0);
end;
end;
P := TileToMS(Tiles[0], 10);
MMouse(p.x - 5, p.y - 5, 11, 11);
Wait(RandomRange(200, 300));
if WaitUpTextMulti(['ank', 'ooth'], 2000) then
begin
GetMousePos(P.x, P.y);
Mouse(P.x, P.y, 0, 0, false);
Wait(RandomRange(80, 110));
if IsMenuOpen then
if IsMenuTabbed then
begin
if ClickSubMenu(['se-quickly', 'ank', 'ooth'], 0, 1) then
repeat
R_Flag;
Wait(RandomRange(50, 90));
Inc(Tries);
if (Length(Players) > 0) then
if Players[CurrentPlayer].Pin <> '' then
Result := InPin(Players[CurrentPlayer].Pin);
Result := R_BankScreen or R_PinScreen;
until (Result) or (Tries > 20);
end else if R_ChooseOptionMulti(['Use-quickly']) then
repeat
R_Flag;
Wait(RandomRange(50, 90));
Inc(Tries);
if (Length(Players) > 0) then
if Players[CurrentPlayer].Pin <> '' then
Result := InPin(Players[CurrentPlayer].Pin);
Result := R_BankScreen or R_PinScreen;
until Result or (Tries > 20);
end else if IsUpTextMultiCustom(['ank', 'hest']) then //one-click bank chests
begin
GetMousePos(P.x, P.y);
Mouse(P.x, P.y, 0, 0, true);
Wait(RandomRange(80, 110));
P.x := 0;
repeat
R_Flag;
Wait(RandomRange(50, 90));
Inc(Tries);
if (Length(Players) > 0) then
if Players[CurrentPlayer].Pin <> '' then
Result := InPin(Players[CurrentPlayer].Pin);
Result := R_BankScreen or R_PinScreen;
until Result or (Tries > 40);
end;
end; Here is what I changed:
P := TileToMS(Tiles[0], 10);
MMouse(p.x - 5, p.y - 5, 11, 11);
Wait(RandomRange(200, 300));
if WaitUpTextMulti(['ank', 'ooth'], 2000) then
begin
GetMousePos(P.x, P.y);
Mouse(P.x, P.y, 0, 0, false);
Wait(RandomRange(80, 110));
if IsMenuOpen then
if IsMenuTabbed then
begin
if ClickSubMenu(['se-quickly', 'ank', 'ooth'], 0, 1) then
repeat
R_Flag;
Wait(RandomRange(50, 90));
Inc(Tries);
if (Length(Players) > 0) then
if Players[CurrentPlayer].Pin <> '' then
Result := InPin(Players[CurrentPlayer].Pin);
Result := R_BankScreen or R_PinScreen;
until (Result) or (Tries > 20);
end else if R_ChooseOptionMulti(['Use-quickly']) then
repeat
R_Flag;
Wait(RandomRange(50, 90));
Inc(Tries);
if (Length(Players) > 0) then
if Players[CurrentPlayer].Pin <> '' then
Result := InPin(Players[CurrentPlayer].Pin);
Result := R_BankScreen or R_PinScreen;
until Result or (Tries > 20);
end else if IsUpTextMultiCustom(['ank', 'hest']) then //one-click bank chests
begin
GetMousePos(P.x, P.y);
Mouse(P.x, P.y, 0, 0, true);
Wait(RandomRange(80, 110));
P.x := 0;
repeat
R_Flag;
Wait(RandomRange(50, 90));
Inc(Tries);
if (Length(Players) > 0) then
if Players[CurrentPlayer].Pin <> '' then
Result := InPin(Players[CurrentPlayer].Pin);
Result := R_BankScreen or R_PinScreen;
until Result or (Tries > 40);
end;
end; I am currently using this code as I have encountered no errors… It works great!!!