Programming Errors


Before you can resolve any errors, you have to find out what is wrong with your code. Most importantly, make sure your cog is running by putting a Print() statement in your cog.

If you have an error that is not in this list, send an email to the address on the main page so that this document can be updated.


Cog Doesn't Run

There are several things that could cause this symptom:

Crashes

A "crash," as it is used in this text, is the sudden termination of Jedi Knight. For a programming language, Cog (and JK in general) is amazingly crash-resistant. Syntax errors will stop a cog from running and not crash, you can leave variables undefined, mismatch symbol types, declare messages that don't exist, and make many other blunders that just wouldn't compile in another language. And because of this, it is usually easy to fix a crash or freeze when it happens.

There are, however, special cases when JK will crash for no apparent reason. But even so, when JK crashes, do not assume that it was a "random error." Almost all of the time, JK will crash because of a programming error.

Crashes during gameplay:

Crashes when loading JK: Crashes when loading a level:

Freezes

A freeze occurs when the game suddenly stops and your system does not respond. The only thing to do is reboot.

System Overload

This type of error occurs when you are taxing the JK engine. When this happens, JK will begin to skip over things. For example, projectiles will disappear. This probably can't be caused by cog. It will more likely happen when you try to do something graphically intensive - such as trying to create many fine particle trails on a machine that does not have a graphics accelerator.

Cog Runs Twice

Most likely, you will not know your cog has been loaded twice, but your cog will seem to defy all rules of programming.

Put a Print() statement after a short sleep in the startup message to see if your cog is being loaded twice. If the Print() statement prints the string to the screen twice, you will know the cog is being loaded twice. Check where your cog is listed and remove the duplicate entry.