I'm building a script that will assist with the EOC abilities. My idea for this script is that it can work in any resolution with no setting up. You will just be able to press play and your abilities will be automatic.
My first atemp was using bmp tols. When a player presses run on the script and is engaged in combat it will start atempting to press the ability hot keys. It will be easier to list what the script does than explain it so I'm gona do that
1. It takes a bmp of say tab 10.
2. Presses tab 10 hot key.
3. looks for any change using the above bmp.
4. If there is change, the ability was used and it stores the first bmp to be used, to know when the ability is ready to be used in the future.
It repeats this until all abilities are stored and then all it has to do is when one of the bmps is seen it activates that ability.
The script below is the one I built this way. But the problem with this way that I don't like it it will have to loop threw each ability, even the inactive ones until adrenaline gets to 100% for each 100% ability you have in your bar. Which may or may not get you noticed by jagex. Continuously clicking on a useless button over and over might get noticed.
So I want to take a picture of the ability tab and if it's dark it's not an active ability. If it is bright in color it is an active ability.
program new;
{$I SRL/SRL.Simba}
const
//SetActionBar = True;
BarMax = 7;
var
AblBmp, AbCk: TIntegerArray;
function ActionBarSlotToBox_Custom(Slot: Integer): TBox;
var
W, H: Integer;
begin
if InRange(Slot, 1, 12) then
begin
GetClientDimensions(W, H);
with Result do
begin
X1 := 47 + (Slot - 1) * 36;
Y1 := H - 209;
X2 := X1 + 29;
Y2 := Y1 + 29;
end;
end else
writeln('ActionBarSlotToBox, Slot must be within 1-12!');
end;
procedure CheckActionSlotReady(abs: Integer);
var
x, y, c, rev, TempBmp: Integer;
Box: TBox;
begin
Box := ActionBarSlotToBox_Custom(abs);
if (AbCk[abs] = 0) then
begin
writeln('Taking a temp bmp from slot ' + IntToStr(abs));
TempBmp := BitmapFromClient(Box.x1 + 5, Box.y1 + 5, Box.x2 - 5, Box.y2 - 5);
SetBitmapName(TempBmp, 'TempBmp.bmp');
end else
begin
writeln('Getting stored bmp' + IntToStr(abs));
TempBmp := AblBmp[abs];
end;
if FindBitmapToleranceIn(TempBmp, x, y, Box.x1, Box.y1, Box.x2, Box.y2, 10) then
begin
writeln('Found bmp, using ability slot ' + IntToStr(abs));
TypeSendEx(IntToStr(abs), False);
end else Exit;
c := 0;
repeat
wait(RandomRange(100, 200));
Inc(c);
if (c > 5) then break;
writeln('c := ' + IntToStr(c));
until not FindBitmapToleranceIn(TempBmp, x, y, Box.x1, Box.y1, Box.x2, Box.y2, 10)
// Bitmap not found. Used ability
if (c >= 5) then
begin
if (AbCk[abs] = 1) then
begin
AbCk[abs] := 0;
writeln('Freeing bmp' + IntToStr(abs));
FreeBitmap(AblBmp[abs]);
end;
end else
begin
writeln('Slot ' + IntTosTR(abs) + ' set')
wait(5000);////////////////////////////
AbCk[abs] := 1;
writeln('Storeing bmp' + IntToStr(abs));
AblBmp[abs] := TempBmp;
SetBitmapName(AblBmp[abs], 'AblBmp[' + IntToStr(abs) + '].bmp');
end;
FreeBitmap(TempBmp);
end;
function GetTargetText: string;
var
W, H: Integer;
TPA: TPointArray;
Box: TBox;
begin
GetClientDimensions(W, H);
Box := IntToBox(W - 190, H - 360, W - 80, H - 270);
if FindColors(TPA, 3111603, Box.X1, Box.Y1, Box.X2, Box.Y2) then
begin
Box := GetTPABounds(TPA);
Result := GetTextAtExWrap(Box.X1, Box.Y1, Box.X2, Box.Y2, 0, 3, 4, 3111603, 0, UpChars);
end;
end;
function HaveTarget: Boolean;
var
x, y, W, H, TargetTxtBmp: Integer;
str: string;
TSA: TStringArray;
TPA: TPointArray;
Box: TBox;
begin
Result := False;
GetClientDimensions(W, H);
Box := IntToBox(W - 190, H - 360, W - 80, H - 270);
if FindColors(TPA, 3111603, Box.X1, Box.Y1, Box.X2, Box.Y2) then
Box := GetTPABounds(TPA);
MMouse(box.x1, box.y2, 0, 0);
wait(2000);
MMouse(box.x2, box.y2 + 20, 0, 0);
wait(2000);
if FindColorTolerance(x, y, 2657624, box.x1, box.y2,box.x2, box.y2 + 20, 36) then
begin
writeln('No Target Found');
end else
begin
writeln('Target Found');
if FindColorTolerance(x, y, 2657624, box.x1, box.y2,box.x2, box.y2 + 20, 36) then
result := True;
end;
end;
procedure MainLoop;
var
i, slot: Integer;
begin
//Checks health
// Checks Action bar
if HaveTarget then
begin
for i:= 0 to BarMax do
begin
case i of
0 : slot := BarMax;
1 : slot := BarMax - 1;
3 : slot := BarMax - 2;
4 : slot := BarMax - 3;
5 : slot := BarMax - 4;
6 : slot := BarMax - 5;
7 : slot := BarMax - 6;
8 : slot := BarMax - 7;
9 : slot := BarMax - 8;
10 : slot := BarMax - 9;
end;
writeln('Checking slot: ' + IntToStr(slot));
CheckActionSlotReady(slot);
if HaveTarget then Continue;
end;
end;
end;
procedure Setup;
var
i: Integer;
begin
setLength(AbCk, BarMax + 17);
setLength(AblBmp, BarMax + 1);
for i := 0 to High(AbCk) do
begin
AbCk[i] := 0;
end;
end;
var
W, H: Integer;
Begin
SetUpSRL;
Setup;
ClearDebug;
wait(2000);
repeat
MainLoop;
//writeln(GetTargetText);
wait(RandomRange(2000, 2200));
until(false)
End.