Results 1 to 6 of 6

Thread: Help with Error

  1. #1
    Join Date
    Feb 2007
    Location
    @ SRL
    Posts
    402
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Help with Error

    Hey, This is my first script and I got an error.

    Just wondering if one of you guys could tell me what's wrong with it?

    The error I get is:
    SCAR Code:
    Failed when compiling
    Line 56: [Error] (15084:1): Identifier expected in script


    The line is:
    SCAR Code:
    Begin
        If IsFKeyDown(5) Then
          Begin
          TypeSend(F5Key);
          WriteLN('Said, '+F5Key+'.');
          End;
        End;
    End;
    It's the last End; line 56.
    Cheers.

    SCAR Code:
    Program TurboTalker;

    {.include SRL/SRL.scar}


    Const
        F1Key = 'Line1';       // What to say when [F1] is pressed.
        F2Key = 'Line2';       // What to say when [F2] is pressed.
        F3Key = 'Line3';       // What to say when [F3] is pressed.
        F4Key = 'Line4';       // What to say when [F4] is pressed.
        F5Key = 'Line5';       // What to say when [F5] is pressed.
       

       
    Procedure Talk;

    Begin
     Repeat
      If IsFKeyDown(1) Then
        Begin
        TypeSend(F1Key);
        WriteLN('Said, '+F1Key+'.');
        End;

          Begin
          If IsFKeyDown(2) Then
            Begin
            TypeSend(F2Key);
            WriteLN('Said, '+F2Key+'.');
            End;
          End;

            Begin
            If IsFKeyDown(3) Then
              Begin
              TypeSend(F3Key);
              WriteLN('Said, '+F3Key+'.');
              End;
            End;

          Begin
          If IsFKeyDown(4) Then
            Begin
            TypeSend(F4Key);
            WriteLN('Said, '+F4Key+'.');
            End;
          End;

        Begin
        If IsFKeyDown(5) Then
          Begin
          TypeSend(F5Key);
          WriteLN('Said, '+F5Key+'.');
          End;
        End;
    End;


    Procedure CheckLoggedIn;

    Begin
      If Not LoggedIn Then
      Begin
        WriteLN('You must be logged in to run this script, Login and try again.');
        TerminateScript;
      End Else
       WriteLN('Starting TurboTalker.');
       Wait(5000 + random(3000));
       Talk;
    End;



    Begin
    SetupSRL;
    ClearDebug;
    CheckLoggedIn;
    End.

  2. #2
    Join Date
    Nov 2007
    Location
    Nowhereville
    Posts
    1,155
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    You need this

    SCAR Code:
    Procedure CheckLoggedIn;
     
    Begin
      If Not LoggedIn Then
      Begin
        WriteLN('You must be logged in to run this script, Login and try again.');
        TerminateScript;
      End Else
      Begin
       WriteLN('Starting TurboTalker.');
       Wait(5000 + random(3000));
       Talk;
      End;
    End;
    Formerly known as Cut em2 it

  3. #3
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    EDIT: Removed - Update in 5 minutes.
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  4. #4
    Join Date
    Jul 2007
    Location
    St. Louis, Missouri, USA.
    Posts
    575
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    begin
      if IsFKeyDown(5) then
      begin
        TypeSend(F5Key);
        WriteLN('Said, '+F5Key+'.');
      end;
    end;

    Didn't need that end in there.
    -You can call me Mick-



  5. #5
    Join Date
    Feb 2007
    Location
    @ SRL
    Posts
    402
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks guys for your help but it still hasn't fixed the problem.

    mickaliscious:
    Didn't need that end in there.
    Yeah that end was for the 1st begin at the start of the script.

    So I don't know what's wrong.. Please have another look through for me please.

    Thanks

  6. #6
    Join Date
    Jul 2007
    Location
    St. Louis, Missouri, USA.
    Posts
    575
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thats your problem then, you can't set up procedures during the mainloop. Heres an example of what a script format should be:

    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    procedure CheckLoggedIn;
    begin
      if not LoggedIn then
      Begin
        WriteLN('You must be logged in to run this script, Login and try again.');
        TerminateScript;
      end else
      begin
        WriteLN('Starting TurboTalker.');
        Wait(5000 + random(3000));
        Talk;
      end;
    end;

    begin //mainloop starts after declaring all procedures/functions/variables
      SetupSRL;
      ActivateClient;
      CheckLoggedIn;
    end. //last end has . instead of ;
    -You can call me Mick-



Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Line 135: [Error] (14845:1): Syntax error in script
    By AbsTrACt'^.| in forum OSR Help
    Replies: 16
    Last Post: 05-23-2008, 01:14 PM
  2. Replies: 5
    Last Post: 02-26-2008, 04:14 PM
  3. Smart error and Some kind of Math.scar error
    By FagetHax0r in forum OSR Help
    Replies: 6
    Last Post: 02-24-2008, 10:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •