Results 1 to 8 of 8

Thread: Type Mismatch Error in findcolorstolerance

  1. #1
    Join Date
    Sep 2006
    Location
    New York
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Type Mismatch Error in findcolorstolerance

    Code:
    program WindowsMineSweeperBeater;
    
    var
    x, y, n, number, digit:integer;
    
    
    function FindColorTolerance(var x, y: Integer; color, xs, ys, xe, ye, tol: Integer): Boolean;
    begin
      Result := findcolortolerance(x, y, color, xs, ys, xe, ye, tol);
    end;
    
    function FindColorsTolerance(var points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer):Boolean;
    var
      tpa:integer;
    begin
      result:=findcolorstolerance(tpa, Color, xs, ys, xe, ye, Tolerance : integer):Boolean;
    end;
    begin
    
        FindColorsTolerance(tpa, 16236680, 0, 0, 346, 348, 10);
    
    end.
    The error comes up as,
    line 16: [Error] (16:67): comma (',') expected in script

    I don't understand why I have to put a comma in the script...

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

    Default

    you don't need to add those functions... they are already included in scar.

  3. #3
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    You need to put:

    SCAR Code:
    Var TPA : Array Of TPoint;
    at the top of your script, where your variables are declared.

    EDIT: Make it global not local:


    SCAR Code:
    program WindowsMineSweeperBeater;

    var
    x, y, n, number, digit:integer;


    function FindColorTolerance(var x, y: Integer; color, xs, ys, xe, ye, tol: Integer): Boolean;
    begin
      Result := findcolortolerance(x, y, color, xs, ys, xe, ye, tol);
    end;

    function FindColorsTolerance(var points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer):Boolean;
    var
      tpa:integer;
    begin
      result:=findcolorstolerance(tpa, Color, xs, ys, xe, ye, Tolerance : integer);
    end;
    begin

        FindColorsTolerance(tpa, 16236680, 0, 0, 346, 348, 10);

    end.

    should really be:

    SCAR Code:
    program WindowsMineSweeperBeater;

    var
    x, y, n, number, digit:integer;
    tpa:TPointArray;

    function FindColorTolerance2(var x, y: Integer; color, xs, ys, xe, ye, tol: Integer): Boolean;
    begin
      Result := findcolortolerance(x, y, color, xs, ys, xe, ye, tol);
    end;

    function FindColorsTolerance2(var points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer):Boolean;
    begin
      result:=findcolorstolerance(points, Color, xs, ys, xe, ye, Tolerance : integer);
    end;

    begin
        FindColorsTolerance2(tpa, 16236680, 0, 0, 346, 348, 10);
    end.

    I sorted out a lot of other things, for example - TPA is an array of tpoint it is not an integer.

    Furthermore, please enlighten us to why you are doing this? These are already in SCAR there is no need to do that.
    Last edited by Naum; 08-12-2009 at 03:03 AM.

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

    Default

    Quote Originally Posted by NaumanAkhlaQ View Post
    should really be:

    SCAR Code:
    program WindowsMineSweeperBeater;

    var
    x, y, n, number, digit:integer;
    tpa:TPointArray;

    function FindColorTolerance2(var x, y: Integer; color, xs, ys, xe, ye, tol: Integer): Boolean;
    begin
      Result := findcolortolerance(x, y, color, xs, ys, xe, ye, tol);
    end;

    function FindColorsTolerance2(var points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer):Boolean;
    begin
      result:=findcolorstolerance(points, Color, xs, ys, xe, ye, Tolerance : integer);
    end;

    begin
        FindColorsTolerance2(tpa, 16236680, 0, 0, 346, 348, 10);
    end.

    I sorted out a lot of other things, for example - TPA is an array of tpoint it is not an integer.

    Furthermore, please enlighten us to why you are doing this? These are already in SCAR there is no need to do that.
    WRONG!
    SCAR Code:
    program WindowsMineSweeperBeater;

    var
    x, y, n, number, digit:integer;
    tpa:TPointArray;

    function FindColorTolerance2(var x, y: Integer; color, xs, ys, xe, ye, tol: Integer): Boolean;
    begin
      Result := findcolortolerance(x, y, color, xs, ys, xe, ye, tol);
    end;

    function FindColorsTolerance2(var points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer):Boolean;
    begin
      result:=findcolorstolerance(points, Color, xs, ys, xe, ye, Tolerance);
    end;

    begin
        FindColorsTolerance2(tpa, 16236680, 0, 0, 346, 348, 10);
    end.


    ~shut

  5. #5
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Shuttleu View Post
    WRONG!
    SCAR Code:
    program WindowsMineSweeperBeater;

    var
    x, y, n, number, digit:integer;
    tpa:TPointArray;

    function FindColorTolerance2(var x, y: Integer; color, xs, ys, xe, ye, tol: Integer): Boolean;
    begin
      Result := findcolortolerance(x, y, color, xs, ys, xe, ye, tol);
    end;

    function FindColorsTolerance2(var points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer):Boolean;
    begin
      result:=findcolorstolerance(points, Color, xs, ys, xe, ye, Tolerance);
    end;

    begin
        FindColorsTolerance2(tpa, 16236680, 0, 0, 346, 348, 10);
    end.


    ~shut
    No! WRONG!

    SCAR Code:
    Var TPA : Array Of TPoint;

    begin
        FindColorsTolerance(tpa, 16236680, 0, 0, 346, 348, 10);
    end.


  6. #6
    Join Date
    Sep 2006
    Location
    New York
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NaumanAkhlaQ View Post
    You need to put:

    SCAR Code:
    Var TPA : Array Of TPoint;
    at the top of your script, where your variables are declared.

    EDIT: Make it global not local:


    SCAR Code:
    program WindowsMineSweeperBeater;

    var
    x, y, n, number, digit:integer;


    function FindColorTolerance(var x, y: Integer; color, xs, ys, xe, ye, tol: Integer): Boolean;
    begin
      Result := findcolortolerance(x, y, color, xs, ys, xe, ye, tol);
    end;

    function FindColorsTolerance(var points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer):Boolean;
    var
      tpa:integer;
    begin
      result:=findcolorstolerance(tpa, Color, xs, ys, xe, ye, Tolerance : integer);
    end;
    begin

        FindColorsTolerance(tpa, 16236680, 0, 0, 346, 348, 10);

    end.

    should really be:

    SCAR Code:
    program WindowsMineSweeperBeater;

    var
    x, y, n, number, digit:integer;
    tpa:TPointArray;

    function FindColorTolerance2(var x, y: Integer; color, xs, ys, xe, ye, tol: Integer): Boolean;
    begin
      Result := findcolortolerance(x, y, color, xs, ys, xe, ye, tol);
    end;

    function FindColorsTolerance2(var points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer):Boolean;
    begin
      result:=findcolorstolerance(points, Color, xs, ys, xe, ye, Tolerance : integer);
    end;

    begin
        FindColorsTolerance2(tpa, 16236680, 0, 0, 346, 348, 10);
    end.

    I sorted out a lot of other things, for example - TPA is an array of tpoint it is not an integer.

    Furthermore, please enlighten us to why you are doing this? These are already in SCAR there is no need to do that.
    Nauman,
    I used to play runescape but after getting banned a few times i stopped playing. Now I want to learn programming languages and to start I decided to first practice with Scar. BUT, I don't have an internet connection at home anymore so I go to a local cafe. So yea, I can't script for runescape too long so i decided to practice with minesweeper. I'll get DSL at home soon though.

    BTW thanks

  7. #7
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Umm, you don't need to rename the functions, just cut out the middleman, use it directly, instead of putting it in another function?

    I assume since you call FindColorsTolerance that you have WizzyPlugin.dll. Just call it directly. What I posted before, above your post, should work.

  8. #8
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    actually nuam, why would you say

    SCAR Code:
    TPA : array of tpoint;

    when just saying
    SCAR Code:
    TPA : TPointArray
    is much easier, and already made

    although he is right, you dont need to make different functions for each, if they are pre- made, unless you use different things
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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
  •