Results 1 to 2 of 2

Thread: function FightNPCFindMob(Color:TintegerArray; tol: integer;Uptext:TStringArray): int

  1. #1
    Join Date
    Apr 2007
    Posts
    994
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default function FightNPCFindMob(Color:TintegerArray; tol: integer;Uptext:TStringArray): int

    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!

    SCAR Code:
    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:
    SCAR Code:
    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
    [QUOTE]<GoF`> oh no its Raymooond
    <Raymooond> Heya
    <GoF`> is it ray or some other ray?
    <LeeLokHin> No idea
    <LeeLokHin> Raymond, what's the game you like the most?
    <Raymooond> Runescape
    <-- LeeLokHin has kicked Raymooond from #srl (Faker.)[/QUOTE]

  2. #2
    Join Date
    Mar 2007
    Posts
    1,223
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    awesome was thinkin of making an autofighter sumtime..this might come handy..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. can't find uptext based on color
    By Economic Advancement in forum OSR Help
    Replies: 1
    Last Post: 10-03-2007, 12:39 AM
  2. MakeDTTM(var TheDTM:integer;TheDDTM: TIntegerArray);
    By mastaraymond in forum Research & Development Lounge
    Replies: 3
    Last Post: 07-10-2007, 05:07 PM
  3. Finding Color and UpText
    By I Pick Axes in forum OSR Help
    Replies: 12
    Last Post: 10-16-2006, 09:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •