SRL Archive - RS3 Help

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


beefman

2015-04-23 12:25:31

Why am i getting this error?

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


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


Line 53 : else end

Gu3st...

2015-04-23 12:26:35

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

beefman

2015-04-23 12:29:29

Thank you. Sorry stupid mistake.

Rich

2015-04-24 03:01:31

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:
 if SPS.walkPath(pathToBank) then
minimap.waitPlayerMoving();
else
writeLn('We failed to walk to the bank');

Clutch

2015-04-25 17:00:02

From: Rich
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:
 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.

Rich

2015-04-25 17:21:09

From: Clutch
except you also can't have the semicolon like above but yes as he said.
Ah good spot, thanks for that :D

beefman

2015-04-25 17:44:01

From: Clutch
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?

KeepBotting

2015-04-25 18:11:57

From: beefman
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.

beefman

2015-04-26 10:59:38

From: KeepBotting
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.