Results 1 to 4 of 4

Thread: Need Help finding NPC

  1. #1
    Join Date
    Mar 2012
    Posts
    121
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Exclamation Need Help finding NPC

    Hey guys making a Monkfish Bot but need help I noticed that Bank (NPC) moves around a lot and I think that the script/bot will say could not find banker and will terminate the script and I need help what should I do so that the script will find the banker and will bank all the monkfish every single time it goes to bank
    Get 270 Quest points !

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

    Default

    Quote Originally Posted by kenddy3 View Post
    Hey guys making a Monkfish Bot but need help I noticed that Bank (NPC) moves around a lot and I think that the script/bot will say could not find banker and will terminate the script and I need help what should I do so that the script will find the banker and will bank all the monkfish every single time it goes to bank
    Use a TPA like so.

    Example from my beer buyer

    Simba Code:
    Function FindBartender:Boolean;
    var
      tmpCTS, i, l, r, counter: integer;// Name your variables
      BTTPA:TPointArray; // This is the name of the array
        begin  tmpCTS := GetToleranceSpeed;
          SetColorToleranceSpeed(2);
          SetToleranceSpeed2Modifiers(0.06, 0.34); // Hue and saturation from ACA
          FindColorsTolerance(BTTPA,//TPA name 6973285,//Color MSX1, MSY1, MSX2, MSY2,//Search area, main screen 10//Tolerance);
          SetColorToleranceSpeed(tmpCTS);
          SetToleranceSpeed2Modifiers(0.02, 0.02); // Set modifiers back to normal
          L := High(BTTPA) // Search the TPA
          marktime(counter);
          for i := 0 to L do // For i to L(random point) search for the color
           begin
            r := random(L);
            wait(randomrange(60, 200));
            mmouse(BTTPA[r].x, BTTPA[r].y, 2, 2); //Moves the mouse to the color found, with a offset of 2 each axis
            if waituptext('tender', 300) then // Checks uptext
              Break;
            if timefrommark(counter) > 3000 then // Time failsafe
              begin
                writeln('Failed to find the bartender'); // If it fails, debugs
              end;
          end;
          writeln('Found the bartender'); // Debug
          clickmouse2(mouse_right);  // Right clicks on him
          WaitOption('Talk-to', 500);  // Chooses the option to talk to him
          MarkTime(b); // Mark the time
          repeat
            wait(50+random(5)); // Repeats the wait until he responds ("yer") or time is 2000ms or 2 seconds after
          until((FindNPCChatText('yer', nothing)) or (TimeFromMark(b) > 2000));
      end;


    Hoep I explained it well enough :P Also, log in and out multiple times when using ACA to get a good tolerance.

  3. #3
    Join Date
    Jun 2008
    Location
    United States
    Posts
    818
    Mentioned
    60 Post(s)
    Quoted
    90 Post(s)

    Default

    kenddy3, follow SRLKing's advice in terms of using ACA to get the best color to use when searching for this NPC. Use CTS2 with hue/sat mods as shown in the code above; however, SRLKing, your code is no better than not using TPAs.

    SRLKing, you simply loop through every point that was determined to be within tolerance of the specified color that was searched (and at that, you aren't even guaranteeing that you mouse over every point because you use r := random(L) in your loop).

    kenddy3, once a TPA is acquired of every point that has been determined to be within tolerance of the specified color, you need to move on and use something like SplitTPA in order to break the points up into groups based on a specified maximum distance between points. From there, it becomes much easier to find what it is you are looking for, as you can filter these groups by a known size and other qualifiers.

    kenddy3, go to the Tutorial Island section of the forum and look through the intermediate/advanced tutorial sections for TPA/ATPA tutorials.
    Last edited by euphemism; 12-10-2012 at 02:22 AM.
    [10/14/13:19:03] <BenLand100> this is special relatively, just cleverly disguised with yachts

  4. #4
    Join Date
    Dec 2009
    Posts
    380
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    You could try something like this...

    Simba Code:
    function FindObjR(Colors:TIntegerArray; tol:Integer; Hue, Sat:Extended; x1, y1, x2, y2:Integer; Sort:Boolean; Point:TPoint; minCount:Integer; Text:TStringArray):Boolean;
    var
      tCTS, I: Integer;
      TPA: TPointArray;
      ATPA, rATPA: T2DPointArray;
      myPoint: TPoint;
    begin
      Result := False;
      if not LoggedIn then
        Exit;
      tCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorspeed2Modifiers(Hue, Sat);
      SetLength(rATPA, Length(Colors));
      for I := 0 to High(Colors) do
      begin
        FindColorsSpiralTolerance(MSCX, MSCY, rATPA[i], Colors[i], x1, y1, x2, y2, tol);
      end;
      TPA := MergeATPA(rATPA);
      if Length(TPA) = 0 then
      begin
        ColorToleranceSpeed(tCTS);
        Exit;
      end;
      ATPA := TPAtoATPAEx(TPA, 6, 6);
      if Sort then
        SortATPAFrom(ATPA, Point);
      SetLength(TPA, 0);
      For I := 0 to High(ATPA) do
      begin
        if Length(ATPA) < minCount then
          Continue;
        MiddleTPAEx(ATPA[i], x, y);
        MMouse(x, y, 1, 1);
        if IsUpTextMultiCustom(Text) then
        begin
          Result := True;
          ColorToleranceSpeed(tCTS);
          Writeln('FindObjR was successfull');
          Exit;
        end;
      end;
      ColorToleranceSpeed(tCTS);
    end;

    I made this (before I knew there was FindObjTPAMulti ). They're similar but this uses CTS2 instead.

    My code can use improvement. But for what I use it for it works fine.

    I'd highly suggest reading TPA tutorials. TPAs are wonderful

    (euphemism/any SRL members, not to steal this thread but can you critique the above code to help the OP and myself by suggesting improvements ).
    Currently: Playing OSRS legit until I get bored

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
  •