Results 1 to 4 of 4

Thread: Access Violation in 30 Line Script

  1. #1
    Join Date
    Mar 2007
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Access Violation in 30 Line Script

    Where did I go wrong?
    Code:
    program New;
    var
       a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z: integer;
       px,py: integer;
       acc: extended;
     
    procedure LoadPics;
    begin
         d:= LoadBitmap('.\letters\d.bmp');
         e:= LoadBitmap('.\letters\e.bmp');
         i:= LoadBitmap('.\letters\i.bmp');
         r:= LoadBitmap('.\letters\r.bmp');
         v:= LoadBitmap('.\letters\v.bmp');
    end;
     
    begin
         writeln('Waiting 3 seconds..');
         sleep(3000);
         writeln('Searching..');
         if(FindDeformedBitmapToleranceIn(d, px, py, 0, 0, 800, 600, 70, 0, True, acc)) then //PROBLEM LINE
         begin
              writeln('Found it');
         end else
         begin
             writeln('No dice.');
         end;
    end.

  2. #2
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    You never call LoadPics.

  3. #3
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    you havent loaded the bitmaps yet

    ~shut

    EDIT:
    SCAR Code:
    program New;
    var
       a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z: integer;
       px,py: integer;
       acc: extended;
     
    procedure LoadPics;
    begin
         d:= LoadBitmap('.\letters\d.bmp');
         e:= LoadBitmap('.\letters\e.bmp');
         i:= LoadBitmap('.\letters\i.bmp');
         r:= LoadBitmap('.\letters\r.bmp');
         v:= LoadBitmap('.\letters\v.bmp');
    end;
     
    begin
         LoadPics;
         writeln('Waiting 3 seconds..');
         sleep(3000);
         writeln('Searching..');
         if(FindDeformedBitmapToleranceIn(d, px, py, 0, 0, 800, 600, 70, 0, True, acc)) then //PROBLEM LINE
         begin
              writeln('Found it');
         end else
         begin
             writeln('No dice.');
         end;
    end.

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

    Default

    And btw, load the characters like this:
    SCAR Code:
    var
      Char: array [0..25] of integer;
      s: string;
      i: integer;

    begin
      s := 'abcdefghijklmnopqrstuvwxyz';
      for i := 0 to 25 do
       Char[i] := LoadBitmap('.\letters\'+s[i]+'.bmp');
    end;

    and when you wanna find letter D, do this:
    FindDeformedBitmapToleranceIn(Char[3], px, py, 0, 0, 800, 600, 70, 0, True, acc)

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
  •