Don't click here unless you want to be banned.

LSL Wiki : LSL101Appendix2

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl435.us.archive.org
<Int - Fo - Ch1 - Ch2 - Ch3 - Ch4 - Ch5 - Ch6 - App1 - App 2>

Appendix 2: Common Errors


99 compiler errors in the code,
99 compiler errs.
Fix one bug, compile it again,
2,459 errors in the code!



This section is devoted to common errors you will run across. While there's already a great section on these, the existing section probably doesn't appeal to more than professional coders.

Before I begin, you may want to look at the definition of a compiler.






Here are examples of errors you will run across, listed by relative frequency:



Syntax Error

By far the most common problem. Syntax errors mean the code could not compile because there are one or more problems with how the code has been physically written. To remedy this, simply double-check your code for any typos.



Stack-Heap Collision

Your script ran out of memory while it was running, likely because of a memory leak or similar problem. Revise the code and try again.



Math Error

Caused when a math operation does something that basic math can't handle (e.g. imaginary numbers, divide by zero, etc). The most common reason for this error is your code is dividing by zero somewhere.



Name Not Defined Within Scope

Another really common one. This means that the function or variable name you are trying to use has not been declared yet, is out of its scope, or you accidentally typed it wrong. To remedy this problem, check the variables and functions where the compiler has placed the cursor.



Type Mismatch

The variable type does not match the type you need or are trying to use. To remedy, check the variable or typecast it into a new type.



Function Call Mismatches Type or Number of Arguments

The function variables in the call do not match those in the actual function header. If a function is defined this(integer one, float two), then it requires a call to it that looks similar. For example, this(1,2.0); would be a proper way to call it.



Name Previously Defined Within Scope

The antithesis of the "not defined" error, this just means you used the same name twice. Change it and try again.



Tried to [Animate/Take Controls/Take Money/Etc] but Permissions Not Set

Permissions must be supplied for some actions, like taking money, starting an animation, changing the links of an object, or animating another avatar. These are requested with llRequestPermissions and handled in run_time_permissions.



Object Out of Range

If your client cannot see the object, it cannot properly interact with it. Get closer and try again.



Can't enable physics for objects interpenetrating other objects

Pretty self-descriptive. Occasionally this will fire when enabling phantom, but this is likely a bug.



Cannot rez object - parcel is full

This parcel is at its maximum number of objects. Move somewhere else.



Only objects under 31 primitives can enable physics

Pretty self-explanatory.



Error in parameter [yadda yadda]

In several list-based functions, like llParticleSystem, you will receive this error for supplying bad data. Try again at the area specified.



Uninitialized Variables Can't Be Included in a List

Pretty cut and dried, yes? Declare your variables!



Use of vector or quaternion method on incorrect type

Also pretty cut and dried. Only vectors accept vector commands. Only rotations accept quaternion commands.



Lists can't be included in lists

A list cannot be nested in another list. To add a list inside of another list, use functions such as llListReplaceList, llList2List, or simply adding the two lists together.



Return statement type doesn't match function return type

When a function is written to return a value, it must return the type defined in its preceeding variable definition. For example:

integer num()
{
    // This function is returning an integer, because "integer" is written before the function name.

    // This return would throw this error
    return "Yar.";

    // This one would work properly
    return 1;
}





Function returns a value but return statement doesn't

Similar to the last error, you can't just write return;. You must supply a value if the function requires it.



Not all code paths return a value

Where loops and if-statements are present, you may choose to have different function returns from different paths. Remember to supply a default return statement if none of the paths work.



Dead code found beyond return statement

Now here's one I've never seen before. While code should *technically* be able to run in this case, the presence of an error means the compiler doesn't like it.

Basically, if you plan to make use of return statements, don't add code after the function tries to exit.



Global functions can't change state

The compiler does not allow for state changes from functions users have created. While there is a hack for this scenario, it is likely better to follow the compiler on this one.



Expression must act on LValue

You can only assign values to variables. For example, you cannot do something like 2 = 3; because it makes no sense.



Token buffer overflow/ Not enough space for parser stacks/ Parser stack overflow

Your function's buffer blew up. Try again with fewer or simpler values.



Byte code assembly failed -- out of memory

The compiler failed because your script's code is too large to even just compile it. Try cutting down on the stuff you've typed or split the scripts with a communications system (example).



Too many listens

Your script is trying to open too many listener channels at once. Try consolidating channels and using llListenRemove.



Bounds check error

The compiler missed a bad value for something and it screwed up in your code. This is usually the result of using jumps poorly in code, or otherwise trying to do something that the compiler is not built to handle.



Hit Sandbox Limit

For objects in sandbox mode, this is just a notifier that the object has been moved 10 meters or across a sim boundary.



llSetPrimitiveParams Error Running Rule [Add number and Type Here]

Bad list data has been supplied to llSetPrimitiveParams at that supplied rule number. Check the list.



Script trying to illegally [access/give items to/start script in] [add name here]

Object or script permissions are not properly configured in this object. Common reasons for this are: The object is not yours, the object is flagged "No Modify," or the object has not had its pin set properly for script access.



Asset Failure

Occasioanally, Second Life's asset server becomes too overloaded with tasks and cannot save your script. In these cases, you should receive a pop-up warning to that effect. Simply try compiling/saving the script at a later time and save it in another place (like a text editor) for now.



User-Created Errors

Occasionally you will receive error messages created by other users. These are readily identifiable, because they usually will appear in local chat or a blue script box that does not look official. In these cases, ask the creator what's going on.



Chat Overrun

A deprecated error, but worth noting anyway. Second Life chat is limited to 255 characters. Fortunately, chat commands should now just truncate instead.


<Int - Fo - Ch1 - Ch2 - Ch3 - Ch4 - Ch5 - Ch6 - App1 - App 2>

Homepage | LSL101 | Tutorial | CrashCourse | Glossary
There is one comment on this page. [Display comments/form]