Results 1 to 9 of 9

Thread: Type Mismatch

  1. #1
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Type Mismatch

    i am trying to do the following.

    i have a setup procedure that sets what trees to cut using record.
    in there i have a identifier for uptext thats an array, i have set the values for it
    SCAR Code:
    'tree': begin
                  with TreeSetup do  
                  begin
                    UpText := ['hop down Tree', 'own Tree']
                    Tree := 'Tree';  
                  end;
                end;

    however when i try

    SCAR Code:
    if not IsUpTextMultiCustom(UpText) then

    it comes up with Type Mismatch

  2. #2
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Edit: woops.
    SCAR Code:
    if not(IsUpTextMultiCustom(UpText)) then

    Try that.

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

    Default

    IsUpTextMultiCustom accepts data type of TStringArray, You need square brackets..

    Hence, change this:

    SCAR Code:
    if not IsUpTextMultiCustom(UpText) then

    To:

    SCAR Code:
    if not IsUpTextMultiCustom([UpText]) then

    That should fix your problem

  4. #4
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NaumanAkhlaQ View Post
    IsUpTextMultiCustom accepts data type of TStringArray, You need square brackets..

    Hence, change this:

    SCAR Code:
    if not IsUpTextMultiCustom(UpText) then

    To:

    SCAR Code:
    if not IsUpTextMultiCustom([UpText]) then

    That should fix your problem
    oh i thought as it was allready a array i didnt need to add them.

    now i get Unknown identifier 'UpText' error.

    edit: Should i give it a temp value, then call my setup where the record values are set?
    Last edited by Bobzilla69; 09-12-2009 at 10:53 PM.

  5. #5
    Join Date
    Oct 2006
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You don't need the square brackets in UpText Check. Your variable UpText is already a TStringArray so you would use
    Code:
    IsUpTextMultiCustom(UpText)
    Can we see more of what you have? You might have declared the variable as the wrong type, or it may not be global.

  6. #6
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    record values
    SCAR Code:
    type
      Tree = record
        Col, Tol, Cut : Integer;
        HMod, SMod : Extended;
        UpText : TStringArray;
        Tree : String;
    end;
    where i declare values
    SCAR Code:
    Procedure SetupTree;
    begin
      case Lowercase(Players[CurrentPlayer].Strings[0]) of
        'tree': begin
                  with TreeSetup do  //loads recoard to store tree specific infomation for script
                  begin
                    Col := 0;      //color of what we cutting
                    Tol := 0;      // tolerance for finding tree
                    Cut := 8000;       //how long to wait after cutting started to switch trees
                    HMod := 0;     //used for colortolerancespeed, changes how accurate it is
                    SMod := 0;
                    UpText := ['hop down Tree', 'own Tree']  //uptext of tree for cutting
                    Tree := 'Tree';      //tree name
                  end;
                end;
    what i am trying to call
    SCAR Code:
    if not (IsUpTextMultiCustom(test)) or (Invfull) or not (TimeFromMark(AntiBan) > 8000 + Random(5000)) then
        Exit
      else

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

    Default

    Quote Originally Posted by r!ch!e View Post
    You don't need the square brackets in UpText Check. Your variable UpText is already a TStringArray so you would use
    Code:
    IsUpTextMultiCustom(UpText)
    Can we see more of what you have? You might have declared the variable as the wrong type, or it may not be global.
    Agh, my bad. I really need to sleep :/


    E: Try posting the whole script. Maybe it could be something in another procedure or function which intervenes..
    Last edited by Naum; 09-12-2009 at 11:23 PM. Reason: (sp :()

  8. #8
    Join Date
    Oct 2006
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    IsUpTextMultiCustom(test)
    Are you calling test, or UpText?

    It could also be this
    Code:
    TimeFromMark(AntiBan)
    Is Antiban the right Type?

    Also, I recommend you keep your UpText phrases to single words, rather than phrases. It's more efficient and more likely to find it that way.

  9. #9
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by r!ch!e View Post
    Code:
    IsUpTextMultiCustom(test)
    Are you calling test, or UpText?

    It could also be this
    Code:
    TimeFromMark(AntiBan)
    Is Antiban the right Type?

    Also, I recommend you keep your UpText phrases to single words, rather than phrases. It's more efficient and more likely to find it that way.
    i noticed what i did wrong. because i am using a record i need to call it correctly
    SCAR Code:
    IsUpTextMultiCustom(TreeSetup.UpText)
    is what i needed to do. i completely forgot about that.

    thanks for the help anyways

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
  •