Results 1 to 4 of 4

Thread: MMToMS Appears to be broken

  1. #1
    Join Date
    Dec 2009
    Posts
    146
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default MMToMS Appears to be broken

    I'm having trouble with MMToMS, it is giving me invalid output

    I'm finding a point on the MM using color, that works fine.

    The color on the minimap is at (603,78).

    MMToMS tells me the same point on the MS is at (-24,118)

    The correct spot should be approximately (49,158)

    Anyone have any clue whats going wrong?

    I'm trying to decipher the function to figure out how it works but I'm stumped.

    It looks like it is first trying to determine a offset factor for the size of minimap depending on how large a screen you are on, then it calculates DIS which appears to be the distance from the centerpoint(you) to the point on the MM, then it tries to translate that to the MS but it's not working at all for me.

    Can anyone clue me in?

    Thanks in advance!
    Last edited by jimthesoundman; 01-15-2010 at 05:17 AM.

  2. #2
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Run this script while in an area where are several NPCs. It will debug the MS positions of all NPCs, you can also run and rotate camera to test it better.
    SCAR Code:
    program New;
    {.include srl/srl.scar}

    Var
      TPA: TPointArray;
      MSTPA: TPointArray;
      T, I, L: Integer;

    Procedure DrawBox(B: TBox; Time: Integer);
    Var
      T: Integer;
      drawing : TBitmap;
    Begin
      drawing := TBitmap.Create;
      drawing.canvas.handle := GetTargetDC;
      drawing.canvas.Pen.Color := CLRED;
      MarkTime(T);
      Repeat
        drawing.canvas.MoveTo(B.X1,B.y1);
        drawing.canvas.LineTo(B.X2,B.y1);
        drawing.canvas.LineTo(B.X2,B.y2);
        drawing.canvas.LineTo(B.X1,B.y2);
        drawing.canvas.LineTo(B.X1,B.y1);
        Wait(2);
      Until(TimeFromMark(T) > Time);
    End;

    begin
      T := GetSystemTime + 12000;
      While (GetSystemTime < T) Do
      Begin
        TPA := GetMinimapDots('npc');
        L := Length(TPA);
        SetLength(MSTPA, L);
       
        For I := 0 To (L - 1) Do
        Begin
          MSTPA[I] := MMtoMS(TPA[I]);
          If PointInBox(MSTPA[I], IntToBox(MSX1, MSY1, MSX2, MSY2)) Then
            DrawBox(IntToBox(MSTPA[I].X-20, MSTPA[I].Y-20, MSTPA[I].X+20, MSTPA[I].Y+20), 20);
        End;
      End;
    end.

  3. #3
    Join Date
    Dec 2009
    Posts
    146
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I ended up writing my own version of MMToMS:

    Code:
    Function MM2MS(MM: TPoint): TPoint;
    
    begin
        Result.x:=round((627-MM.X)*8.570);
        Result.y:=round((85-MM.Y)*6.15);
        if MM.X<627 then Result.x:=270-Result.x else Result.x:=270+Result.x;
        if MM.Y<85 then Result.y:=170-Result.y else Result.y:=170+Result.y;
        If Not IntInBox(Result.X, Result.Y, IntToBox(MSX1, MSY1, MSX2, MSY2))then Result := Point(-1, -1);
    end;
    I hope it works, I think it will.

  4. #4
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Maybe the point you were using was not on the main screen? Only about 3/8ths of the minimap is visible on the mainscreen.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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