Results 1 to 8 of 8

Thread: Help, MMtoMS always return -1, -1

  1. #1
    Join Date
    Mar 2012
    Location
    Grambling, LA
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help, MMtoMS always return -1, -1

    Hi,
    I saw an useful function MMtoMS used on Narcle's fast figher. I myself thought of implementing the function on my own script to find door, but it always returns me -1, -1. What am I missing?

    Simba Code:
    Procedure findDoor;
    var
      x, y: Integer;
      p: TPoint;
    begin
      MouseSpeed := 15;
      if FindColorTolerance(x, y, 67062, MMX1, MMY1, MMX2, MMY2, 15) then
      begin
        writeln('color found');
        //Testing if Minimap center if found on MainScreen
        p := MMtoMS(Point(MMCX, MMCY));
        MMouse(p.x, p.y, 0, 0);

        p := MMtoMS(Point(x, y));
        MMouse(p.x, p.y, 0, 0);
      end else
        writeln('Color not found');
    end;

    It outputs: "Color found", but moves the mouse to -1, -1 ALWAYS. What are the requirements for using the particular function MMtoMS.

  2. #2
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Try reading the documentation. You're using the function all wrong..
    Code:
    (*
    MMToMSEx
    ~~~~~~
    
    .. code-block:: pascal
    
        Function MMtoMSEx(Xmod, Ymod: integer; MM: TPoint): TPoint;
    
    Turns a Minimap point into a close MS point. New one compensates for angles.
    Xmod and Ymod change the starting point on MainScreen.  Ymod = -30 would
    raise the points on screen by 30 pixels. This is good if you know the
    Height of the npc or object your looking for on MS.
    Formula in GridCoords16Ex now.
    
    .. note::
    
        by Narcle
    
    Example:
    
    .. code-block:: pascal
    
        FindTreeOnMinimap(x, y);
        msPoint := MMToMSEx(0, -20, Point(x,y));
        MMouse(msPoint.x, msPoint.y, 0, 0);
        //...
    
    *)
    It's there to learn from, use it.

    Edit: To elaborate; you don't need to call MMToMS() twice. You call it once to set the TPoint, then from that point on P carries the x and y values of your coordinate(hence the p.x and p.y). All that's left to do is click.
    Last edited by NCDS; 05-03-2012 at 03:26 AM.

  3. #3
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Try reading the documentation. You're using the function all wrong..

    Edit: To elaborate; you don't need to call MMToMS() twice. You call it once to set the TPoint, then from that point on P carries the x and y values of your coordinate(hence the p.x and p.y). All that's left to do is click.
    He's MM to MS-ing two different points.. One is the minimap center which he calls MMToMS for and it returns the middle of the mainscreen.

    The next he calls MMToMS for the Point returned from his finder function.. and that returns (-1, -1). The only problem I see there is that his finder function does not find the colours he's searching for on the MM.

  4. #4
    Join Date
    Mar 2012
    Location
    Grambling, LA
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Try reading the documentation. You're using the function all wrong..
    Code:
    (*
    MMToMSEx
    ~~~~~~
    
    .. code-block:: pascal
    
        Function MMtoMSEx(Xmod, Ymod: integer; MM: TPoint): TPoint;
    
    Turns a Minimap point into a close MS point. New one compensates for angles.
    Xmod and Ymod change the starting point on MainScreen.  Ymod = -30 would
    raise the points on screen by 30 pixels. This is good if you know the
    Height of the npc or object your looking for on MS.
    Formula in GridCoords16Ex now.
    
    .. note::
    
        by Narcle
    
    Example:
    
    .. code-block:: pascal
    
        FindTreeOnMinimap(x, y);
        msPoint := MMToMSEx(0, -20, Point(x,y));
        MMouse(msPoint.x, msPoint.y, 0, 0);
        //...
    
    *)
    It's there to learn from, use it.

    Edit: To elaborate; you don't need to call MMToMS() twice. You call it once to set the TPoint, then from that point on P carries the x and y values of your coordinate(hence the p.x and p.y). All that's left to do is click.
    Hi, thanks for the reply. I did read the documentation and example. But seems like I am misunderstanding something.

    Because even I just try the same example in the documentation, it returns -1, -1.
    Simba Code:
    msPoint := MMToMSEx(0, -20, Point(MMCX,MMCY));
        MMouse(msPoint.x, msPoint.y, 0, 0);

    Could you provide me a working example please. I know I am missing something, but cant figure out what.

  5. #5
    Join Date
    Mar 2012
    Location
    Grambling, LA
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ~Problem Fixed~

    Sorry for the confusion. I think The function only works when SMART is enabled, I tried the script on a browser window, and always return -1, -1.

    Thanks all for the help.
    Last edited by johnbrown8976; 05-03-2012 at 03:46 AM.

  6. #6
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Start by Any NPC on screen..

    Simba Code:
    function RandomPointDist(TPA: TPointArray; MaxDist: Integer): TPoint;      //By MormonMan
    var
      MP, P: TPoint;
    begin
      if not LoggedIn then Exit;
      P := Point(-1, -1);
      MP := MiddleTPA(TPA);
      while (Distance(MP.x, MP.y, P.x, P.y) > MaxDist) do
        P := TPA[Random(Length(TPA) - 1)];
      Result := P;
    end;

    Function NPCDotsToMS: Boolean;
    var
      NPCs: TPointArray;
      P: TPoint;
      B: TBox;
    begin
      NPCs:= GetMMDotsOnMS('NPC');
      SortTPAByY(NPCs, True);
      P:= RandomPointDist(NPCs, 20);
      P:= MMToMS(P);
      Result:= P <> Point(-1, -1);
      B:= IntToBox(P.X - 20, P.Y - 20, P.X + 20, P.Y + 20);
      MouseTBox(B, 3);
    end;

  7. #7
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by johnbrown8976 View Post
    ~Problem Fixed~

    Sorry for the confusion. I think The function only works when SMART is enabled, I tried the script on a browser window, and always return -1, -1.

    Thanks all for the help.
    Did you select the client..? And also Call ActivateClient.

  8. #8
    Join Date
    Mar 2012
    Location
    Grambling, LA
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Did you select the client..? And also Call ActivateClient.
    Oh, I did not call ActivateClient, I thought that would not be needed coz my window was on the top.

    Thanks for clearing it.

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
  •