Results 1 to 6 of 6

Thread: Type Mismatch?

  1. #1
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default Type Mismatch?

    I am getting this error:
    Line 256: [Error] (16462:21): Type mismatch in script
    when I try to compile my script. I don't know what the mismatch could be...?
    SCAR Code:
    {from piece of main loop}  
    OpenGE;
      BuyItem;
      While not GetDaItem do //This is line 256
       WaitForItem;
    nothing is mistyped or anything like that... this next one is the GetDaItem procedure. maybe there's something wrong with that part?
    SCAR Code:
    procedure GetDaItem;
    Var
      x, y, gebarDTM : integer;
    begin
      if (DTMRotated(gebarDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
        begin
          wait(250+random(500));
          Mouse(x, y, 2, 2, true); //successful buy indicator
          wait (500+random(1000));
          Mouse(415, 300, 2, 2, false); //leftover money locator
    {Loop for retreiving item if money left over.}
          if ChooseOption('coins') then
          begin
            Mouse(415, 300, 2, 2, true);
            wait(500+random(250));
            if ((strtobool(ItemNoted))) then
              Mouse(470, 300, 2, 2, true) //item location
            Else
            if (Not (strtobool(ItemNoted))) then
            begin
              Mouse(470, 300, 2, 2, false); //item location
              Wait(200+random(200));
              ChooseOption('items');
              wait(400+random(250));
            End;
          end;
        end else
        Begin
    {Loop for retreiving item if no money is left over.}
        if ChooseOption(ItemNeeded) then
        begin
          if ((strtobool(ItemNoted))) then
            Mouse(415, 300, 2, 2, true) //item location
          Else
          if (Not (strtobool(ItemNoted))) then
          begin
            Mouse(415, 300, 2, 2, false); //item location
            Wait(200+random(200));
            ChooseOption('items');
            wait(400+random(250));
          End;
        end;
      end;
    end;
    im confused

  2. #2
    Join Date
    Mar 2007
    Posts
    1,700
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    GetDaItem must return a boolean data type if you wish to use it in a boolean expression.
    SCAR Code:
    function GetDaItem: Boolean;

  3. #3
    Join Date
    Jan 2009
    Posts
    103
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    That is because GetDaItem is a procedure. when you say
    "while not getdaitem do"

    It is the same thing as saying:
    "while getdaitem=false do "

    So GetdaItem Has to be a boolean function for it to work.

    EDIT: oops, sorry lordsaturn, didnt see ur post, we posted at practically the same time, but added to that, he cant just have that, he must also state the results too, right?

    Like if it does what he wants it to do then you put:
    Result:=true;
    if it doesnt do what you want, it will be:
    result:=false;

  4. #4
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    alright thanks, im an idiot problem solved!

    Edit:
    Line 199: [Error] (16405:20): Semicolon (';') expected in script
    SCAR Code:
    procedure GetDaItem: Boolean; //line199

  5. #5
    Join Date
    Jan 2009
    Posts
    103
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure GetDaItem: Boolean; //line199

    Should be:

    SCAR Code:
    function GetDaItem: Boolean; //line199

    You forgot to change it to a function.

  6. #6
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by superbatman View Post
    That is because GetDaItem is a procedure. when you say
    "while not getdaitem do"

    It is the same thing as saying:
    "while getdaitem=false do "

    So GetdaItem Has to be a boolean function for it to work.

    EDIT: oops, sorry lordsaturn, didnt see ur post, we posted at practically the same time, but added to that, he cant just have that, he must also state the results too, right?

    Like if it does what he wants it to do then you put:
    Result:=true;
    if it doesnt do what you want, it will be:
    result:=false;
    You don't need to declare result := false; unless result is already true, and it is defaulted at false when the function starts.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Type Mismatch...
    By Raskolnikov in forum OSR Help
    Replies: 3
    Last Post: 10-18-2008, 05:56 AM
  2. Type mismatch
    By batnas in forum OSR Help
    Replies: 3
    Last Post: 04-24-2008, 06:48 PM
  3. Type Mismatch..
    By Nava2 in forum OSR Help
    Replies: 1
    Last Post: 04-23-2008, 07:44 PM
  4. 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
  •