Results 1 to 6 of 6

Thread: Function for Finding Hidden NPC

  1. #1
    Join Date
    Mar 2012
    Posts
    426
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default Function for Finding Hidden NPC

    Ok, so I have been using a script that needs to find a NPC who is stationary at all times. Normally I just search for his head color and that works fine, but lately some people have been placing a Clan Vexillum over the NPC to intentionally mess scripts up so I decided I needed to figure out a way to get past this. This what I have come up with and it seems to work well, but I was wondering if there is a better or more accurate way to do it. Thanks!

    Simba Code:
    Function FindHidden(x, y: Integer): Boolean;
    Var
    I: Integer;
    TPA: TPointArray;
    ATPA: Array of TPointArray;
    InvPoint: TPoint;

    Begin
      TPA  := GetMMDotsOnMS('npc')
      ATPA := TPAToATPAEx(TPA, 15, 15);
      MiddleTPAEx(ATPA[i], x, y);
      InvPoint := MMToMSEx(0, -20, Point(x,y));
      Begin
        MMouse(InvPoint.x, InvPoint.y, 0, 0);
        If(WaitUpTextMulti(['Clan','Vex','illum'],700)) Then Result:= True;
      End;
    End;

    Edit - Basically, I am saying this is my first time using GetMMDotsOnMs and MMToMSEx so I don't know if this is the best way to use them or if there are better options. Thanks!
    Last edited by iBlank; 05-08-2012 at 08:53 AM.

  2. #2
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    You'd most likely rather use something like this which I made for you:
    Simba Code:
    function FindAllNPCs(const UpText: AnsiString): Boolean;
    var
      I, J: Integer;
      tempTPA: array of TPoint;
    begin
      Result := False;
      tempTPA := GetMMDotsOnMS(#110);

      J := High(tempTPA);
      if(J < 0) then
        Exit;

      for I := 0 to J do
      begin
        MMouse(tempTPA[I].x, tempTPA[I].y, 5, 5);
        if(WaitUpText(UpText, 500)) then
        begin
          Result := True;
          Exit;
        end;

        Sleep(3500 + Random(4000));
      end;
    end;

    It will return True if your specified NPC is found using the UpText provided. And all you have to do is click the mouse (i.e. ClickMouse2).
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  3. #3
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Yes, Daniel's is slightly better because it searches for uptext.

    It was your idea though, not bad!

  4. #4
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    Yes, Daniel's is slightly better because it searches for uptext.

    It was your idea though, not bad!
    The one by alevere4 also searches for uptext just had to point that out
    Current Project: Retired

  5. #5
    Join Date
    Nov 2011
    Posts
    1,532
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Where is this place you're working where legits are spamming their vexillums?

    If your position is static, another way is to blind search, and right click through vex to hope your option is there.
    Current activity: Recovering from vacation
    - Nulla pars vitae vacare officio potest -
    SRL membership? Can I buy that?
    Scripts - AGS - SWF - WAR - EMS - W100S-EM
    If you need scripting help, you can pm me. Remember, if you need help you have to ask for it properly though

  6. #6
    Join Date
    Mar 2012
    Posts
    426
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by Er1k View Post
    Where is this place you're working where legits are spamming their vexillums?

    If your position is static, another way is to blind search, and right click through vex to hope your option is there.
    Oh you know, mobilising armies

    But no, I have to move from the bank to the investor so my position is different occassionally.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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