SRL Archive - General

Script Error 2


Silentcore

2012-03-24 15:41:05

I am currently on 90-100th line of my first made ever script. Everything seems fine soo far but when i try to "Compile" it says:

[Error] (96:11): Type mismatch at line 95
Compiling failed.

AND THE ERROR IS AT THIS PART:

Procedure Failsafe (Reason:String);
Begin
Players (CurrentPlayer).Loc!=Reason;
Logout;
Stats_Commit;
//ProgressReport;
TerminateScript;
End;

Abu

2012-03-24 15:45:10

I think it should be:
Players[CurrentPlayer].loc

You're getting the brackets wrong.. I think so anyway.

Yago

2012-03-24 16:21:09

IT would be nice to see more of the script.

But i think the problem is that
!=
is not an operator.

Use
<>
instead.

ShawnjohnSJ

2012-03-25 16:29:44

Procedure Failsafe (Reason:String);
Begin
Players (CurrentPlayer).Loc!=Reason;
Logout;
Stats_Commit;
//ProgressReport;
TerminateScript;
End;

First, when you're accessing elements in an array you use the [] brackets, not the () brackets, so it would be Players[CurrentPlayer].Loc.

Also, the statement in general doesn't make any sense. If you're trying to set the player's location to the variable Reason, the code would be: Players[CurrentPlayer].Loc=Reason;
If you're trying to compare the two to see if they do not equal each other, the code would be:
if(not(Players[CurrentPlayer].Loc = Reason)) then 
begin
// code
end;