Results 1 to 6 of 6

Thread: 'Begin' expected in script?

  1. #1
    Join Date
    Nov 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default 'Begin' expected in script?

    I just started learning SRL and began working a chicken killer script...anyways. I attempted to hit compile to see if I was missing anything after a couple of minutes. I and I got this error...

    Failed when compiling
    Line 3: [Error] (14684:1): 'BEGIN' expected in script

    here is my script thus far.
    SCAR Code:
    {.include srl/srl.scar}

    program ChickenMaster

    Const
         CocksComb=858751;
         Healthbar=65280;
         Feathers=12369093;
    var
       x,y: integer;

    Procedure FindChicken
    Begin
         repeat
               wait(1000)
               if FindObj(x, y,'hicken',CocksComb,10) then
               begin
                    exit;
               end;
         until false
    end;

    Begin
         SetUpSRL;
         Repeat
               FindChicken;
               Mouse(x, y, 0, 0, false);
         Until false
    end.

    I am new to scripting and have no idea what this is all about...it seems that I have all my Begin's in there...but please...enlighten me.

  2. #2
    Join Date
    Jun 2007
    Location
    Belgium
    Posts
    333
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The .include part has to come after the Program line, also, at the end of every program, procedure and function line there has to be a semi colon. I fixed it for ya.

    SCAR Code:
    program ChickenMaster;
    {.include srl/srl.scar}

    Const
      CocksComb=858751;
      Healthbar=65280;
      Feathers=12369093;
    var
      x,y: integer;

    Procedure FindChicken;
    Begin
      repeat
        wait(1000)
        if FindObj(x, y,'hicken',CocksComb,10) then
    //    begin   (if only 1 commandline after a if...then you can leave out the begin and end)
          exit;
    //    end;    (if only 1 commandline after a if...then you can leave out the begin and end)
      until false
    end;

    Begin
      SetUpSRL;
      Repeat
        FindChicken;
        Mouse(x, y, 0, 0, false);
      Until false
    end.

    EDIT: I forgot to correct the standards, a good tutorial about can be found at http://www.villavu.com/forum/showthread.php?t=3293

  3. #3
    Join Date
    Nov 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Psychor View Post
    The .include part has to come after the Program line, also, at the end of every program, procedure and function line there has to be a semi colon. I fixed it for ya.

    SCAR Code:
    program ChickenMaster;
    {.include srl/srl.scar}

    Const
         CocksComb=858751;
         Healthbar=65280;
         Feathers=12369093;
    var
       x,y: integer;

    Procedure FindChicken;
    Begin
         repeat
               wait(1000)
               if FindObj(x, y,'hicken',CocksComb,10) then
               begin
                    exit;
               end;
         until false
    end;

    Begin
         SetUpSRL;
         Repeat
               FindChicken;
               Mouse(x, y, 0, 0, false);
         Until false
    end.
    wow...thnx! I didn't realize it was as simple as that! Thanks alot!!!

  4. #4
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

    Default

    Dang, those standards are like woooooooooow..

    Also for standards its 2 spaces not like 6.

  5. #5
    Join Date
    Nov 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by BobboHobbo View Post
    Dang, those standards are like woooooooooow..

    Also for standards its 2 spaces not like 6.
    ???
    What do you mean by standards?
    BTW another question...how do I make it read the chickens health bar? I wanna detect if he's dead.

  6. #6
    Join Date
    Nov 2007
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    lolers wow..this is all weird

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. 'BEGIN' expected in script But there is one
    By MylesMadness in forum OSR Help
    Replies: 12
    Last Post: 06-27-2007, 02:09 PM
  2. Replies: 8
    Last Post: 04-09-2007, 12:21 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
  •