Results 1 to 8 of 8

Thread: TPA Debug script

  1. #1
    Join Date
    Apr 2012
    Posts
    157
    Mentioned
    10 Post(s)
    Quoted
    57 Post(s)

    Default TPA Debug script

    Hey guys,

    I found a tutorial by Cazax about TPAs and he has a debug script in there. However when I run it it runs an error..

    The script is as follows
    Code:
    Function DebugTPA(Points: TPointArray; BmpName: String): Boolean;
    
    Var
       Width, Height, ClientBMP, I: Integer;
       xs, ys, xe, ye: Integer;
    
    Begin
      Try
      Begin
        xe := xs xor xs;
        ye := ys xor ys;
        xs := 1 shl 20;
        ys := 1 shl 20;
    
        For I := 0 To High(Points) Do
        Begin
          xs := Min(xs, Points[i].X);
          ys := Min(ys, Points[i].Y);
    
          xe := Max(xe, Points[i].X);
          ye := Max(ye, Points[i].Y);
        End;
    
        Width := xe - xs;
        Height := ye - ys;
    
        DisplayDebugImgWindow(0, 0);
        DisplayDebugImgWindow(Width, Height);
        ClientBMP := BitmapFromString(Width, Height, '');
    
        CopyClientToBitmap(ClientBMP, xs, ys, xe, ye);
        For I := 0 To High(Points) Do
          FastSetPixel(ClientBMP, Points[i].X - xs, Points[i].Y - ys, 255);
        If BmpName <> '' Then
          SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
        SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
        DisplayDebugImgWindow(Width, Height);
    
        FreeBitmap(ClientBMP);
      End
      Except
        FreeBitmap(ClientBMP);
      End;
      Result := True;
    End;
    and I am calling it like this:
    Code:
    DebugTPA(C, '');
    and I get an error
    Code:
    [Error] (245:5): Unknown identifier 'SafeDrawBitmap' at line 244
    Any help is appreciated! I'm trying to make sure my TPAs are working, and from the looks of this, the script will mark where the tpas were found on an image. Correct me if I am wrong! Thanks!

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

    Default

    Simba Code:
    {$I SRL/SRL.Simba}
    {$I SRL/SRL/Misc/Debug.Simba}

    var
        SomeTPAToDebug: TPointArray;
    begin
        SetupSRL;
        DebugTPA(SomeTPAToDebug, '');
    end.
    I am Ggzz..
    Hackintosher

  3. #3
    Join Date
    Apr 2012
    Posts
    157
    Mentioned
    10 Post(s)
    Quoted
    57 Post(s)

    Default

    Thank you. That compiled! But do I need to be using Smart for that?

    I am currently not, and it just kinda brings up a tiny window that all I can do is close, and is like, 8x8 pixels.

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

    Default

    Quote Originally Posted by serajin View Post
    Thank you. That compiled! But do I need to be using Smart for that?

    I am currently not, and it just kinda brings up a tiny window that all I can do is close, and is like, 8x8 pixels.

    For Debugging you do not need smart.. If you want to debug on smart then you do:

    Simba Code:
    {$DEFINE SMART}
    {$I SRL/SRL.Simba}
    {$I SRL/SRL/Misc/PaintSmart.Simba}

    Smart_DrawDots(TPAToDraw);
    Now the previous code I gave you does exactly what it says. It opens a debug window with you TPA Drawn to it. If your didn't select your client, you TPA will have no points to draw so the window will be the size of the Close button.
    I am Ggzz..
    Hackintosher

  5. #5
    Join Date
    Apr 2012
    Posts
    157
    Mentioned
    10 Post(s)
    Quoted
    57 Post(s)

    Default

    Hmm..well while I waited on your reply.. I got smart to load(which I was having trouble with). But I do have my client selected, and I get a really small window. It's not quite the size of the close button, but it has 1 black dot on a white screen. And If I move it, the whole box turns black. and I can click the close button at any time.

    Any ideas why it may not be grabbing a snapshot of the client? Should I run as admin?

    Edit: This is the window that pops up (http://imgur.com/bmL0Z)

    Edit 2: The TPA is getting points. I have them listed out before it trys to debug them. And I have made my character successfully navigate points as well...so I know there is data there.

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

    Default

    Quote Originally Posted by serajin View Post
    Hmm..well while I waited on your reply.. I got smart to load(which I was having trouble with). But I do have my client selected, and I get a really small window. It's not quite the size of the close button, but it has 1 black dot on a white screen. And If I move it, the whole box turns black. and I can click the close button at any time.

    Any ideas why it may not be grabbing a snapshot of the client? Should I run as admin?
    Check the size of your TPA. The TPA your passing it probably has no points. Make sure it has some. Try WriteLn(TPA);

    And see if it prints points.. Try if (Length(TPA) < 10) then writeln('TPASmall');

    Stuff like that.
    I am Ggzz..
    Hackintosher

  7. #7
    Join Date
    Apr 2012
    Posts
    157
    Mentioned
    10 Post(s)
    Quoted
    57 Post(s)

    Default

    yea..okay I'm dumb! I was looking at a TPA I DID have that was full of points. And The new one I created to test had no points..

    Sorry for all the confusion!

  8. #8
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

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
  •