Results 1 to 11 of 11

Thread: [Error] (16940:4): Identifier expected

  1. #1
    Join Date
    Sep 2007
    Posts
    111
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default [Error] (16940:4): Identifier expected

    Code:
    program WalkerTexasRanger;
    {.include srl/srl/misc/smart.scar}
    {.include srl/srl.scar}
    
    {--- DECLARE PLAYERS ---}
    
    Procedure DeclarePlayers;
    begin
      Players[0].Name :=''; // Runescape Username
      Players[0].Pass :=''; // Runescape Password
      Players[0].Nick :=''; // A short nickname for this character
      Players[0].Strings[0] :=''; //Where do you want to go
      Players[0].Active:=True; // Is this player being used
    end;
    
    {--- SETUP SMART ---}
    
    Procedure SetupSmart;
    begin
      SmartSetupex(16, False, True, False);
      Wait(1000);
      SetTargetDC(SmartGetDC);
    end;
    
    {--- WALK TO FALADOR ---}
    
    Procedure WalkToFalador;
    begin;
     if not LoggedIn then exit;
    end;
    
    {--- WALK TO VARROCK ---}
    
    Procedure WalkToVarrock;
    begin;
     if not LoggedIn then exit;
    end;
    
    {--- WALK TO DRAYNOR ---}
    
    Procedure WalkToDraynor;
    begin;
     if not LoggedIn then exit;
    end;
    
    {---WALK TO CHICKENS---}
    
    Procedure WalkToChickens;
    begin;
     if not LoggedIn then exit;
    end;
    
    {--- WHERE TO WALK ---}
    
    Procedure Walk;
    begin
      case Players[CurrentPlayer].Strings[0] of
        'falador' : WalkToFalador;
        'varrock' : WalkToVarrock;
        'draynor' : WalkToDraynor;
        'chickens' : WalkToChickens;
    end;
    
    {--- MAIN LOOP ---}
    
    begin
      SetupSRL;
      SetupSMART;
      DeclarePlayers;
      LoginPlayer;
      Walk;
    end.
    Obviously it's not even close to being done, but I want to know why it won't compile.

    Thanks!

  2. #2
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Case statements need to be terminated with an end, much like begin statements. The problem is in your Walk procedure.
    :-)

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

    Default

    Noob, I told you on MSN that you needed an end .

  4. #4
    Join Date
    Dec 2006
    Location
    Program TEXAS home of AUTOERS
    Posts
    7,934
    Mentioned
    26 Post(s)
    Quoted
    237 Post(s)

    Default

    Quote Originally Posted by Method View Post
    Case statements need to be terminated with an end, much like begin statements. The problem is in your Walk procedure.
    yep he's right, that error is most likely a missing end;

  5. #5
    Join Date
    Sep 2007
    Posts
    111
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lmfao. There was already an end; so I thought you missed it.

    So, I need...

    Code:
    Procedure Walk;
    begin
      case Players[CurrentPlayer].Strings[0] of
        'falador' : WalkToFalador;
        'varrock' : WalkToVarrock;
        'draynor' : WalkToDraynor;
        'chickens' : WalkToChickens;
    end;
    end;

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

    Default

    No, I meant another end lol.

  7. #7
    Join Date
    Sep 2007
    Posts
    111
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Now it compiles, but then I immediately get...

    Code:
    [Runtime Error] : Out Of Range in line 9 in script C:\Users\Alex\Desktop\RoflWofl.scar

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

    Default

    SCAR Code:
    program WalkerTexasRanger;
    {.include srl/srl/misc/smart.scar}
    {.include srl/srl.scar}

    {--- DECLARE PLAYERS ---}

    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
     
      Players[0].Name :=''; // Runescape Username
      Players[0].Pass :=''; // Runescape Password
      Players[0].Nick :=''; // A short nickname for this character
      Players[0].Strings[0] :=''; //Where do you want to go
      Players[0].Active:=True; // Is this player being used
    end;

    {--- SETUP SMART ---}

    Procedure SetupSmart;
    begin
      SmartSetupex(16, False, True, False);
      Wait(1000);
      SetTargetDC(SmartGetDC);
    end;

    {--- WALK TO FALADOR ---}

    Procedure WalkToFalador;
    begin;
     if not LoggedIn then exit;
    end;

    {--- WALK TO VARROCK ---}

    Procedure WalkToVarrock;
    begin;
     if not LoggedIn then exit;
    end;

    {--- WALK TO DRAYNOR ---}

    Procedure WalkToDraynor;
    begin;
     if not LoggedIn then exit;
    end;

    {---WALK TO CHICKENS---}

    Procedure WalkToChickens;
    begin;
     if not LoggedIn then exit;
    end;

    {--- WHERE TO WALK ---}

    Procedure Walk;
    begin
      case Players[CurrentPlayer].Strings[0] of
        'falador' : WalkToFalador;
        'varrock' : WalkToVarrock;
        'draynor' : WalkToDraynor;
        'chickens' : WalkToChickens;
      end;
    end;

    {--- MAIN LOOP ---}

    begin
      SetupSRL;
      SetupSMART;
      DeclarePlayers;
      LoginPlayer;
      Walk;
    end.
    You need to do
    SCAR Code:
    HowManyPlayers := {Number of players};
    NumberOfPlayers(HowManyPlayers);
    CurrentPlayer := {Array index of the current player}

  9. #9
    Join Date
    Sep 2007
    Posts
    111
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  10. #10
    Join Date
    Sep 2007
    Posts
    111
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I hate to ask again already, but I am having another problem.

    Code:
    program WalkerTexasRanger;
    {.include srl/srl/misc/smart.scar}
    {.include srl/srl.scar}
    
    {--- DECLARE PLAYERS ---}
    
    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      Players[0].Name :=''; // Runescape Username
      Players[0].Pass :=''; // Runescape Password
      Players[0].Nick :='Vic'; // A short nickname for this character
      Players[0].Strings[0] :='Draynor'; //Where do you want to go
      Players[0].Active:=True; // Is this player being used
    end;
    
    {--- SETUP SMART ---}
    
    Procedure SetupSmart;
    begin
      SmartSetupex(16, False, True, False);
      Wait(1000);
      SetTargetDC(SmartGetDC);
    end;
    
    {--- WALK TO FALADOR ---}
    
    Procedure WalkToFalador;
    begin;
     if not LoggedIn then exit;
    end;
    
    {--- WALK TO VARROCK ---}
    
    Procedure WalkToVarrock;
    begin;
     if not LoggedIn then exit;
    end;
    
    {--- WALK TO DRAYNOR ---}
    
    Procedure WalkToDraynor;
    begin;
     if not LoggedIn then exit;
     RadialWalk(FindLumbyRoadColor, 30, 70, 65, -1, 0);
    end;
    
    {---WALK TO CHICKENS---}
    
    Procedure WalkToChickens;
    begin;
     if not LoggedIn then exit;
    end;
    
    {--- WHERE TO WALK ---}
    
    Procedure Walk;
    begin
      case Players[CurrentPlayer].Strings[0] of
        'falador' : WalkToFalador;
        'varrock' : WalkToVarrock;
        'draynor' : WalkToDraynor;
        'chickens' : WalkToChickens;
      end;
    end;
    
    {--- MAIN LOOP ---}
    
    begin
      SetupSRL;
      SetupSMART;
      DeclarePlayers;
      LoginPlayer;
      Walk;
    end.
    The script compiles and runs, but it doesn't seem to actually perform the WalkToWhatever function.

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

    Default

    SCAR Code:
    program WalkerTexasRanger;
    {.include srl/srl/misc/smart.scar}
    {.include srl/srl.scar}

    {--- DECLARE PLAYERS ---}

    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name :=''; // Runescape Username
      Players[0].Pass :=''; // Runescape Password
      Players[0].Nick :='Vic'; // A short nickname for this character
      Players[0].Strings[0] :='Draynor'; //Where do you want to go
      Players[0].Active:=True; // Is this player being used
    end;

    {--- SETUP SMART ---}

    Procedure SetupSmart;
    begin
      SmartSetupex(16, False, True, False);
      Wait(1000);
      SetTargetDC(SmartGetDC);
    end;

    {--- WALK TO FALADOR ---}

    Procedure WalkToFalador;
    begin;
     Writeln('Walk to Falador.');
     if not LoggedIn then exit;
    end;

    {--- WALK TO VARROCK ---}

    Procedure WalkToVarrock;
    begin;
     Writeln('Walk to Varrock.');
     if not LoggedIn then exit;
    end;

    {--- WALK TO DRAYNOR ---}

    Procedure WalkToDraynor;
    begin;
     Writeln('Walk to Draynor Village.');
     if not LoggedIn then exit;
     RadialWalk(FindLumbyRoadColor, 30, 70, 65, -1, 0);
    end;

    {---WALK TO CHICKENS---}

    Procedure WalkToChickens;
    begin;
     Writeln('Walk to chickens.');
     if not LoggedIn then exit;
    end;

    {--- WHERE TO WALK ---}

    Procedure Walk;
    begin
      case lowercase(Players[CurrentPlayer].Strings[0]) of
        'falador' : WalkToFalador;
        'varrock' : WalkToVarrock;
        'draynor' : WalkToDraynor;
        'chickens' : WalkToChickens;
      end;
    end;

    {--- MAIN LOOP ---}

    begin
      SetupSRL;
      SetupSMART;
      DeclarePlayers;
      LoginPlayer;
      Walk;
    end.

    The problem was you had Strings[0] := 'Draynor' and in the case you have just draynor. So since it is case sensitive it would not be called. However, I added a lowercase(Players[CurrentPlayer].Strings[0]) in the case so that it does not matter if it is in CAPITALS or not.

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
  •