realrune
2006-05-25 21:47:47
procedure RealEatIfNeeded(foodcolor, eathp : integer; foodlogout : boolean); //modified from my old autofighter
begin
if(GetHp < EatHp)and(FoodColor > 0)then
begin
if(FindColorSpiraltolerance(x, y, foodcolor, 560, 210, 730, 460, 2) = true)then
begin
Mmouse(x + 2, y - 2, 6, 5)
if(IsUpText('Eat') = true)then
begin
GetMousePos(x, y);
mouse(x, y, 3, 2, true);
end;
end
Else
begin
if(FoodLogout = true)then
begin
logout;
Players[CurrentPlayer].Active:= false;
end;
end;
end;
end;
function IsFight : boolean; //results true if you are in a fight.
var
x, y : integer;
begin
result:=false;
if(FindColorSpiral(x, y, GreenStatusColor, 180, 90, 320, 230))then
begin
wait(1000 + random(250));
if(FindColorSpiral(x, y, GreenStatusColor, 180, 90, 320, 230))then
result:=true;
end;
end;
function IsFightAt(x, y : integer) : boolean; //results true if it finds a fight near x,y.
var
xx, yy : integer;
begin
result:=FindColorSpiral(xx, yy, GreenStatusColor, x - 20, y - 20, x + 20, y + 20);
end;
function FindAttackableNpc(color1, color2, color3, tol : integer; npcname : string) : boolean; //finds an npc with the certain colors and name. (makes sure npc isn't already being attacked).
var
rcolor, rnumber, x, y : integer;
begin
result:=false;
rnumber:= random(2);
case rnumber of
0 : rcolor:=color1;
1 : rcolor:=color2;
2 : rcolor:=color3;
end;
if(findcolorspiraltolerance(x, y, rcolor, 218, 118, 282, 186, tol))then
begin
mmouse(x, y, 5, 5);
if(IsFightAt(x, y) = false)and(IsUpText('Attack '+ npcname) = true)then
result := true;
end
Else
if(findcolorspiraltolerance(x, y, rcolor, 9, 9, 511, 333, tol))then
begin
mmouse(x, y, 5, 5);
if(IsFightAt(x, y) = false)and(IsUpText('Attack '+ npcname) = true)then
result := true;
end;
end;
function FindAttackableNpc2(color1, color2, color3, tol : integer) : boolean; //finds an npc with the certain colors and name. (makes sure npc isn't already being attacked).
var
rcolor, rnumber, x, y : integer;
begin
result:=false;
rnumber:= random(2);
case rnumber of
0 : rcolor:=color1;
1 : rcolor:=color2;
2 : rcolor:=color3;
end;
if(findcolorspiraltolerance(x, y, rcolor, 218, 118, 282, 186, tol))then
begin
mmouse(x, y, 5, 5);
if(IsFightAt(x, y) = false)and(IsUpText('At') = true)then
result := true;
end
Else
if(findcolorspiraltolerance(x, y, rcolor, 9, 9, 511, 333, tol))then
begin
mmouse(x, y, 5, 5);
if(IsFightAt(x, y) = false)and(IsUpText('At') = true)then
result := true;
end;
end;Explanations:
RealEatIfNeeded(foodcolor, eathp : integer; foodlogout : boolean);
- foodcolor is color of food to eat.
- it will only eat if hp is lower then eathp.
- foodlogout, if this is true script will disable char's without food.
Others aren't too hard to figure out FindAttackableNPC just finds an npc to attack, it doesn't click on attack.