PDA

View Full Version : function FightNPCFindMob(Color:TintegerArray; tol: integer;Uptext:TStringArray): int



Lee Lok Hin
04-09-2008, 09:11 AM
This function finds a npc nearby, if not found, it tries to find a mob without a player next to it on the minimap.

Results : 1 then it found the NPC and has initiated a fight.
2 then has found a mob and went there
3 then has not found a mob without a player nearby, nor has managed to fight any NPCs

I know SRL has a FightNPC function, but this is goes to a mob o.O

Oh well, its my first function, so post any comments

Sorry, but Posted not working version. Please check back in around 15 minutes for the correct one..

EDIT: There you go!

function FightNPCFindMob(Color:TintegerArray; tol: integer;Uptext:TStringArray): integer; //My first function, so...

var
xxt,yyt,x,y,fcolx,fcoly,ftd:integer;
BoolInfight:boolean;

begin
if (not (LoggedIn) or (FindDead) or (InFight)) then Exit;
for ftd:=0 to high(color) do //Thanks to troll for pointing out the forgotten begin and end;
begin
x:=MSCX;
y:=MSCY;
if FindObjTPA(x, y, color[ftd], tol, -1, 15, 15, 25,Uptext)and
not(FindColor(fcolx, fcoly, 65280, x - 20, y, x + 20, y + 80)) and
not (BoolInfight=true) then
begin
BoolInfight:=True;
Result:=1;
Mouse(x,y,1,1,true);
Wait(1000+random(500));
Exit;
end else
end;
begin
xxt:=MMCX;
yyt:=MMCY;
if findcolorspiraltolerance(xxt,yyt,195836, MMX1, MMY1, MMX2, MMY2,tol) and
not(Boolinfight=true) and
not(findcolortolerance(fcolx,fcoly,16711422,xxt - 10,yyt - 10, xxt + 10, yyt + 10,tol)) then
begin
Mouse(xxt,yyt,5,5,true);
result:=2
Exit;
end else
end;
res

Usage:
case (FightNPCFindMob([9935011,4542295,6785973,3623778,6983867],8,['ttack'])) of
1:writeln('Attacking Monster');
2:writeln('Found mob, walking there');
3:writeln('Found no mob nor attacking NPC');
end;


And I just realised you cant edit [scar] tags without $#^#$ them over :p

faster789
04-15-2008, 12:02 AM
awesome was thinkin of making an autofighter sumtime..this might come handy..