Results 1 to 3 of 3

Thread: Runtime Error...

  1. #1
    Join Date
    Aug 2007
    Posts
    19
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Runtime Error...

    What is wrong if I get the error:
    [Runtime Error] : Exception: Canvas does not allow drawing in line 18

    Heres the script:

    SCAR Code:
    program CrazyTaxi;

    const
    RoadColor=11119017;

    var
    x,y,f,b,l,m,r:integer;

    procedure DodgeCars;
    begin
     b:=500
     l:=645
     r:=m*2-l
     m:=707
     f:=2
     SendArrowWait(0,2200);
     repeat
      if not(FindColor(x,y,RoadColor,l,b,l,b)) and not(FindColor(x,y,RoadColor,m,b,m,b)) and(FindColor(x,y,RoadColor,r,b,r,b)) then
       begin
        if(f=2) then
         begin
          SendArrow(1);
          f:=f+1
          WriteLn('Now in file 3');
         end else
        if(f=1) then
         begin
          SendArrow(1);
          Wait(150);
          SendArrow(1);
          f:=f+2
          WriteLn('Now in file 3');
         end;
       end else
      if(FindColor(x,y,RoadColor,l,b,l,b)) and not(FindColor(x,y,RoadColor,m,b,m,b)) and not(FindColor(x,y,RoadColor,r,b,r,b)) then
       begin
        if(f=2) then
         begin
          SendArrow(3);
          f:=f-1
          WriteLn('Now in file 1');
         end else
        if(f=3) then
         begin
          SendArrow(3);
          Wait(150);
          SendArrow(3);
          f:=f-2
          WriteLn('Now in file 1');
         end;
       end else
      if not(FindColor(x,y,RoadColor,l,b,l,b)) and(FindColor(x,y,RoadColor,m,b,m,b)) and not(FindColor(x,y,RoadColor,r,b,r,b)) then
       begin
        if(f=1) then
         begin
          SendArrow(1);
          f:=f+1
          WriteLn('Now in file 2');
         end else
        if(f=3) then
         begin
          SendArrow(3);
          f:=f-1
          WriteLn('Now in file 2');
         end;
       end else
      if not(FindColor(x,y,RoadColor,l,b,l,b)) and(FindColor(x,y,RoadColor,m,b,m,b)) and(FindColor(x,y,RoadColor,r,b,r,b)) then
       begin
        if(f=1) then
         begin
          SendArrow(1);
          f:=f+1
          WriteLn('Now in file 2');
         end;
       end;
     until(false);
    end;



    begin
    ClearDebug;
    DodgeCars;
    end.

    Im quite newbish to SCAR yet, but I'm trying to improve by making scripts for non-rs games, hope you can help!

  2. #2
    Join Date
    Jul 2007
    Location
    St. Louis, Missouri, USA.
    Posts
    575
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Try using SCAR 3.12c instead of 3.13. 3.13 is known to give errors like that so your SCAR version could be the problem.
    -You can call me Mick-



  3. #3
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    It's because 'r' is a negative number in:
    and(FindColor(x,y,RoadColor,r,b,r,b)) then
    since you declare values for 'r' before 'm'
    r:=m*2-l
    m:=707
    than means when it does
    r:=m*2-l
    'm' is still at 0, giving you a negative number =]



    so just switch the 'r' and 'm' value declarations.
    m:=707
    r:=m*2-l
    and BAM. Fixed.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [Runtime Error] : Exception: buffer error
    By GasMan in forum OSR Help
    Replies: 11
    Last Post: 05-13-2007, 02:07 PM
  2. Runtime Error
    By CamHart in forum OSR Help
    Replies: 2
    Last Post: 11-23-2006, 05:21 AM
  3. Runtime error
    By sk8ter in forum OSR Help
    Replies: 3
    Last Post: 10-30-2006, 01:55 PM

Posting Permissions

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