bmxgt187
2013-02-08 23:50:42
so anyways this is my question i got this working almost great… ya almost.. wondering what i need to do to make it to where it waits until the monster is dead until it clicks the next one as of right now it clicks one then it fights for like 3-5 seconds then it starts to click another monster…
any tip would be great
any tip would be great
program Auto_Soulsplit_Fighter;
{$i srl/srl.simba}
const
COLOR = 6387343; // Monster Colour
TOL = 10; // Colour Tolerance
///////////////////////////////////////////////////////
//PLEASE DO NOT TOUCH UNLESS YOU KNOW WHAT YOUR DOING//
function Click(): boolean;
var
x, y, w, h: integer;
B: TBox;
begin
GetMousePos(x, y);
w := 525;
h := 338;
GetClientDimensions(w, h);
B := IntToBox(x - 15, y - 15, x + 15, y + 15);
if B.x1 < 0 then B.x1 := 0;
if B.y1 < 0 then B.y1 := 0;
if B.x2 > w then B.x2 := w;
if B.y2 > h then B.y2 := h;
begin
if findColorTolerance(x, y, 62713, B.x1, B.y1, B.x2, B.y2, 20) then
begin
Result := True
Exit;
end;
end;
end;
Function YellowClick: Boolean;
begin
Result := Click;
end;
Function RedClick: Boolean;
begin
Result := Not Click;
end;
Function Moving: Boolean;
var
MovingBox: Tbox;
begin
MovingBox := IntToBox(259, 133, 272, 151);
Result := (AveragePixelShift(MovingBox, 500, 300) > 80);
//Writeln(IntToStr(AveragePixelShift(MovingBox, 500, 300))); //Shows PixelShift in debug
end;
Function InFight: Boolean;
var
InFightBox: Tbox;
begin
InFightBox := IntToBox(260, 137, 277, 185);
Result := (AveragePixelShift(InFightBox, 500, 300) > 100);
//Writeln(IntToStr(AveragePixelShift(InFightBox, 500, 300))); //Shows PixelShift in debug
end;
procedure FindMonster;
var
I, Kill : Integer;
Corners, TPA: TPointArray;
begin
Corners := [Point(266, 174), Point(0, 0), Point(520, 0), Point(0, 340), Point(520, 340)];// Corners of the client and center point
I := 0
begin
repeat
if I = 4 then
Exit;
if FindColorsSpiralTolerance(Corners[i].X, Corners[i].Y, TPA, COLOR, MSX1, MSY1, MSX2, MSY2, TOL) then
begin
MarkTime(Kill);
Mouse(TPA[i].X, TPA[i].Y, 0, 0, true);
Writeln('Attempting To Attack!');
if YellowClick then
begin
Writeln('');
Writeln('Missed!');
Writeln('Searching Again!');
Writeln('');
Continue;
end;
if RedClick then
begin
Wait(4000);
if (TimeFromMark(Kill) > 6000) and not Moving then
begin
Writeln('');
Writeln('Monster Already Infight');
i := i + 1;
Writeln('Searching Again!');
Writeln('');
Continue;
end else
if InFight then
begin
Writeln('Attacking!');
begin
repeat
Wait(2000);
until not InFight and not Moving or (TimeFromMark(Kill) > 2000);
end;
Writeln('Monster Dead!');
Writeln('');
Wait(2000);
end;
end;
end;
until (false);
end;
end;
begin
SetupSRL;
ClearDebug;
begin
repeat
FindMonster;
until (false);
end;
end.