Results 1 to 9 of 9

Thread: Error: Found unexpected token "else", expected "End" at line 53

  1. #1
    Join Date
    Jan 2013
    Location
    United kingdom
    Posts
    102
    Mentioned
    4 Post(s)
    Quoted
    34 Post(s)

    Default Error: Found unexpected token "else", expected "End" at line 53

    Why am i getting this error?

    Code:
    Error: Found unexpected token "else", expected "End" at line 53

    Code:
    procedure bank();
    var
      bank: TPoint;
      pathToBank: TPointArray;
    begin
     pathToBank := [Point(126, 183), Point(124, 168), Point(122, 165), Point(126, 166), Point(123, 165), Point(124, 164)]
    
     if SPS.walkPath(pathToBank) then
      begin
        minimap.waitPlayerMoving();
      else end
        writeLn('We failed to walk to the bank');
      end

    Code:
    Line 53 : else end

  2. #2
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    should be "end else", not "else end"

  3. #3
    Join Date
    Jan 2013
    Location
    United kingdom
    Posts
    102
    Mentioned
    4 Post(s)
    Quoted
    34 Post(s)

    Default

    Thank you. Sorry stupid mistake.

  4. #4
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Just a pointer you don't actually need the begin and end as you're only calling one thing after the if, so it could be like this:
    Simba Code:
    if SPS.walkPath(pathToBank) then
        minimap.waitPlayerMoving();
      else
        writeLn('We failed to walk to the bank');
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  5. #5
    Join Date
    Mar 2015
    Posts
    438
    Mentioned
    21 Post(s)
    Quoted
    211 Post(s)

    Default

    Quote Originally Posted by Rich View Post
    Just a pointer you don't actually need the begin and end as you're only calling one thing after the if, so it could be like this:
    Simba Code:
    if SPS.walkPath(pathToBank) then
        minimap.waitPlayerMoving()
      else
        writeLn('We failed to walk to the bank');
    except you also can't have the semicolon like above but yes as he said.

  6. #6
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Quote Originally Posted by Clutch View Post
    except you also can't have the semicolon like above but yes as he said.
    Ah good spot, thanks for that
    Last edited by Rich; 04-25-2015 at 10:16 PM.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  7. #7
    Join Date
    Jan 2013
    Location
    United kingdom
    Posts
    102
    Mentioned
    4 Post(s)
    Quoted
    34 Post(s)

    Default

    Quote Originally Posted by Clutch View Post
    except you also can't have the semicolon like above but yes as he said.
    Is there a reason why you can't have the semicolon?

  8. #8
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by beefman View Post
    Is there a reason why you can't have the semicolon?
    It's because of the else. A routine called before an else statement may not have an EOL (end of line) character.
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  9. #9
    Join Date
    Jan 2013
    Location
    United kingdom
    Posts
    102
    Mentioned
    4 Post(s)
    Quoted
    34 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    It's because of the else. A routine called before an else statement may not have an EOL (end of line) character.
    Ah i see. Thank you.

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
  •