Results 1 to 13 of 13

Thread: Expected Semicolon

  1. #1
    Join Date
    Feb 2010
    Location
    England
    Posts
    56
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Expected Semicolon

    hey guys, I've been reading some tutorials during today and yesterday and have encountered a problem.

    so using the documentation and some excellent tutorials, I tried making something out of what I had learned.

    SCAR Code:
    program RadialWalk;
    {.include SRL/SRL.scar}

    var
      road_color: TIntegerArray; // is this two dimensional array of intgers? Array of Array of Integer?
      i, j: Integer;

    procedure init_variables;
    begin
      SetupSRL;

      road_color := [
        [8692140, 8823978, 8692135, 9021614, 8889771]
      ];
    end;

    begin
      init_variables;

      for i := 0 to High(road_color) do
      begin
        for j := 0 to High(road_color[i]) do
        begin
          if RadialRoadWalk(road_color[i][j], 60, 120, 72, 2, 2) then // expected Semicolon here
          begin
            WriteLn('Found: ' + IntToStr(road_color[i][j]));
            break;
          end else
          begin
            WriteLn('Could not find: ' + IntToStr(road_color[i][j]));
          end;
          FFlag(0);
        end;
      end;
    end.

    I get an error saying that there should be a semicolon on line 24, (oh and by the way, the reason why I use a two dimensional array for the colors is that I learned that they are dynamic, they keep changing, thus if I used one, it wouldn't work on the second test or something? oh and I tried FindLumbyRoadColor, but that didn't work, (I'm at lumby castle, outside))

    oh and I will apologize in advance for my code, it is probably sloppy and needs standardization.

    void_hatred

  2. #2
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    TIntegerArray = array of Integer
    T2DIntegerArray = array of TIntegerArray / array of array of Integer

    so changing road_color: TIntegerArray; to road_color: T2DIntegerArray; will fix the problem

  3. #3
    Join Date
    Feb 2010
    Location
    England
    Posts
    56
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks for the reply, but I get another error.

    this is apparently a type mismatch (though it's a 2D array, no?)

    SCAR Code:
    road_color := [
        [8692140, 8823978, 8692135, 9021614, 8889771]
      ];

    thanks in advance.

    void_hatred
    Last edited by void_hatred; 02-13-2010 at 11:38 AM.

  4. #4
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You are defining it as a T2DIntegerArray (Two arrays). You only need to wrap the colours in one [].
    lol

  5. #5
    Join Date
    Feb 2010
    Location
    England
    Posts
    56
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I've defined it as a two dimensional array for a specific purpose, eventually I will do..:

    road_color := [
    [.....],
    [.....]
    ];

    thus I do need the two pairs (outer and enclosing each individual color) of brackets, no?

    void_hatred

  6. #6
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by Quickmarch View Post
    You are defining it as a T2DIntegerArray (Two arrays). You only need to wrap the colours in one [].
    If you take a look at the rest of the script then you see that he want's T2DIntegerArray, but he defined it as TIntegerArray

  7. #7
    Join Date
    Feb 2010
    Location
    England
    Posts
    56
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Zyt3x, as I mentioned in a previous post I got another error (after making TIntegerArray into T2DIntegerArray) a type mismatch, any idea?

    thanks for the help.

    void_hatred

  8. #8
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Paste the whole code, it compiles just fine for me.
    There used to be something meaningful here.

  9. #9
    Join Date
    Feb 2010
    Location
    England
    Posts
    56
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program RadialWalk;
    {.include SRL/SRL.scar}

    var
      road_color: T2DIntegerArray;
      i, j: Integer;

    procedure init_variables;
    begin
      SetupSRL;

      road_color := [
        [8692140, 8823978, 8692135, 9021614, 8889771]
      ];
    end;

    begin
      init_variables;

      for i := 0 to High(road_color) do
      begin
        for j := 0 to High(road_color[i]) do
        begin
          if RadialRoadWalk(road_color[i][j], 60, 120, 72, 2, 2) then
          begin
            WriteLn('Found: ' + IntToStr(road_color[i][j]));
            break;
          end else
          begin
            WriteLn('Could not find: ' + IntToStr(road_color[i][j]));
          end;
          FFlag(0);
        end;
      end;
    end.

    and yes, it compiles correctly, but try running it (then it gives mismatch)

    void_hatred
    Last edited by void_hatred; 02-13-2010 at 12:30 PM.

  10. #10
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    SCAR Code:
    program RadialWalk;
    {.include SRL/SRL.scar}

    var
      road_color: T2DIntegerArray; // is this two dimensional array of intgers? Array of Array of Integer?
      i, j: Integer;

    procedure init_variables;
    begin
      SetupSRL;

      SetArrayLength(road_color, 1);
      road_color[0] := [8692140, 8823978, 8692135, 9021614, 8889771];
    end;

    begin
      init_variables;

      for i := 0 to High(road_color) do
      begin
        for j := 0 to High(road_color[i]) do
        begin
          if RadialRoadWalk(road_color[i][j], 60, 120, 72, 2, 2) then // expected Semicolon here
          begin
            WriteLn('Found: ' + IntToStr(road_color[i][j]));
            break;
          end else
          begin
            WriteLn('Could not find: ' + IntToStr(road_color[i][j]));
          end;
          FFlag(0);
        end;
      end;
    end.
    You can't do variable := [[]]; on two dimensional arrays

    EDIT: And maybe you should do RadialRoadWalkTolerance()? That increases the chance of finding the correct color
    Last edited by Zyt3x; 02-13-2010 at 12:30 PM.

  11. #11
    Join Date
    Feb 2010
    Location
    England
    Posts
    56
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    oh, sorry, and thank you!
    coming from C-style languages I probably have a few bad habbits (well not bad, rather incorrect)

    thanks a bunch!

    void_hatred

  12. #12
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by void_hatred View Post
    oh, sorry, and thank you!
    coming from C-style languages I probably have a few bad habbits (well not bad, rather incorrect)

    thanks a bunch!

    void_hatred
    No problem
    And you've learned fast! Good job (not many people with <10 posts know that much)

  13. #13
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Also try using ACA (AutoColor Aid?) Search for some tutorials, that way you can get pretty good autocolor function for roads and then use RadialWalkTolerance with tolerance as 2-5 or similar.
    There used to be something meaningful here.

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
  •