(*
have your hook in 2nd slot
food in last slot
no loot

*)
program New;
var
x,y,i:integer;
const
myposx=400;
myposy=500;
rangemax=300;
rangemin=10; //make bigger than 0
numberoftries=100; //how many times to try
checkhealth=1; //1=true 0=false use potions or food
function withinrange:boolean;
var
mydistance:integer;
begin
if findcolor(x,y,65535 ,16, 102,748, 546) then //yellow color found
begin
// returns x and y of the yellow object.
//distance formula
mydistance:=distance(myposx,myposy,x,y+20)
end
else
mydistance:=0
writeln(inttostr(x) + ',' + inttostr(y)) //debug
writeln(inttostr(mydistance))
if (mydistance < rangemax) and (mydistance > rangemin) then
result:=true
else
result:=false
end;
procedure move;
begin
sendarrowwait(1,150) //press rigth for 150 ms
sendarrowwait(0,250) //press up for 150 ms
end;
procedure kill;
begin
keydown(9) //tab
keyup(9)
wait(500)
if withinrange=true then
begin
keydown(84) //T to attack
wait(500)
keyup(84)
wait(100)
keydown(50) //2 attack to hook
keyup(50)
wait(2000)
repeat
wait(1000)
until(findcolortolerance(x,y,9109652,376, 300,439, 302,5)) //or (findcolortolerance(x,y,1184426,304, 120,508, 150,5)) //purple xp and red error
end;
if withinrange=false then move;
end;
procedure health;
begin
if checkhealth=1 then
begin
if findcolor(x,y,36352,98, 63,98, 63) then wait(100)
else
begin
movemouse(387, 567)
clickmouse(387, 567,true)
wait(3000)
end;
end;
if checkhealth=0 then
wait(100)
end;
//main code
begin
activateclient;
i:=0
repeat
wait(500)
kill;
health;
i:=i+1
until(i=numberoftries)
end.