SRL Archive - General Botting Help

How do I check if there is a monster attacking me?


Owinger

2014-12-11 21:12:30

I'm trying to make a script for a RSPS and the only problem I'm having is.

Sometimes whenever you're skilling, you will be attacked by a monster and it will kill you.

How do I check if a monster is attacking me on a private server?

KeepBotting

2014-12-11 21:48:05

DTMs or bitmaps would be your best bet.

You could search for the hitsplats or your health bar above your head.

rj

2014-12-11 22:34:50

Look for the healthbar above your head, function I used:
function healthBar(b:tbox):boolean;
var
red, green, bar:tpointarray;
healthbar:t2dpointarray;
i:integer;
bx:tbox;
begin
if ((mainscreen.bounds.x1 + (b.x1 - 2)) < 0) then
exit(false);
findColors(green, 65280, b.x1 - 2, b.y1-7, b.x2, b.y2);
findColors(red, 255, b.x1 - 2, b.y1 - 7, b.x2, b.y2);
bar := mergeAtpa([green, red]);
if (length(bar) > 0) then
begin
healthbar := clustertpa(bar, 1);
if (length(healthbar) = 0) then
exit(false);
for i := 0 to high(healthbar) do
begin
bx := gettpabounds(healthbar[i]);
if ((bx.x1 - bx.x1) > 25) then
exit(true);
end;
end;
end;

Owinger

2014-12-11 23:12:14

From: Robert
Look for the healthbar above your head, function I used:
function healthBar(b:tbox):boolean;
var
red, green, bar:tpointarray;
healthbar:t2dpointarray;
i:integer;
bx:tbox;
begin
if ((mainscreen.bounds.x1 + (b.x1 - 2)) < 0) then
exit(false);
findColors(green, 65280, b.x1 - 2, b.y1-7, b.x2, b.y2);
findColors(red, 255, b.x1 - 2, b.y1 - 7, b.x2, b.y2);
bar := mergeAtpa([green, red]);
if (length(bar) > 0) then
begin
healthbar := clustertpa(bar, 1);
if (length(healthbar) = 0) then
exit(false);
for i := 0 to high(healthbar) do
begin
bx := gettpabounds(healthbar[i]);
if ((bx.x1 - bx.x1) > 25) then
exit(true);
end;
end;
end;


I understand %0 of that code.

I don't get how it works or how to implement it.

rj

2014-12-11 23:40:25

From: Owinger
I understand %0 of that code.

I don't get how it works or how to implement it.


pass a box as a argument to looking for the healthbar

Olly

2014-12-12 00:15:17

From: Robert
pass a box as a argument to looking for the healthbar


Code is flawed.

x[Warrior]x3500

2014-12-12 10:13:37

From: Robert

if ((bx.x1 - bx.x1) > 25) then



if (5-5 > 25) then