SRL Archive - Jr. Member General Help and Discussion

Hover over banker


Thomas

2015-03-20 12:41:52

How would I go into adding a hover over banker in ashamans herblore script? I kind of wanted to include it in the antiban like this:
case i =1-200 then Hover NPC (no right click) until no item in slot 27 or 28. That seemed the most easy solution. But wouldn't allow for right click hover the way the mainloop etc is structured.

I don't know how I should add it the right click hover though, as the script currently repeats the antiban untill no items in 27/28. And then starts the loop again, starting with banking, making items and antiban untill no items.
procedure antiban;
var
i: integer;
begin
i := random(600);
case i of
1: boredHuman(false);
2..7:
begin
hoverSkill(Skill_Herblore);
wait(gaussRangeInt(600, 900));
end;
8..50: mouseMovingObject;
51..280: sleepAndMoveMouse(randomRange(100, mouseB));
291..310:
begin
mouseOffClient(4);
wait(randomRange(400, mouseB));
end;
311..600: wait(randomRange(300, 700));
end;
wait(gaussRangeInt(80, antiB));
end;


function banking: boolean;
var
t: TTimeMarker;
time: integer;
begin
if not isLoggedIn then
exit;
t.start;
SRL_Events[EVENT_ANTIBAN] := nil;
time := gaussRangeInt(10000, 14000);
repeat
wait(gaussRangeInt(100, 400));
if bankscreen.open(BANK_GE) then
break
else
minimap.setAngle(MM_DIRECTION_NORTH);
if (t.getTime > time) or (not isLoggedIn) then
exit;
until (bankScreen.isOpen or pinscreen.isOpen);
SRL_Events[EVENT_ANTIBAN] := @ antiban;
pinScreen.Enter(players[currentPlayer].bankPin);
begin
t.start;
time := gaussRangeInt(8000, 10000);
repeat
if bankScreen.clickButton(BANK_BUTTON_PRESET_1) then
break;
if (t.getTime > time) or (not isLoggedIn) then
exit;
wait(gaussRangeInt(0, 500));
until false;
end;
begin
t.start;
time := gaussRangeInt(4000, 8000);
repeat
if not bankScreen.__find() then
break;
if (t.getTime > time) or (not isLoggedIn) then
exit;
wait(gaussRangeInt(0, 200));
until false;
end;
begin
case random(10) of
0..7: slot := 11;
8..9: slot := 12;
end;
tabBackpack.mouseSlot(slot, MOUSE_MOVE);
end;
wait(gaussRangeInt(30, 160));
t.start;
repeat
if (tabBackpack.isItemInSlot(28)) then
break;
wait(gaussRangeInt(20, 140));
if (t.getTime > 20000) then
begin
writeln('Failed withdrawing, shutting down');
players[currentPlayer].logout;
end;
if not isLoggedIn then
exit;
until (tabBackpack.isItemInSlot(28));
if chatbox.findTextOnLines(['could not be'], [0]) then
if countColorTolerance(66033, chatbox.lineBoxes[0], 10) > 100 then
begin
writeln('Failed withdrawing, shutting down');
players[currentPlayer].logout;
terminateScript;
end;
result := true;
end;


function makeItems: boolean;
var
time, X, Y, i: integer;
T: TTimeMarker;
begin
if not isLoggedIn then
exit;
tabBackpack.Open;
begin
t.start;
time := gaussRangeInt(5000, 8000);
antiB := 1500;
mouseB := 1800;
getMousePOS(x, y);
if slot = 0 then
slot := 1;
if not pointInBox(point(x, y), tabBackpack.getSlotBox(11)) and not pointInBox(point(x, y), tabBackpack.getSlotBox(12)) then
begin
case random(10) of
0..7: slot := 11;
8..9: slot := 12;
end;
end;
tabBackpack.mouseSlot(slot, MOUSE_LEFT);
wait(gaussRangeInt(90, 250));
case random(10) of
0..7: slot := 16;
8..9: slot := 17;
end;
tabBackpack.mouseSlot(slot, MOUSE_LEFT);
wait(gaussRangeInt(110, 230));


repeat
if productionScreen.isOpen then
break;
wait(gaussRangeInt(50, 200));
if (not isLoggedIn) or (t.getTime > time) then
begin
minimap.clickCompass;
exit;
end;
until productionScreen.IsOpen;
wait(gaussRangeInt(50, 200));
if itemType = '' then
// begin
itemType := productionScreen.getSelectedBoxText;
// end;
productionScreen.clickStart;
if not tabBackpack.waitForShift(randomRange(3000, 3500)) then
exit;
wait(gaussRangeInt(50, 200));
timeout.start;
t.start;
time := gaussRangeInt(25000, 40000);
repeat
wait(gaussRangeInt(50, 200));
antiBan;
if (not isLoggedIn) or (t.getTime > time) then
exit;
until not (tabBackpack.IsItemInSlot(27));
itemCount := itemCount + 14;
end;
result := true;
end;


procedure mainloop;
var
i: integer;
begin
if not isLoggedIn then
begin
wait(7000);
writeln('Attempting to log back in');
repeat
try
players[currentPlayer].login;
inc(i);
except
end;
if (i = 7) then
begin
i := 0;
players.next(false);
end;
until isLoggedIn;
minimap.clickCompass;
timeout.start;
end;
if banking and (tabBackpack.isFull) then
begin
findNormalrandoms;
if makeItems then
begin
progressReport;
findNormalrandoms;
end;
end;
if timeout.getTime > 200000 then
begin
writeln('nothing has happened for too long, shutting down');
players[currentPlayer].logout;
terminateScript;
end;
if players[currentPlayer].Booleans[0] then
breakHandler(players[currentPlayer].integers[0], players[currentPlayer].integers[1], bir, bfr);
end;


begin
setup;
while (players.getActive() > 0) do
mainloop;
end.




I have currently added this, how do I prevent the mouse from moving as much as it currently does while it hovers over the bank?
I rather not add a wait for it. As it delays everything 2 much. I might consider making 2 seperate antibans; 1 for when inv count is still high and another (with hover option when invent is almost done)


function TRSBankScreen.__hoverGE(): Boolean;

function findBankerAreas(): TBoxArray;
var
TPA: TPointArray;
ATPA: T2DPointArray;
i: Integer;
b: TBox;
begin
FindColorsTolerance(TPA, 6580588, MainScreen.GetBounds(), 5, ColorSetting(2, 2.09, 0.55));
ATPA := ClusterTPAEx(TPA, 5, 5);

for i := 0 to High(ATPA) do
begin
if (Length(ATPA[i]) < 100) then
Continue;

b := GetTPABounds(ATPA[i]);

if (b.getWidth() < 15) or (b.getHeight() < 15) or
(b.getWidth() > 220) or (b.getHeight() > 220) or
(ATPA[i].getDensity() < 0.10) then
Continue;

b.Expand(10);
b.setLimit(MainScreen.getBounds());

Result := Result + b;
end;
end;

function findBanker(const Area: TBox): Boolean;
var
tFace, TPA: TPointArray;
aFace, ATPA: T2DPointArray;
i, j: Integer;
b: TBox;
p: TPoint;
begin
if (not FindColorsTolerance(tFace, 5408694, Area, 15, ColorSetting(2, 0.18, 0.67))) then
Exit(False);

aFace := ClusterTPAEx(tFace, 3, 3);
SortATPAFromMidPoint(aFace, MiddleBox(Area));

for i := 0 to High(aFace) do
if (Length(aFace[i]) > 4) and (Length(aFace[i]) < 50) then
begin
p := MiddleTPA(aFace[i]);
b := intToBox(p.x - 12, p.y, p.x + 12, p.y + 30);

if (not FindColorsTolerance(TPA, 11382432, b, 9, ColorSetting(2, 5.57, 0.48))) then
Continue();

ATPA := ClusterTPAEx(TPA, 4, 4);
SortATPASize(ATPA, True);

for j := 0 to High(ATPA) do
begin
if (Length(ATPA[j]) < 15) then
Continue();

mouse(ATPA[j].getMiddle().randRange(-4, 5));

if (isMouseOverText(['Bank Banker', 'ank Bank'])) then
begin

if (minimap.isFlagPresent(Random(300, 600))) then
minimap.waitFlag(10);
if (tabBackpack.isItemInSlot(28)) then
Exit(True);
end;
end;
end;
end;


var
i: Integer;
Boxes: TBoxArray;
begin
Result := False;
Boxes := findBankerAreas();

if (Length(Boxes) = 0) then
Exit(print('bankScreen.__openGE(): Found no possible area''s for a banker to be in', False));

SortBoxesFromMidPoint(Boxes, MainScreen.playerPoint);

for i := 0 to High(Boxes) do
if (FindBanker(Boxes[i])) then
Exit(print('bankScreen.__openGE(): Succesfully opened the GE bank', True, '', TDebug.DEBUG));
end;