Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Common Exceptions
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#1
Common Exceptions

I'm working on a list of common exceptions encountered by Amnesia developers and their solutions, so that newbies can find an easy reference guide and avoid clogging up the forums with repeated isntances of the same problem. If you have any additions, please feel free to post here!

For almost every error, it will give you a pair of numbers such as (13,2). It marks the location of the error by line and character. So in the above example, scroll down to line 13 and inspect it for your problem.

Unexpected end of file

One of the most common exceptions, caused when you don't close up your functions with an open "{" and close "}" bracket, or open and close quotes. It always gives you the character at the end of your script, so you have to check every quote and bracket in your script and make sure nothing is left hanging open.

No matching signatures to [FUNCTION]

You are trying to use a function that either doesn't exist or uses improper syntax. Check all your functions to make sure everything is used properly. This must-have wiki page lists every function and its proper syntax.

Correct: StartCredits("unlove.ogg", false, "Credits", "Credits", 4);
Improper syntax: StartCredits("unlove.ogg", false);
No such function: MakeEnemyDisappear(true);

Always remember the following syntax rules when writing functions:
string: Any word that can be an internal name. ALWAYS HAS QUOTES. Example: "credits"
bool: A boolean value, either true or false. NEVER HAS QUOTES.
int: Any integer. Example: 4
float: Any number with a floating decimal. Always terminates with an "f." Example: 3.25f

Expected ) or ,

You left out one of the above symbols. Check your script for a missing symbol, such as:

Missing ")": AddEntityCollideCallback("Player", "Message_1", "Message1", true,
Missing ",": void StartMusic(string &in asParent, string &in asChild int alState)

Expected ;

You left out a semicolon at the end of a function. Pretty easy to catch.

Correct: StartCredits("unlove.ogg", false, "Credits", "Credits", 4);
Incorrect: StartCredits("unlove.ogg", false, "Credits", "Credits", 4)

Expected identifier

You messed up a symbol somewhere in your syntax. Most commonly seen when accidently putting a period instead of a comma, such as in:

StartCredits("unlove.ogg", false, "Credits". "Credits", 4);

'[VARIABLE]' is not declared

You are trying to use a variable that is not technically declared. Research how to declare variables; there are several ways to do it, such as in the following examples.

Defining as a single value
int x = RandInt(1,4); ////DECLARED
SetEntityActive("orbpiece_emerald_"+x, true); ////USED

Defining as a set of values
for(int i=1;i<=6;i++) ////DECLARED (by using a "for" loop)
{
SetEntityPlayerInteractCallback("orbpiece_emerald_"+i, "GetShard", true); ////USED
}

Could not load file

Often happens when trying to change maps. Either you've forgotten to name a map file in your level door, or the names do not match.

(This post was last modified: 05-22-2012, 11:35 PM by Damascus.)
05-22-2012, 11:28 PM
Find
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#2
RE: Common Exceptions

I would recommend using Programmer's Notepad when scripting. If you forget to close a quotation, for example, it will highlight the entire light line with a very noticeable purple starting from the missing quotation. This will help with unexpected end of file errors.

05-22-2012, 11:49 PM
Find
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#3
RE: Common Exceptions

Damascus can you please update this with Unexpected token errors, caused when you put in a { or } where it isn't recognized? (such as floating without a function/loop/conditional in front of it?

05-25-2012, 03:21 PM
Find




Users browsing this thread: 1 Guest(s)