ogustuce
2019-08-02 06:31:42
hello everyone,here is a little function i've been working on the past few days and i thougth i'd share it.
What it does:
finds additionnal bars on your screen so you can use their slots. It finds them anywhere on the screen.
for example, in a combat script, i use it to find out if im out of food, since the food is on an extra action bar.
something like:
this way the bot wont stupidly mash the food button when your out of sharks.
This has other potential uses like finding if stuff on the sidebars are on cooldown or used for switching gear around via keybinds for more complex pvm stuff.
anyway, here's the function
you can delete all the ETL_ stuff, i used it to see what the function finds while building it.
it works with the modern font (the black-ish one) and of course no tranparancy. If you want it to work with other fonts, you'll have to change the bitmap.
also, if you call for a barnumber that is not on the screen you will get access violation error. IIrc members can have up to 10 bars (with unlocked extras) and if you just copy/paste this function you have to call slots from 0 to 13 ( so if you put findactionbarslot(3,0); it will find slot1 on bar 3).
What it does:
finds additionnal bars on your screen so you can use their slots. It finds them anywhere on the screen.
for example, in a combat script, i use it to find out if im out of food, since the food is on an extra action bar.
something like:
procedure heal;
var
x,y:integer;
SharkBox:Tbox;
begin
SharkBox:=FindsidebarSlot(7,4); // shark is on action bar 7 in slot 4
if actionbar.getHPpercent<50 then
begin
if findcolortolerancein(sharkColor,x,y,Sharkbox,25) then
presskey(VK_V); //sharkfood keybind
end
end
this way the bot wont stupidly mash the food button when your out of sharks.
This has other potential uses like finding if stuff on the sidebars are on cooldown or used for switching gear around via keybinds for more complex pvm stuff.
anyway, here's the function
function FindSidebarSlot(barNumber,slot:integer):Tbox;
var
i,j,l,k,h,x,d1,d2,y,halfgear,f:integer;
p:tpoint;
Circle,circle2:Tpointarray;
HboxShort,HboxLong,Vboxshort,VboxLong,box,box2,box3:Tbox;
circles:t2dpointarray;
Longbar:Boolean;
barslots:TboxArray;
Bars:Array of Tboxarray;
begin
setlength(bars,10);
Halfgear:= BitmapFromString(7, 14, 'meJxTlBZRkBKRFOFXlhOXFhMQlVd' +
'If/xXQoRPUpRf3ztc2caZj5vDuH1l9p//MuKCsq5h6U/+Ff/5F7Hn' +
'JZCR/OcfUKOcrVvQo39hn/8DUfib/0C2uBAvPy+nw4YX3s/++V34C' +
'2QY1s0XEBc3qJ4N5Hrc/me367OAopoQH5fdzk9ANUAR+/P/dOvXCf' +
'NziwnxqM+/qbHrn/6hv0BBhY59ArycitIifGJi8pHF6vNvGZ75a3P' +
'gj4C6oagQn5yEENB5Cj0XgIqBgkBkNnGfjIQgt46N6obfQEMgJBAB' +
'Hc+nawtUCUR8eUuApMyWf0CPA23k1bHhUTXg4WLn9MyXWfheT0MB6' +
'H1RQW55SWE5SSFBIQG+vMUAOdhwww==');
findcolorsspiraltolerance(x,y,circle,1343945,Getclientbounds,15);
circles:=SplitTPAex(circle,8,8);
h:=high(circles);
for i:=h downto 0 do
begin
box:=circles[i].getbounds;
filterpointspie(circles[i],0,360,6,8,middlebox(box).x,middlebox(box).y);
box:=circles[i].getBounds;
//etl_drawbox(Box,clred,true);
box:=circles[i].getBounds;
f:= strToIntdef(getTextAtEx(intToBox(box.x1, box.y1, box.x2,box.y2), 0, 0, 0, 3111603, 0, 'UpChars'), -1);
if (f>0) then
begin
p:=middlebox(circles[i].getBounds);
writeln(inttostr(p.x)+'/'+inttostr(p.y));
HboxLong:=[p.x-8,p.y+8,p.x+10,p.y+27];
HboxShort:=[p.x-8,p.y+40,p.x+10,p.y+64];
VboxLong:= [p.x+14,p.y-8,p.x+25,p.y+11];
VboxShort:= [p.x+40,p.y-8,p.x+60,p.y+11]
if middlebox(HboxLong).isInBox(getclientbounds) then
if findbitmaptolerancein(halfgear,x,y,HboxLong,35) then
begin
writeln('bar:'+inttostr(f)+' is horizontal Long');
//etl_drawbox(HboxLong,clgreen,true);
barslots:=grid(14,1,33,33,36,0,[p.x-493,p.y+10]);
bars[f]:=barslots;
end
if middlebox(VboxLong).isInBox(getclientbounds) then
if findbitmaptolerancein(halfgear,x,y,vboxLong,35) then
begin
writeln('bar:'+inttostr(f)+' is Vertical long');
// etl_drawbox(VboxLong,clgreen,true);
Barslots:=grid(1,14,33,33,0,36,[p.x+10,p.y-494]);
bars[f]:=barslots;
end
if middlebox(HboxShort).isInBox(getclientbounds) then
if findbitmaptolerancein(halfgear,x,y,HboxShort,35) then
begin
if not findbitmaptolerancein(halfgear,x,y,HboxLong,35) then
begin
writeln('bar:'+inttostr(f)+' is horizontal short');
// etl_drawbox(Hboxshort,clgreen,true);
barslots:=grid(7,2,33,33,35,35,[p.x-232,p.y+10]);
bars[f]:=barslots;
end
end
if middlebox(VboxShort).isInBox(getclientbounds) then
if findbitmaptolerancein(halfgear,x,y,vboxShort,35) then
begin
if not findbitmaptolerancein(halfgear,x,y,vboxLong,35) then
begin
writeln('bar:'+inttostr(f)+' is Vertical short');
// etl_drawbox(Vboxshort,clgreen,true);
barslots:=grid(2,7,33,33,36,35,[p.x+12,p.y-235]);
bars[f]:=barslots;
end
end
end
end
freebitmap(halfgear);
result:=bars[barNumber,Slot-1];
//etl_drawbox(result,clyellow,true);
end
you can delete all the ETL_ stuff, i used it to see what the function finds while building it.
it works with the modern font (the black-ish one) and of course no tranparancy. If you want it to work with other fonts, you'll have to change the bitmap.
also, if you call for a barnumber that is not on the screen you will get access violation error. IIrc members can have up to 10 bars (with unlocked extras) and if you just copy/paste this function you have to call slots from 0 to 13 ( so if you put findactionbarslot(3,0); it will find slot1 on bar 3).