Results 1 to 7 of 7

Thread: Better way to find a moving NPC?

  1. #1
    Join Date
    Dec 2011
    Location
    U.S.A.
    Posts
    635
    Mentioned
    5 Post(s)
    Quoted
    249 Post(s)

    Default Better way to find a moving NPC?

    I wrote this function to find a Npc, but the NPC keeps moving, so I have repeats in it.I want it to be faster, yet I cannot see how yet. Does anyone have any ideas that could improve it?
    Simba Code:
    Function FindNPC:Boolean;
    var
    Cts,a, y, Tries:Integer;
    NPCTPA:Tpointarray;
    NPCATPA:T2DPointarray;
    begin
      CTS:= GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.13, 1.05);
      marktime(y);
      repeat
      if FindColorsSpiralTolerance(MSCX, MSCY, NPCTPA, 4025793, msx1, msy1, msx2, msy2, 14) then
      begin
        if Debug then
        Writeln('Found npc colors...');

        NPCATPA := SplitTPAEx(NPCTPA, 5, 5);
        SortATPAFromMidPoint(NPCATPA, Point(262, 224-50))
      end;
        for a :=0 to high(NPCATPA) do
        begin
         MouseSpeed:=(Randomrange(9, 15));
          HumanMMouse(NPCTPA[a].x, NPCTPA[a].y, 3, 3);
          wait(300+Random(100));
          Inc(Tries);
          if isUptext('to') then
          begin
          Result := True;
          Exit;
         end else
           Result := False;
         end;
         Until(TimeFromMark(y) > 20000);
      ColorToleranceSpeed(CTS);
      SetColorSpeed2Modifiers(0.02, 0.02);
    end;

  2. #2
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    You can always increase mousepad and use waituptext instead of wait, if urtext blah blah blah. Personally I would just use super users surface include.

  3. #3
    Join Date
    Mar 2007
    Posts
    393
    Mentioned
    1 Post(s)
    Quoted
    98 Post(s)

    Default

    you can go little pit faster by decreasing this wait. Maybe use 150 + random 50?
    Simba Code:
    HumanMMouse(NPCTPA[a].x, NPCTPA[a].y, 3, 3);
          wait(300+Random(100));
          Inc(Tries);

  4. #4
    Join Date
    Dec 2011
    Location
    U.S.A.
    Posts
    635
    Mentioned
    5 Post(s)
    Quoted
    249 Post(s)

    Default

    That sounds good. I'll try decreasing the wait times.

  5. #5
    Join Date
    Jun 2007
    Location
    south park
    Posts
    1,160
    Mentioned
    0 Post(s)
    Quoted
    62 Post(s)

    Default

    Simba Code:
    MouseSpeed:=(Randomrange(9, 15));
          MMouse(NPCTPA[a].x, NPCTPA[a].y, 3, 3);
          wait(300+Random(100));
          Inc(Tries);
          if isUptext('to') then


    is (to) part of the npcs name?
    http://www.youtube.com/user/YoHoJoSRL
    Good scripting guides on youtube
    Formerly known as (djcheater)

  6. #6
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    MMDotsToMS?

    Calculate where the dot direction is moving, then search for it accordingly on the mainscreen?

  7. #7
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Quote Originally Posted by NKN View Post
    MMDotsToMS?

    Calculate where the dot direction is moving, then search for it accordingly on the mainscreen?
    This works well, I use this to find monsters a lot

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
  •