Results 1 to 15 of 15

Thread: DrawATPA Error / SmartGraphics Error

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

    Default DrawATPA Error / SmartGraphics Error

    Error: Exception: The Points you passed to DrawATPA exceed the bitmap's bounds at line 96

    Code:
    Line 91{*
    Line 92  Authors: Sir R. Magician, Brandon.
    Line 93
    Line 94  Draws a TPA with a specified Colour onto Smart's Canvas.
    Line 95  Clears the Canvas first if Clear is set to true.
    Line 96*}

    I'm running m34t's planker script, which he no longer updates so been going through trying to resolve some of the errors it gives out. Whenever it goes to bank to withdraw items from the bank it will make it to the point where you right click on the item to choose how many to withdraw then it gives the above error.

    I searched on the forums here for others who had similar errors but the coding wasn't the same as in those incidents.

    Any help or suggestions are welcome.

  2. #2
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Can you post the function that contains line 96?
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  3. #3
    Join Date
    Mar 2012
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'd be happy to but I dunno which it is, I'm fairly new at attempting to resolve issues on this script, any guidance as to whereas the function would be located?

    I'm a bit noob, sorry.

  4. #4
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    the Points are out of range of the SMART canvas.

    say a bitmap is 20 by 20 (Width 20, height 20)
    if you wanna draw at point(20, 21) you'd get that error.

    beat's me how you got that error tho, i cant even find the DrawATPA function.

  5. #5
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Quote Originally Posted by Dill View Post
    I'd be happy to but I dunno which it is, I'm fairly new at attempting to resolve issues on this script, any guidance as to whereas the function would be located?

    I'm a bit noob, sorry.
    Find line 96. There should be lines above it and below it. Somewhere above it, there should be something like
    Simba Code:
    procedure {procedure name}(?? : integer, ???: Array of Tpoint);//something like this
      var//followed by this
    i: integer;     //some stuff like this below
    A: TpointArray;
    begin//there definitely is a begin here
    {lines of code, including line 96 with the ATPA stuff}
    end;//the function ends here
    ^That is pretty much what a function/procedure looks like. Find it and post it.(note: it may say function instead of procedure, comparing it to the above example)
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  6. #6
    Join Date
    Mar 2012
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    procedure SMART_DrawDotsEx(Clear: boolean; Pixels: TPointArray; Color: TColor);
    {$IFDEF SMART}
    var
      P: TPointArray;
    begin
      if (not SMART_DebugSetup) then
        SMART_SetupDebug;
    
      if Clear then SMART_ClearCanvas;
      P := CopyTPA(Pixels);
      OffsetTPA(P, Point(SRL_NAVBAR_INGAME_X, SRL_NAVBAR_INGAME_Y));
      SMART_Canvas.DrawTPA(P, Color);
    {$ELSE}
    begin
    {$ENDIF}
    end;
    Those are the lines under 96, the lines above 96 were as posted above.

  7. #7
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    I believe someone had this error in my GOP script aswell. I think it has something to do with the offset from the navigiation bar. It might push the TPA coordinates out of the SMART client bounds.

    Script source code available here: Github

  8. #8
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    What about line 96 on that script?(the planker)
    The stuff you posted are from the include, and work fine on other scripts.
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  9. #9
    Join Date
    Mar 2012
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    function DownloadToFile(const URL, Filename: string): boolean;
    var
      FileI: LongInt;
      FileC, FileH: string;
    begin
      Result := False;
    
      FileI := InitializeHTTPClient(False,False);
      try
        FileC := GetHTTPPage(FileI, URL);
        FileH := GetRawHeaders(FileI);
    
        if ((FileC = '') or (FileH = '')) then
        begin
          WriteLn('Error downloading "' + URL + '".');
          Exit;
        end;
    
        FileH := Copy(GetRawHeaders(FileI), 10, Pos(#13, FileH) - 10);
    
        if (FileH <> '200 OK') then
        begin
          WriteLn('Couldn''t download "' + URL + '", Error Code: ' + FileH + '.');
          Exit;
        end;
    Code:
      finally
        FreeHTTPClient(FileI);
      end;
    
      try
        if not FileExists(Filename) then
          FileI := CreateFile(Filename)
        else
          FileI := OpenFile(Filename, False);
    
        CloseFile(FileI);
    
        FileI := RewriteFile(Filename, False);
        Result := WriteFileString(FileI, FileC);
      finally
        CloseFile(FileI);
      end;
    end;
    That's the one above line 96 on the script

  10. #10
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by J J View Post
    I believe someone had this error in my GOP script aswell. I think it has something to do with the offset from the navigiation bar. It might push the TPA coordinates out of the SMART client bounds.
    Don't offset your points before plugging them into the drawing functions. They are offset by default at the start of the functions.

  11. #11
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    Wouldn't it just be better to add range checks to smart's draw functions?

    Edit: Like..

    Simba Code:
    procedure SMART_DrawDotsEx(Clear: boolean; Pixels: TPointArray; Color: TColor);
    {$IFDEF SMART}
    var
      P: TPointArray;
      T : TBox;
    begin
      if (not SMART_DebugSetup) then
        SMART_SetupDebug;

      if Clear then SMART_ClearCanvas;
      P := CopyTPA(Pixels);
      T := GetTPABounds(P);

      if ((T.X2 - T.X1) > Smart_Canvas.Width) or ((T.Y2 - T.Y1) > Smart_Canvas.Height) then
        exit; // this

      OffsetTPA(P, Point(SRL_NAVBAR_INGAME_X, SRL_NAVBAR_INGAME_Y));
      SMART_Canvas.DrawTPA(P, Color);
    {$ELSE}
    begin
    {$ENDIF}
    end;

    Dunno if it works.
    Last edited by Kasi; 10-12-2012 at 07:23 PM.

  12. #12
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Ever since we changed from paintsmart to smartgraphics there is no clipping which means if a point that is suppost to be draw is off the smart canvas it will just error out

    although this does work

    Simba Code:
    try
         smart_drawcircle(false,point(1,1),20,false,clred);
    except end;

    ^ just wont draw it and script will continue.
    Last edited by Olly; 10-12-2012 at 07:35 PM.

  13. #13
    Join Date
    Mar 2012
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hmm thanks for the help

  14. #14
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by Kasi View Post
    Wouldn't it just be better to add range checks to smart's draw functions?

    Edit: Like..

    Simba Code:
    procedure SMART_DrawDotsEx(Clear: boolean; Pixels: TPointArray; Color: TColor);
    {$IFDEF SMART}
    var
      P: TPointArray;
      T : TBox;
    begin
      if (not SMART_DebugSetup) then
        SMART_SetupDebug;

      if Clear then SMART_ClearCanvas;
      P := CopyTPA(Pixels);
      T := GetTPABounds(P);

      if ((T.X2 - T.X1) > Smart_Canvas.Width) or ((T.Y2 - T.Y1) > Smart_Canvas.Height) then
        exit; // this

      OffsetTPA(P, Point(SRL_NAVBAR_INGAME_X, SRL_NAVBAR_INGAME_Y));
      SMART_Canvas.DrawTPA(P, Color);
    {$ELSE}
    begin
    {$ENDIF}
    end;

    Dunno if it works.
    No that is the responsibility of the scripter.

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

    Default

    Quote Originally Posted by Ollybest View Post
    Ever since we changed from paintsmart to smartgraphics there is no clipping which means if a point that is suppost to be draw is off the smart canvas it will just error out

    although this does work

    Simba Code:
    try
         smart_drawcircle(false,point(1,1),20,false,clred);
    except end;

    ^ just wont draw it and script will continue.

    It was never clipped before either. It was just simply not drawn. Thus that TryCatch does the same thing as the old clipping. Also that navbar did indeed cause quite an uproar in SRL.
    I am Ggzz..
    Hackintosher

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
  •