Results 1 to 7 of 7

Thread: Type Mismatch Problem with FindMSColorTol

  1. #1
    Join Date
    Dec 2006
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Type Mismatch Problem with FindMSColorTol

    I was working on a powercutter today and I can't seem to fix a Type Mismatch error. Don't go calling me a noob because I know what a Type Mismatch is although I don't know what I'm missing. If you think that there is a better function than FindMSColorTol then by all means tell me. Any help is appreciated, weather it be with this particular error, any error that you see coming up, or the script in general. Thanks in advance!

    Here is the script--
    SCAR Code:
    program SSTreeEaterV2;
    {.include SRL\SRL.scar}
    {.include SRL\SRL\skill\WoodCutting.scar}


    var Loads, cut, trips : integer; //Loads = Current Amount. Trips = Amount Wanted
        TreeType : string; //Reg, Oak, Willow....
        TreeFound : boolean; //In TreeFinding procedure
        TreeColor, FindColorX, FindColorY : TStringArray;

    procedure Setup;
    begin
    SetupSRL;
    SetArrayLength(TreeColor,3);
    SetArrayLength(FindColorX,10);
    SetArrayLength(FindColorY,10);
    if (LoggedIn = false) then
    begin
       ClearReport;
       writeLn('You are not logged in. Please login before running this script.');
       Exit;
    end
    Mouse(297,490,5,5,false); //Turns Clan Chat On. Just Temporary. Its my peace of mind.
    end;
    //-----------------------------------------------//

    procedure FindTreeColor;
    var i,q:integer;
    begin
    TreeFound := false;
    for i := 0 to 2 do
    begin
    if TreeFound = true then break;
    If FindMSColorTol(x,y,treecolor[i],3) then //<----- There is the error!!!
       MMouse(x,y,5,5);
            If GetUpText(TreeType) then
            begin
               ChopTree;
               TreeFound:= true;
            end
    end
    If TreeFound = false then
    begin
    i:=0;
    for i = 0 to 9
        FindColorX[i]:= Random(517);
        FindColorY[i]:= Random(377);
        MMouse(FindColorX,FindColorY,0,0);
        if isUpText(TreeType) then
           begin
           TreeColor[0]:=GetColor(x,y);
           writeLn('Using ' + inttostr(TreeColor[0] + ' as Tree Color 1 / 3.');
           MMouse(FindColorX,FindColorY,3,3);
           if isUpText(TreeType) then
              begin
              TreeColor[1]:=GetColor(x,y);
              writeLn('Using ' + inttostr(TreeColor[1] + ' as Tree Color 2 / 3.');
              end
           MMouse(FindColorX,FindColorY,5,5);
           if isUpText(TreeType) then
              begin
              TreeColor[2]:=GetColor(x,y);
              writeLn('Using ' + inttostr(TreeColor[2] + ' as Tree Color 3 / 3.');
              end
           ChopTree;
           break;
    end
    end;
    //-----------------------------------------------//

    procedure ChopTree;
    begin
    //Haven't done it yet!!!
    end;
    //-----------------------------------------------//

    procedure ProgReport;
    begin
      ClearReport;
      writeLn('     ________     ________');
      writeLn('    /        /  /        /');
      writeLn('   /   _____/  /   _____/');
      writeLn('   \_____   \  \_____   \');
      writeLn('   /        /  /        /');
      writeLn('  /________/  /________/    Tree Eater');
      writeLn('  Total Loads : ' + inttostr(Loads) + '     Total Logs Cut : ' + inttostr(cut));
    end;
    //-----------------------------------------------//

    begin
    Setup;
    repeat
    FindTreeColor;
    until (Loads = Trips)
    end.

    And the error, marked in the script on line 32--
    SCAR Code:
    Line 33: [Error] (14847:39): Type mismatch in script C:\Program Files\SCAR 3.11\Scripts\SSTreeEaterV2.scar

  2. #2
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    FindMSColorTol(x,y,treecolor[i],3)

    TreeColor[i] isn't declared so it doesn't know what to search for.
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  3. #3
    Join Date
    Dec 2006
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh.... wow... I'm feeling really dumb.

    Thanks a ton Santa!

  4. #4
    Join Date
    Jun 2007
    Location
    NSW, Australia.
    Posts
    541
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice script btw.
    Quote Originally Posted by RAM View Post
    I sam sofa king wee todd did ! ~RAM
    My SRL Army Blog.


  5. #5
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, nice script.

    And just a little hint, you dont need to do "if TreeFound = true then". You can just type in "if {not} treefound then". Its much simpler, and it will save you a couple possible errors.

  6. #6
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    Yes... you don't have to include Variable = True, just do "If Variable".

    Well... Nice sript =)



    BTW - what is FindMSColorTol do differently?
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  7. #7
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    TreeColor is a Array Of String, so how can you put that on a Integer place?



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Type Mismatch Help
    By Minkino in forum OSR Help
    Replies: 1
    Last Post: 03-01-2009, 02:54 AM
  2. type mismatch
    By Maxcore in forum OSR Help
    Replies: 12
    Last Post: 11-10-2007, 12:54 AM
  3. Type mismatch Help
    By Ashur2Good in forum OSR Help
    Replies: 2
    Last Post: 05-23-2007, 03:47 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
  •