SRL Archive - OSR Help

Keep getting this error


Yago

2011-02-20 19:41:11

Program New;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}

Const
{---SMART Setup Constants---}
WORLD = 152;
MEMBERS = false;
SIGNED = true;
{---------------------------}

Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

With Players[0] Do
Begin
Name := ' ';
Pass := ' ';
Nick := ' ';
Active := True;
Pin := ' ';
End;
End;

Function InArea: boolean;

Var
PlayerPosition : Tpoint;

Begin
PlayerPosition := GetMyPos;
If (PointInBox(PlayerPosition , IntToBox(1000,1000, 3000,3000))) Then
Result := False;
[B]Else[/B]
Begin
Writeln('You are in the Area!');
Result := True;
End;
End;


Every time I add an else or end else to an if … then statement I keep getting the error:
Identifier expected at line *

at the appropriate line

(If (PointInBox(PlayerPosition , IntToBox(1000,1000, 3000,3000))) Then
Result := False;
Else).

I get the error at the else.

It happens to all my scripts. I have a feeling I'm doing the if … then thing wrong. Please help

Yago

2011-02-20 19:57:12

Nvm, I found out you cant capitalize if … then.

I believe this is the issue if not then let me know.

edit: nope it worked but now all my other if … thens are having the same identifier expected in the line with the
 else 

TomTuff

2011-02-20 20:43:04

don't put a semicolon after the line before the "else"

Yago

2011-02-20 21:18:56

That fixed that section, but now im having the same error here:


Begin
PlayerPosition := GetMyPos;

Begin
if (PointInBox(PlayerPosition , IntToBox(3000,3000, 3300,3300))) Then
InLumbyCastle := True
else
InLumbyCastle := False;
End;

if (InLumbyCastle = False) then
WriteLn('InLumbyCastle is ' + BoolToStr(InLumbyCastle) + '.');
WriteLn('You are not in the Lumbridge Castle Area.')
[B]else[/B]


There error is in the last line. I bolded it.


[B]else[/B] // line 50

[Error] (51:3): Identifier expected at line 50.

Thanks for you help :)

TomTuff

2011-02-20 21:24:34

1. you need to put your two write lines inside a begin end an end. the last line will be "End else". After the else, you need to either have another command or a series of commands in a begin/end.


if This then
begin
Writeln('this');
Writeln('that');
end else
begin
Writeln('those');
Writeln('these');
end;

**BANNED The Man

2011-02-20 21:25:02

 if (InLumbyCastle = False) then
begin
WriteLn('InLumbyCastle is ' + BoolToStr(InLumbyCastle) + '.');
WriteLn('You are not in the Lumbridge Castle Area.');
end
else

Yago

2011-02-20 21:34:30

OK. Thanks that solved my problems … for now. Sorry im new a just started getting the hang of this thing.