Results 1 to 7 of 7

Thread: Keep getting this error

  1. #1
    Join Date
    Dec 2009
    Location
    R_GetPlayerLoc;
    Posts
    2,235
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default Keep getting this error

    Code:
    Program New;
    {$DEFINE SMART}
    {$i srl\srl.scar}
    {$i reflection\reflection.simba}
    
    Const
    {---SMART Setup Constants---}
      WORLD = 152;
      MEMBERS = false;
      SIGNED = true;
    {---------------------------}
    
    Procedure DeclarePlayers;
    Begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      With Players[0] Do
      Begin
        Name := ' ';
        Pass := ' ';
        Nick := ' ';
        Active := True;
        Pin := ' ';
      End;
    End;
    
    Function InArea: boolean;
    
    Var
      PlayerPosition : Tpoint;
    
    Begin
      PlayerPosition := GetMyPos;
      If (PointInBox(PlayerPosition , IntToBox(1000,1000, 3000,3000))) Then
        Result := False;
      Else
        Begin
          Writeln('You are in the Area!');
          Result := True;
        End;
    End;

    Every time I add an else or end else to an if ... then statement I keep getting the error:
    Code:
    Identifier expected at line *
    at the appropriate line

    (If (PointInBox(PlayerPosition , IntToBox(1000,1000, 3000,3000))) Then
    Result := False;
    Else).

    I get the error at the else.

    It happens to all my scripts. I have a feeling I'm doing the if ... then thing wrong. Please help

  2. #2
    Join Date
    Dec 2009
    Location
    R_GetPlayerLoc;
    Posts
    2,235
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    Nvm, I found out you cant capitalize if ... then.

    I believe this is the issue if not then let me know.

    edit: nope it worked but now all my other if ... thens are having the same identifier expected in the line with the
    Code:
     else

  3. #3
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    don't put a semicolon after the line before the "else"

  4. #4
    Join Date
    Dec 2009
    Location
    R_GetPlayerLoc;
    Posts
    2,235
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    That fixed that section, but now im having the same error here:

    Code:
    Begin
      PlayerPosition := GetMyPos;
    
      Begin
        if (PointInBox(PlayerPosition , IntToBox(3000,3000, 3300,3300))) Then
          InLumbyCastle := True
        else
          InLumbyCastle := False;
      End;
    
      if (InLumbyCastle = False) then
        WriteLn('InLumbyCastle is ' + BoolToStr(InLumbyCastle) + '.');
        WriteLn('You are not in the Lumbridge Castle Area.')
      else
    There error is in the last line. I bolded it.

    Code:
    else // line 50
    [Error] (51:3): Identifier expected at line 50.

    Thanks for you help

  5. #5
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    1. you need to put your two write lines inside a begin end an end. the last line will be "End else". After the else, you need to either have another command or a series of commands in a begin/end.

    Simba Code:
    if This then
      begin
        Writeln('this');
        Writeln('that');
      end else
      begin
         Writeln('those');
         Writeln('these');
      end;

  6. #6
    Join Date
    Dec 2010
    Posts
    808
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Simba Code:
    if (InLumbyCastle = False) then
        begin
            WriteLn('InLumbyCastle is ' + BoolToStr(InLumbyCastle) + '.');
            WriteLn('You are not in the Lumbridge Castle Area.');
        end
      else

  7. #7
    Join Date
    Dec 2009
    Location
    R_GetPlayerLoc;
    Posts
    2,235
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    OK. Thanks that solved my problems ... for now. Sorry im new a just started getting the hang of this thing.

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
  •