SRL Archive - OSR Help

Detecting Combat Help


Im fkn rare

2013-03-07 16:54:25

I have this for detecting combat: (Just a snippet, not a procedure) It constantly says In Combat: False, even though the color is on the screen.

begin
Combat1 := 1;
begin
if (FindColor(X, Y, 65280, 220, 110, 330, 220)) then
begin
Writeln('-* In Combat: True');
end
else Combat1 := 0;
if (FindColor(X, Y, 65280, 220, 110, 330, 220)) = false then
Writeln('-* In Combat: False');
wait(randomrange(100, 200));
ClickMouse2(mouse_right);
wait(randomrange(800, 1000));
P07_ChooseOptionMulti(['ttack']);

end;
end;

wthomas

2013-03-07 17:07:32

You could just use this for working out whether you're in combat
function incombat:boolean;
var x,y:integer;
begin
result:=findcolortolerance(x,y,65280,240,70,275,170,5);
end;

then amend your code to something like this; the mouse is already over the monster right?


begin
if inCombat then
Writeln('-* In Combat: True');
else
Begin
wait(randomrange(100, 200));
ClickMouse2(mouse_right);
wait(randomrange(800, 1000));
P07_ChooseOptionMulti(['ttack']);
end;
end;

Im fkn rare

2013-03-07 17:32:53

I tried what you gave me, but it still says In Combat: False in the debug constantly. Perhaps it's not checking for the color frequently enough throughout the entire script?

wthomas

2013-03-07 17:36:17

Ahh, i just typed it in there, remove the semicolon from the line above.

rj

2013-03-07 17:37:09

Try using a combination of pixelshift and what your currently using

Im fkn rare

2013-03-07 19:11:26

It's working, but not efficient enough. It rarely ever detects the color, I need it to detect the color constantly.