Results 1 to 9 of 9

Thread: TNPC.Tile and TNPC.Pixel not working correctly

  1. #1
    Join Date
    Jun 2006
    Location
    0:0:0:0:0:0:0:1
    Posts
    75
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default TNPC.Tile and TNPC.Pixel not working correctly

    this is moving the mouse to the upper right corner instead of where the NPC is, and it does the same with NPCs[i].Pixel.x and NPCs[i].Pixel.y:

    Code:
    procedure GetFight;
    var
    NPCs : array of TNPC;
    TPoints : TPointArray;
    i,j,tries,checkFight : integer;
    begin
      if not (LoggedIn) then
      Exit;
      NPCs := SortNPCs(GetNPCs(false));
      If GetArrayLength(NPCs) = 0 then
      begin
        writeln('No mobs');
        Exit;
      end;
      for i := 0 to High(NPCs) do
      begin
        for j:= 0 to High(Players[0].Strings) do
        If NPCs[i].Name = Players[0].Strings[j] then
        begin
    
          If (NPCs[i].Interacting = 0) then
          begin
    
          MMouse( TileToMS(NPCs[i].Tile,NPCs[i].Height).x  , TileToMS(NPCs[i].Tile,NPCs[i].Height).y  ,3,3);
            //ChooseOption('ttack');
            NPCKill := NPCs[i];
            writeln('Got a fight');
            wait(2000);
          end;
        end;
      end;
    end;
    what am i doing wrong? I need to make it move the mouse to the NPC
    ----------------------------------------------------------------------------------

    http://www.youtube.com/watch?v=uZIpc0LeJg8&t=3m3s

  2. #2
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    I have the same issue, and I don't know why it happens. It sets the tile to the upper left corner of the NPC, rather than the middle of all the tiles it NPC occupies. What I do is have offsets for the NPC. So I'll have it move the mouse to (x - 20), (y + 20) so it will end up on the NPC. The offsets will vary depending on the NPC.

  3. #3
    Join Date
    Sep 2006
    Location
    Canada
    Posts
    1,124
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    That is how it has always worked.



  4. #4
    Join Date
    Nov 2009
    Posts
    471
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Try this, change 9710 with the npc id you are searching, this is what i was trying to tell you on irc as well.
    Code:
    var
    minid:TNPC;npcpos:tpoint;
    begin
    
    if(findnpc(9710,minid)) then
        Begin
        npcpos := tiletoms(minid.tile,0);
        mouse(npcpos.x,npcpos.y,2,2,true);
        wait(500);
    end;
    end;

  5. #5
    Join Date
    Oct 2006
    Posts
    1,211
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Are you referring to its moving the mouse to the upper right corner of the screen, or upper right corner of the monster?
    Extinct.

    Formally known as Drags111.

  6. #6
    Join Date
    Nov 2009
    Posts
    471
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    he is talking about upper left corner of screen.

  7. #7
    Join Date
    Oct 2006
    Posts
    1,211
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Just do your own TileToMS(NPC.Tile, NPC.Height*3/4);
    Extinct.

    Formally known as Drags111.

  8. #8
    Join Date
    Dec 2009
    Location
    R_GetPlayerLoc;
    Posts
    2,235
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    Quote Originally Posted by drags111 View Post
    Just do your own TileToMS(NPC.Tile, NPC.Height*3/4);
    Why 3/4? Does this give you accurate results?
    "Logic never changes, just the syntax" - Kyle Undefined?

    Remember, The Edit Button Is There For A Reason!!!

  9. #9
    Join Date
    Jun 2006
    Location
    0:0:0:0:0:0:0:1
    Posts
    75
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    FindNPCs(Players[0].Strings[0],NPCs); works
    thanks guys
    ----------------------------------------------------------------------------------

    http://www.youtube.com/watch?v=uZIpc0LeJg8&t=3m3s

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
  •