Bam Bam
2007-01-14 17:42:14
BBFightNPC:
Demonstration of usage:
I worked on this for a while and I think I got it as good as I can so I'm happy with it.
{*******************************************************************************
function BBFightNPC( Name: String; Color1, Color2, Color3, Tol: Integer ): boolean;
By: Bam Bam
Description: Fights NPC. Made at request for DLSA. Name = NPC Name;
Color1, Color2, Color3 = NPC Colors; Tol = Tolerance; Returns true after attacking,
false if infight or if NPC not found.
*******************************************************************************}
function BBFightNPC( Name: String; Color1, Color2, Color3, Tol: Integer ): boolean;
Var
I, Color: Integer;
begin
if(infight)then
begin
Status('[BBFightNPC] Already in fight');
result := false;
exit;
end;
wait(250 + random(250));
for I := 0 to 2 do
begin
if(infight)then
begin
Status('[BBFightNPC] Already in fight');
result := false;
exit;
end;
case I of
0: Color := Color1;
1: Color := Color2;
2: Color := Color3;
end;
Status('[BBFightNPC] Using color: '+inttostr(color));
wait(random(250));
if(FindColorSpiralTolerance(X, Y, color, MSX1, MSY1, MSX2, MSY2, Tol))then
begin
if(not(IsFightAt(X, Y)))then
begin
MMouse(X, Y, 3, 3);
if(isUpText(name))then
begin
if(infight)then
begin
Status('[BBFightNPC] Already in fight');
result := false;
exit;
end;
Status('[BBFightNPC] Attacked ' + name);
Mouse(X, Y, 0, 0, true);
flag;
result := true;
exit;
end;
end;
end;
wait(250 + random(250));
end;
Status('[BBFightNPC] Monster not found...');
result := false;
end;Demonstration of usage:
BBFightNPC('tt', 2508627, 1745882, 1141905, 10);
if(infight)then
begin
status('[BBFightNPC] Performing OutFight');
outfight;
end;I worked on this for a while and I think I got it as good as I can so I'm happy with it.