Results 1 to 6 of 6

Thread: Then Expected in script

  1. #1
    Join Date
    May 2008
    Posts
    93
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Then Expected in script

    I got this error in the Walking procedure.

    SCAR Code:
    program AutoChop;

    {.include srl/srl.scar}

    //var integer : string;

    procedure DeclarePlayers;
    begin

         HowManyPlayers := 1;
         NumberOfPlayers(HowManyPlayers);
         CurrentPlayer:= 0

         Players[0].Name   := 'Ida Frigate';
         Players[0].Pass   := 'starbridge';
         Players[0].Nick   := 'frig';
         Players[0].strings[0] := 'Oak';    //Tree type to chop. Valid Entries: Oak, Tree, Willow.   //First letter must be uppercase.
         Players[0].strings[1] := 'Bank';  // Location. Valid Entries: EastBank, Willows, Bank.
         Players[0].Active := True;

    end;

    Procedure Walking;
    begin
     If Players[CurrentPlayer].strings[0]:= 'Oak' then
      begin
      If Players[CurrentPlayer].strings[1]:= 'Oak' then exit
     end else
      begin
       //OakWalk;
      end;
     If Players[CurrentPlayer].strings[0]:= 'Tree' then
      begin
       If Players[CurrentPlayer].strings[1]:= 'Tree' then exit
      end else
       begin
        //TreeWalk;
       end;
     If Players[CurrentPlayer].strings[0]:= 'Willow' then
      begin
       If Players[CurrentPlayer].strings[1]:= 'Willow' then exit
      end else
       begin
       // WillowWalk;
       end;
    end;

    begin
    setupsrl;
    activateclient;
    declareplayers;
    Walking;
    end.

  2. #2
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    SCAR Code:
    Procedure Walking;
    begin
      If Players[CurrentPlayer].strings[0]:= 'Oak' then
        If Players[CurrentPlayer].strings[1]:= 'Oak' then
          exit
        else
          wait(1); //OakWalk;
         
      If Players[CurrentPlayer].strings[0]:= 'Tree' then
        If Players[CurrentPlayer].strings[1]:= 'Tree' then
          exit
        else
          wait(1); //TreeWalk;

      If Players[CurrentPlayer].strings[0]:= 'Willow' then
        If Players[CurrentPlayer].strings[1]:= 'Willow' then
          exit
        else
          wait(1); // illowWalk;
    end;

    try that now

    and please read a tut about standards. it would've avoided that error and made it much easier to read

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  3. #3
    Join Date
    May 2008
    Posts
    93
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It still doesn't work, and I will be sure to do that later!

  4. #4
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    try this
    SCAR Code:
    Procedure Walking;
    begin
     If (Players[CurrentPlayer].strings[0]:= 'Oak') then
      If (Players[CurrentPlayer].strings[1]:= 'Oak') then
      exit;
     end else
       begin
        //OakWalk;
       end;
     If (Players[CurrentPlayer].strings[0]:= 'Tree') then
       If (Players[CurrentPlayer].strings[1]:= 'Tree') then
       exit;
      end else
       begin
        //TreeWalk;
       end;
     If (Players[CurrentPlayer].strings[0]:= 'Willow') then
       If (Players[CurrentPlayer].strings[1]:= 'Willow') then
       exit;
      end else
       begin
       // WillowWalk;
       end;
    end;

    ~shut

  5. #5
    Join Date
    May 2008
    Posts
    93
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Still doesn't work, I have this:
    SCAR Code:
    Procedure Walking;
    begin
     If Players[CurrentPlayer].strings[0] := 'Oak' then
      If Players[CurrentPlayer].strings[1] := 'Oak' then
      exit;
     end else
       begin
        //OakWalk;
       end;
     If Players[CurrentPlayer].strings[0]):= 'Tree' then
       If Players[CurrentPlayer].strings[1]):= 'Tree' then
       exit;
      end else
       begin
        //TreeWalk;
       end;
     If Players[CurrentPlayer].strings[0]):= 'Willow' then
       If Players[CurrentPlayer].strings[1]):= 'Willow' then
       exit;
      end else
       begin
       // WillowWalk;
       end;
    end;
    and it keeps saying that it is expecting a then, could it be that i have 3.15?

  6. #6
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    found it.

    if Players... := 'oak' then

    str := 'oak' --> with the : it sets a new value
    if str = 'oak' without the : it compares it.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Identifier expected in script?
    By fabis94 in forum OSR Help
    Replies: 3
    Last Post: 08-23-2008, 03:56 PM
  2. Bah!! Identifier Expected in Script.
    By siroober in forum OSR Help
    Replies: 3
    Last Post: 05-03-2008, 11:46 PM
  3. Identifier expected in script
    By wasapiguy2 in forum OSR Help
    Replies: 2
    Last Post: 03-25-2008, 09:57 AM
  4. 'THEN' Expected in script
    By Submersal in forum OSR Help
    Replies: 2
    Last Post: 11-17-2007, 11:23 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
  •